Where communities thrive


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

    @RoyceTheBiker_gitlab We run our smashtests in Docker, both FF and Chrome. I'm going to paste a Dockerfile and a docker-compose.yml here. Try this yourself.

    The Dockerfile

    FROM node:12.9.1
    ENV PATH="/code/drivers/linux:${PATH}"
    
    ARG WORKDIR=/code/
    
    WORKDIR ${WORKDIR}
    
    COPY ./package.json ${WORKDIR}package.json
    COPY ./package-lock.json ${WORKDIR}package-lock.json
    RUN npm install
    COPY . ${WORKDIR}
    
    CMD env

    Then the docker compose yml

    version: "3.4"
    
    services:
      testserver:
        depends_on:
          - firefox
        image: "my/test-runner"
        volumes:
          - ./smashtest:/code/smashtest
          - ./:/code/
    
        build:
          context: .
          dockerfile: Dockerfile
        command: bash -c "npx smashtest"
      firefox:
        image: "selenium/standalone-firefox:latest"

    And finally I run it like

    docker-compose run --rm testserver npx smashtest
    The ./smashtest is a volume mount because the report.html is output there.
    The ./ is volume mounted too so that I can make changes to .smash file and just rerun quickly
    Similar for chrome, just using the selenium standalone. So not having to worry about the driver
    RoyceTheBiker
    @RoyceTheBiker_gitlab
    Thanks @mendhak. I see your base is node, I don't think my problem is in node. I think the problem is that I am trying to do too much in one docker image. I chose Debian so that I could run Chrome and Firefox in one image and node for the most part works just fine. I think Chrome and Firefox should be in Debian with smashtest and webdriver in another. I will use docker-compose to connect them and see if that works better.
    Craig Waite
    @craigvl
    I find that I am often wanting to await a whole list of props for the "on page x" steps, would it be good to have a method that you could just call that would just apply await $$(prop) for all the props ? Does that make sense? Could just add as an enhancement on GitHub?