Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Peter Tesler
    @vptes1

    Some of you were having trouble with sequential step blocks like these:

    ..
    Open Chrome
    Navigate to 'site.com'

    There was an issue that was fixed in the latest version, so please upgrade

    Also, hope everyone has a happy and healthy new year! ๐ŸŽ‰๐ŸŽ‰Thank you for your continued support!
    id7digital
    @id7digital
    Hi guys, i;m experiencing problems with the recursive flag, whenever I run my smashtest using the recursive syntax I seem to get the following error when generating branches - FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory (Has anyone experienced this at all)?
    Peter Tesler
    @vptes1
    Make sure you aren't generating too many branches
    i.e., enough to max out your memory
    id7digital
    @id7digital
    ah I see, I have one branch but it keeps generating 4 for some reason. That is just with Open Chrome when ran recursive it generates 4 branches for some reason, this is when i navigate to the main.smash file folder and just run smashtest --recursive
    Peter Tesler
    @vptes1
    You may have other files hiding somewhere in there
    Or post exactly what you're trying to run, your smashtest version, OS, your exact command, etc. for help troubleshooting
    Peter Tesler
    @vptes1
    I threw together a bunch of lessons on Smashtest. Please let me know what you think!
    https://smashtest.io/lessons
    Craig Waite
    @craigvl
    Great videos thanks heaps! I wonder if on the 4th video at around the 20 minute mark if the prop for 'login box' should be shown along with the usage to reinforce the link between the prop definition and usage, does this make sense? not major though. Thanks again.
    Peter Tesler
    @vptes1
    I think I do show it at around 19:30 :)
    Craig Waite
    @craigvl
    Yes was thinking that they should be shown at the same time so that it is obvious how they relate, but thinking about this some more I think that someone who is watching the 4th video would already have this understanding.
    id7digital
    @id7digital
    Thanks @vptes1
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    I like that I can use REPL to .load and run a smash script but when the script is done it disconnects. How can I stay connected so that I can use the smashtest shell to run more commands and then .save them?
    Peter Tesler
    @vptes1
    @RoyceTheBiker_gitlab I'm having trouble reproducing the issue - it doesn't disconnect for me
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    Running this on a Mac Book Pro. This is the command I use smashtest --test-server=http://localhost:4444/wd/hub -r. It exits with a zero value and no errors. Each command shows as passed. webdriver has messages about session starting and ending but no errors.
    This is the script.
    Open Firefox
    
        Navigate to 'localhost:4200'
            {{username}} = 'admin'
            {{password}} = '12345'
            Type {{username}} into 'input[name=username]'
            Type '{{password}}[enter]' into 'input[name=password]'
    If I go into REPL and run each command manually one at a time it stays connected and Firefox stays open.
    Can the --debug option help here? It wants a hash but I don't know what to do with that.
    Peter Tesler
    @vptes1
    You should either indent each of the last 4 lines or put a .. on top of the {{username}} line. You're creating four different branches here.
    Open Firefox
    
        Navigate to 'localhost:4200'
            ..
            {{username}} = 'admin'
            {{password}} = '12345'
            Type {{username}} into 'input[name=username]'
            Type '{{password}}[enter]' into 'input[name=password]'
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    Righ. I forgot about that. I will change it and try again.
    Peter Tesler
    @vptes1
    Or, to make it cleaner...
    ..
    Open Firefox
    Navigate to 'localhost:4200'
    {{username}} = 'admin'
    {{password}} = '12345'
    Type {{username}} into 'input[name=username]'
    Type '{{password}}[enter]' into 'input[name=password]'
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    It did not like the .., complained about Error: You cannot have a .. line without anything directly below [:1]. The tab in worked but the shell still terminates.
    Peter Tesler
    @vptes1
    I'd just run the test normally (put it in a .smash file, and run it with smashtest --test-server=http://localhost:4444/wd/hub, no -r flag). If you want to debug a particular step using the REPL, put a ~ next to it.
    You wouldn't put .. or indents into the REPL directly...only single-line commands
    So when you're using .load it just regurgitates a bunch of previously-typed-in lines directly into the REPL, and that doesn't always work
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    What is a good way to deal with CAPTCHA or MFA? I have control over the full stack. Is there a way to call an external command or API? I don't want to disable them or set them to fixed answers, I would like to call an API that will return what the input for these fields should be.
    Peter Tesler
    @vptes1
    Any nodejs code can go into a code block. You can do it from there.
    Peter Tesler
    @vptes1
    Version 1.7 is out!
    id7digital
    @id7digital
    Hi guys, do you know if there is a way of handling popups using smashtest, as in adding text to them using smashtest
    Peter Tesler
    @vptes1
    HTML popups or alerts?
    id7digital
    @id7digital
    alerts
    Peter Tesler
    @vptes1
    There are built-in steps for handling alerts. If there isn't one for typing in text, you can just make a custom one (with code block and webdriverjs code inside)
    You can access that WebDriver object in a code block via browser.driver
    Your code will be something like
    * Type {{text}} into alert {
        await browser.driver.switchTo().alert().sendKeys(text);
    }
    Then
    Type 'something' into alert
    yea looks like there isnt a built-in one. So try using this one.
    id7digital
    @id7digital
    thanks, is there a way around 2 text boxes in an alert?
    Peter Tesler
    @vptes1
    Not sure. You'd have to check the webdriverjs documentation on that.
    Peter Tesler
    @vptes1
    If webdriverjs doesn't allow you to switch between the two, I wonder if sending a tab key to the first box will do the trick
    id7digital
    @id7digital
    thanks, will give it a try for the first box see what happens :)
    mendhak
    @mendhak
    Just spotted API testing in the docs. Do you think there is any way to make use of OAuth signing when writing an API test?
    Peter Tesler
    @vptes1
    I think you can just pass in the same oauth stuff you'd pass to request.post(), etc. since the smashtest api functions are just a wrapper on top of request
    mendhak
    @mendhak

    Thanks, just tried it and it was as you said, a matter of putting the objects in the right place

     Make a request $ {
            await post( 
                { 
                    url: 'https://example.auth0.com/oauth/token', 
                    body: '{"client_id":"aaaaaaaa","client_secret":"bbbb","audience":"1234","grant_type":"client_credentials"}',
                    headers: { 'content-type': 'application/json' }
                });
        }
    
            Verify the response { 
                console.log(response.response.body.access_token);
            }

    Might be an auth0 thing, I had to use response.response to get to the body.

    Peter Tesler
    @vptes1
    Do you have the latest version? You should be able to get to it via just response, as opposed to response.response (this was a fix in one of the most recent versions)
    Also, I wonder if you can get away with not quoting the body, i.e., passing in regular json
    mendhak
    @mendhak
    Ah I updated to lastest version and response.body.access_token is now working. Using a regular JSON for body didn't work, but that's OK.

    Follow up q - how can I assign the response to a variable? I think I'm missing something fundamental here.

    This works: l('access_token', response.body.access_token);

    This doesn't work: {myvariable} = response.body.access_token - it results in SyntaxError: Unexpected token =