Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Peter Tesler
    @vptes1
    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 =

    Peter Tesler
    @vptes1
    {variable} = only works when it's at the start of a step. l() or g() works inside a code block.
    mendhak
    @mendhak
    That was it, thanks again @vptes1 - I'm now using {variable} = Get My Access Token as a function at the beginning then passing it as an Authorization header in subsequent API calls. Just what I needed
    Peter Tesler
    @vptes1
    👍
    id7digital
    @id7digital
    Hi guys, quick question, do you know if there is a way in smashtest to do clicks on elements of on unordered list. So i can specify the selector and it will just click on all li items, or would i need to write javascript for this?
    Peter Tesler
    @vptes1
    You mean multiple clicks, one on each li? Yeah you'd either need multiple Click steps, or implement a custom code block function in js
    id7digital
    @id7digital
    thanks @vptes1
    Craig Waite
    @craigvl
    Peter, was easy enough to hack together some code that allows screenshot compare to happen, using pixelmatch to do the compare and added two new parameters one to say "capture base line shots" and another to say "compare" , if difference is found creates a diff file, don't think that this is worth adding to core but just wanted to let you know that it was not to hard
    Peter Tesler
    @vptes1
    👍
    Craig Waite
    @craigvl

    Created a new project and only has one file smash file with:

    Open Chrome
    
        Desktop
    
            Navigate to 'www.google.com'

    If I run without --recursive , only creates one branch, if run with --recursive creates 16 branches?

    Peter Tesler
    @vptes1
    I cannot reproduce (version 1.7.0). It creates 1 branch in both cases. Check what other .smash files exist in the directory structure below.
    Craig Waite
    @craigvl
    none, but will try and see if I can find one
    ok so that is the issue picking up from smashtest folder in node_modules folder
    mendhak
    @mendhak

    Can a props contain a variable? eg, something like this

    Setup Props {
        props({
            'my button': `contains {my_global_variable}`
        });
    }
    
        Verify 'my button' is visible

    I've tried with and without the {}, with and without "{}".

    Peter Tesler
    @vptes1
    Since props is just js, use something like contains ${myvariable}
    Or contains ${g('my variable')}
    Make sure the variable is already set by the time that line is executed
    @mendhak ^
    mendhak
    @mendhak

    Thanks, that was it just had to add the double quotes around the ${}. I got it working like so

    Setup Props {
        props({
            'my button': `contains "${my_global_variable}"`
        });
    }
    
        Verify 'my button' is visible

    The g() version also worked.

    Peter Tesler
    @vptes1
    Awesome!
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    I was hoping to get this running in Linux but I am running into problems.
    Has anyone been able to get this running in Linux and does anyone have advice?
    RoyceTheBiker
    @RoyceTheBiker_gitlab

    I got half working. I get an error about only supporting Chrome 80. I have version 79, and testing with firefox gives a JS error.

    Open Chrome
    Open Firefox
    
        Navigate to 'google.com'
    
            Type 'hello world[enter]' into 'textbox'

    I will try again later.

    Craig Waite
    @craigvl
    Any way to change the EF text compare from a "contains" to a "equals"? can you pass a regex?
    Craig Waite
    @craigvl
    I have answered my own question I think, at the moment it is using 'contains' would need to change to 'contains exact' elementfinder line 219
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    image.png
    I forked the project to add Docker setup files. I ran SmashTest in Ubuntu and got the same errors. I would really like a workaround for this. I understand that the project does not have official support for Linux. What would it take to make it work?
    Peter Tesler
    @vptes1
    Try upgrading to the latest version of nodejs
    @RoyceTheBiker_gitlab ^
    Craig Waite
    @craigvl
    @RoyceTheBiker_gitlab I had the same issue and the fix was as Peter has suggested to update node version
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    What is the version number you tried with? I have tried with 9, 10 and 13.8.
    Open Chrome
    WebDriverError: unknown error: Chrome failed to start: exited abnormally.   [/root/sample.smash:1]
      (unknown error: DevToolsActivePort file doesn't exist)
      (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
    Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
    System info: host: 'ubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.3.0-28-generic', java.version: '11.0.6'
    Driver info: driver.version: unknown
    remote stacktrace: #0 0x55e0276927a9 <unknown>
    
        at Object.checkLegacyResponse (/root/.nvm/versions/node/v13.8.0/lib/node_modules/smashtest/node_modules/selenium-webdriver/lib/error.js:585:15)
        at parseHttpResponse (/root/.nvm/versions/node/v13.8.0/lib/node_modules/smashtest/node_modules/selenium-webdriver/lib/http.js:554:13)
        at Executor.execute (/root/.nvm/versions/node/v13.8.0/lib/node_modules/smashtest/node_modules/selenium-webdriver/lib/http.js:489:26)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
    Craig Waite
    @craigvl
    I am on 10.16.0 , you are now seeing a different error (the previous error has been fixed). I have not seen the above error, would need to google this one.
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    Also, I am not a fan of using open-ended updates like nvm install node as it is technically inconsistent with builds at other times.
    My Ubuntu could be in a bad state. I will move back to testing Docker and try 10.16.
    Craig Waite
    @craigvl
    Ok, I think that the node version is not the issue anymore, but more a chromedriver issue on linux
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    Ubuntu was pooched. Webdriver and Java had locked. Doing a reboot.
    Craig Waite
    @craigvl
    Ok I think that will help move forward
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    Fixed in Ubuntu! It can't run as the root user. Grrrr! I will add an untrusted user to Docker and see if that works.
    Craig Waite
    @craigvl
    @RoyceTheBiker_gitlab :thumbsup:
    Craig Waite
    @craigvl
    @vptes1 what are your thoughts on being able to pass something like [exactmatch] (eg. "foobutton[exactmatch]" at the end of a string in the element finder text string , then if this if found using a regex change to 'contains exact' ?
    Craig Waite
    @craigvl
    Have done the above work, let me know if you would like a PR
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    So I still can't get it to work in Docker so I thought I would try a different approach. I started up an Ubuntu 18.04 server with no graphical desktop. When root runs the test it fails with the error but when an untrusted user runs it the tests all complete and pass. I have a few other things to check on like host logs and see if there is something being reported.
    Craig Waite
    @craigvl

    @vptes1 In the process of creating a unit test for my PR I now see that I can do

    contains exact 'FOO BAR'

    Is this is the doco somewhere ?

    Peter Tesler
    @vptes1
    @craigvl not sure what you mean
    contains exact is documented in the list of built-in props
    it was actually one of the original built-in props, but isn't that popular so it's not used in too many examples
    Craig Waite
    @craigvl

    I had no idea that for the 'text' search you are able to pass "contains exact" as I was just reading the info on page https://smashtest.io/ui-testing/elementfinders under "Matching rules" for the 1. 'text' section

    Think that it might be good to add a note about the fact that you can pass 'contains exact' to that area of the doco?

    RoyceTheBiker
    @RoyceTheBiker_gitlab
    It looks like the workaround to getting webdriver to run Chrome in Docker is to add --disable-dev-shm-usage according to Running webdriverio tests using headless chrome in Docker so now I am looking for this config file and see if I can make that work. Adding it as an option to webdriver-manager start did not help.
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    I have Firefox 100% working from within Docker but Chrome is still acting up.