SeleniumHQ / selenium-ide

Open Source record and playback test automation for the web.
https://selenium.dev/selenium-ide/
Apache License 2.0
2.84k stars 768 forks source link

Run test failed in selenium-side-runner #1792

Closed fgcui1204 closed 8 months ago

fgcui1204 commented 9 months ago

💬 Questions and Help

Hi, I got an error when running the tests with selenium-side-runner but it's passed in selenium ide.

Debug Logs:

seleniumide-selenium-side-runner-1  | debug: executing store|//button[@id='settingsbutton__BV_toggle_']|settingBtn
seleniumide-selenium-side-runner-1  | debug: passed store|//button[@id='settingsbutton__BV_toggle_']|settingBtn
....
seleniumide-selenium-side-runner-1  | debug: executing waitForElementPresent|xpath=${settingBtn}|30000
seleniumide-selenium-side-runner-1  | debug: errored waitForElementPresent|xpath=${settingBtn}|30000
seleniumide-selenium-side-runner-1  | error: Waiting for element to be present
seleniumide-selenium-side-runner-1  | Wait timed out after 30223ms
seleniumide-selenium-side-runner-1  | debug: Playing state changed errored for test PC011 - Personal tab - Empty Patient ID
seleniumide-selenium-side-runner-1  | info: Finished test PC011 - Personal tab - Empty Patient ID Failure
seleniumide-selenium-side-runner-1  | info: Last command: {"command":"waitForElementPresent","comment":"","id":"c1ea0e3f-a4cc-4d77-9b6a-2183496a8836","target":"xpath=${settingBtn}","targets":[],"value":"30000"}

I'm pretty sure the setting button is showing in here and if I run the tests with ide. it works well. But it's failed in docker.

Dockerfile:

FROM node:14-alpine

RUN npm install -g selenium-side-runner@4.0.0-alpha.71 jest-junit

ADD docker-entrypoint.sh /opt/bin/docker-entrypoint.sh
RUN chmod +x /opt/bin/docker-entrypoint.sh

RUN mkdir /sides

WORKDIR /root

VOLUME [ "/sides" ]

CMD "/opt/bin/docker-entrypoint.sh"

docker-entrypoint.sh

selenium-side-runner --debug -j " --reporters=jest-junit  --reporters=default " -c "goog:chromeOptions.args=[disable-infobars, headless]" --server http://selenium-hub:4444/wd/hub --output-directory /root/out /sides/*.side

docker-compose.yml

version: "3"
services:
  selenium-hub:
    image: selenium/hub:4.18.0-20240220
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"

  selenium-node-chrome:
    image: selenium/node-chrome:4.18.0-20240220
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  selenium-side-runner:
    build: .
    depends_on:
      - selenium-node-chrome
    volumes:
      - './staging/:/sides'
      - './staging/out:/root/out'

Please note that this issue tracker is not a help form and this issue will be closed.

For questions or help please see:

toddtarsi commented 9 months ago

Wow! Your code and environment is very cleanly setup. Nice docker!

The first thing I would do here is check what the UX looks like at the time of crash. It's better to just be able to tell with 100% certainty. I think the side-runner has an option to store test failure screenshots in a specific folder:

-z, --screenshot-failure-directory [directory] Write screenshots of failed tests to file in specified directory. Name will be based on test + timestamp.

Sometimes that can help explain things. I'm sure there are inconsistencies I'm missing in the IDE, but my gut with a lot of that is that CI or docker environments might be more resource limited and need longer pauses or stuff like that.

toddtarsi commented 9 months ago

@fgcui1204 - Did this ever resolve for you?

toddtarsi commented 8 months ago

@fgcui1204 - I will assume the issue was resolved and close this in the next couple weeks if I don't hear back

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.