Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    id7digital
    @id7digital
    hi guys, im having a bit of trouble with the command line smashtest arguments, --recursive does not seem to pick up any functions in subfolders in my directory
    smashtest folderpath/*.smash --recursive
    Peter Tesler
    @vptes1
    @id7digital Try running just smashtest --recursive (possibly also cding into folderpath)
    I believe --recursive overrides the path passed into the command
    Peter Tesler
    @vptes1
    Everyone, I've updated https://smashtest.io/getting-started/setup to recommend using selenium-standalone for windows users (as opposed to webdriver-manager). It seems that a number of you had trouble using webdriver-manager on windows, even though that's the most popular manager on npm. If you've had success with webdriver-manager, or trouble with selenium-standalone, please let me know. I'd love to get your feedback and update the site accordingly.
    id7digital
    @id7digital
    thanks @vptes1
    Craig Waite
    @craigvl
    yes selenium-standalone seems to work well on windows
    Notice that your doco states that you need to download the drivers , I think that standalone does this for you?
    Peter Tesler
    @vptes1
    Yes, it says you need to download the drivers if you're doing option 1, the manual install of selenium standalone.
    Selenium standalone, not the npm package selenium-standalone
    Option 2 is the manager option (npm package webdriver-manager or selenium-standalone)
    Craig Waite
    @craigvl
    Whoops read option 1 as the NPM package :0)
    Robby Tarigan
    @robbytarigan
    Hi. Does anyone know why smashtest gives error like "Error: Server was killed with SIGTERM"?
    That is using smashtest 1.6.9 and node 12.13.1 on windows. Example of log:
    Error
    Error: Server was killed with SIGTERM [C:/projects/project1/main.smash:2]
    at C:\projects\project1\node_modules\selenium-webdriver\remote\index.js:251:52
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    Peter Tesler
    @vptes1
    What's in your test? What browser is this happening in? Are you using a --test-server? (if not, did you set the SELENIUM_SERVER_JAR as per https://smashtest.io/getting-started/setup ?)
    Also, it's a good idea to upgrade smashtest to the latest version
    Peter Tesler
    @vptes1
    The whole SIGTERM thing is an error internal to selenium
    Craig Waite
    @craigvl
    Needing to catch the UnexpectedAlertOpenError exception that gets thrown in selenium-webdriver error.js (592) , just wondering where this should be caught to make sure that I am doing this correctly, Thanks.
    Peter Tesler
    @vptes1
    I assume you're getting that because an alert is open and you're trying to do something else? Is the alert supposed to be there in the first place?
    Craig Waite
    @craigvl
    Yes the application that I am testing is using alerts for user actions "Are you sure you want to delete this" etc..
    Peter Tesler
    @vptes1
    Then you have to close the alert first, then do stuff
    there are a few steps that do that
    i.e., click one of the buttons in the alert
    or alternatively you can use js in a code block
    Craig Waite
    @craigvl
    ok yes but the test just fails as soon as the alert is shown
    image.png
    Peter Tesler
    @vptes1
    Is clicking deleteButton what triggers the alert to open?
    And if so, what's the whole stack trace on that?
    Craig Waite
    @craigvl
    yes when you click on deleteButton and stack is:
      (Session info: chrome=78.0.3904.108)
      (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.18362 x86_64)
        at Object.checkLegacyResponse (smashtest\node_modules\selenium-webdriver\lib\error.js:593:13)
        at parseHttpResponse (smashtest\node_modules\selenium-webdriver\lib\http.js:554:13)
        at Executor.execute (smashtest\node_modules\selenium-webdriver\lib\http.js:489:26)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    Peter Tesler
    @vptes1
    Did a google and in the first result they say how there's a bug in selenium where it throws that error if an alert is open and a screenshot is taken. Do you have screenshots on? If so, does disabling them (temporarily) fix this?
    Peter Tesler
    @vptes1
    Also, according to http://garajeando.blogspot.com/2014/06/protractor-how-to-avoid.html if you immediately dismiss the alert right after the click, it should make the problem go away. Not sure why this would work but they say it does haha
    Try using built-in steps Accept alert or Dismiss alert
    DWTUTS
    @dwtuts
    Hey is there a way to set return responses from API tests as a variable to use in another API test?
    Peter Tesler
    @vptes1
    You can return anything in a code block and then use the js variable prev to access it in a subsequent code block
    Hope that answers your ques!
    Or you can just set a variable with g('varname', value) and access it as js variable with varname in subsequent code blocks
    DWTUTS
    @dwtuts
    So say I have an API test like so await post({ url: 'https://api.com/endpoint', headers: { 'content-type': 'text/plain' }, body: `body goes here`, timeout: 1500 }); would I just need to call the response.verify inside of that with the body set to a variable?
    Peter Tesler
    @vptes1
    Oh you have to call response.verify() in any subsequent step's code block, just like in the documentation. No need to set variables, it handles passing the response to the next step.
    Craig Waite
    @craigvl
    Peter, thanks for the ideas, same with screenshots off and errors on click so unable to use Accept alert, don't waste any more time on this, I will let you know if I figure something out.
    DWTUTS
    @dwtuts
    Does anyone have an example maybe of calling an api and then assigning the body value to a variable? I am still having some issues trying to figure it out.
    Peter Tesler
    @vptes1
    @craigvl Please upgrade to 1.6.15. The problem should be solved there.
    @dwtuts I think I understand what you mean. You can access the response body via response.response.body, or, if you upgrade to 1.6.15 you should be able to access it via response.body. The response object is available in any step following the step where the request was made from. It is also the return value of the request function call. So....
    Make a request {
        await get(`https://site.com/endpoint`);
    }
        Make another request {
            await get(`https://site.com/endpoint2/${response.body.value1}`);
        }
    or
    Make requests {
        let response = await get(`https://site.com/endpoint`);
        let response2 = await get(`https://site.com/endpoint2/${response.body.value1}`);
    }
    Craig Waite
    @craigvl
    Peter thanks, it now fails with the same error on the next step after the Click step:
    Click 'deleteButton' (was failing here)
            Accept alert (fails here now)
    Peter Tesler
    @vptes1
    Are you in debug mode or normal mode?
    Craig Waite
    @craigvl
    debug
    Peter Tesler
    @vptes1
    @craigvl ok try 1.6.16
    apparently you cannot inject js into the browser while an alert is open