Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix E2E tests #692

Merged
merged 5 commits into from
Feb 2, 2021
Merged

Fix E2E tests #692

merged 5 commits into from
Feb 2, 2021

Conversation

nickclyde
Copy link
Member

@nickclyde nickclyde commented Jan 28, 2021

Related Issue or Background Info

Fixes #681

Changes Proposed

  • use input names instead of IDs on add patient form
  • remove extraneous container from docker compose config

Additional Information

@sharmaneil let me know if this fixes the tests for you locally. Make sure you are running the app (both backend and frontend) before running yarn e2e or npm run e2e from the frontend/ dir

@nickclyde nickclyde requested a review from sharmaneil January 28, 2021 18:39
@sharmaneil
Copy link
Contributor

Thanks for looking into this! I pulled this branch, but I'm still getting it stuck on the same part:

Creating e2e_selenium-hub_1 ... done
Creating e2e_firefox_1      ... done
Creating e2e_nightwatch_run ... done
Waiting for app to boot...
Waiting...
Waiting...

I run the backend spring app locally and the db in docker -- is this important?

@nickclyde
Copy link
Member Author

Running the Spring app locally and db in docker is fine, are you also running the frontend with yarn start?

@sharmaneil
Copy link
Contributor

yup, i'm using yarn start, and everything works when i hit localhost:3000

I'm not at all familiar with selenium at all; any tips on how to debug this locally?

@nickclyde
Copy link
Member Author

One thing I forgot to mention (my bad), you'll probably need to do cd frontend/e2e; docker-compose build, and then try again and let me know how that goes. I may just bake the image build into the yarn e2e command to ensure that gets done

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 1, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sharmaneil
Copy link
Contributor

sharmaneil commented Feb 1, 2021

Still no change when i do cd frontend/e2e; docker-compose build

Cursory glance at docker logs don't indicate a problem with selenium afaict, but nightwatch still cycles

nightwatch

neilsharma@Neils-MBP frontend % docker logs 6cd1b14989b9
Waiting for app to boot...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...

firefox

neilsharma@Neils-MBP frontend % docker logs 52747c0913b5
2021-02-01 21:19:39,374 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2021-02-01 21:19:39,377 INFO supervisord started with pid 10
2021-02-01 21:19:40,382 INFO spawned: 'xvfb' with pid 12
2021-02-01 21:19:40,384 INFO spawned: 'selenium-node' with pid 13
Connecting to the Hub using the host localhost and port 4444
2021-02-01 21:19:40,847 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2021-02-01 21:19:40,848 INFO success: selenium-node entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
21:19:41.294 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
21:19:41.507 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 5555
2021-02-01 21:19:41.668:INFO::main: Logging initialized @810ms to org.seleniumhq.jetty9.util.log.StdErrLog
21:19:42.052 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
21:19:42.181 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 5555
21:19:42.181 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub
21:19:42.233 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
21:19:42.746 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://localhost:4444/grid/register
21:19:42.812 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use

selenium hub

neilsharma@Neils-MBP frontend % docker logs 6a6a3373a5a9
2021-02-01 21:19:39,048 INFO Included extra file "/etc/supervisor/conf.d/selenium-hub.conf" during parsing
2021-02-01 21:19:39,051 INFO supervisord started with pid 7
2021-02-01 21:19:40,060 INFO spawned: 'selenium-hub' with pid 9
Starting Selenium Hub with configuration:
2021-02-01 21:19:40,076 INFO success: selenium-hub entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
{
  "host": "0.0.0.0",
  "port": 4444,
  "role": "hub",
  "maxSession": 5,
  "newSessionWaitTimeout": -1,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "jettyMaxThreads": -1,
  "cleanUpCycle": 5000,
  "browserTimeout": 0,
  "timeout": 1800,
  "debug": false
}
21:19:40.545 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
21:19:40.737 INFO [GridLauncherV3.lambda$buildLaunchers$5] - Launching Selenium Grid hub on port 4444
2021-02-01 21:19:41.230:INFO::main: Logging initialized @1143ms to org.seleniumhq.jetty9.util.log.StdErrLog
21:19:41.530 INFO [Hub.start] - Selenium Grid hub is up and running
21:19:41.531 INFO [Hub.start] - Nodes should register to http://172.28.0.1:4444/grid/register/
21:19:41.531 INFO [Hub.start] - Clients should connect to http://172.28.0.1:4444/wd/hub
21:19:42.812 INFO [DefaultGridRegistry.add] - Registered a node http://172.28.0.1:5555

@nickclyde
Copy link
Member Author

Hmmm... to debug, try changing line 9 in nightwatch-entrypoint.bash to curl -k http://localhost:3000, to see if the docker container is able to access your frontend server

@sharmaneil
Copy link
Contributor

sharmaneil commented Feb 1, 2021

that revealed an issue:
curl: (7) Failed to connect to localhost port 3000: Connection refused

docker-compose.yml's nightwatch service has network_mode: "host" configured. Anything else I should do?

@nickclyde
Copy link
Member Author

I keep forgetting this, but apparently the host network mode does not work well on Macs:
docker/for-mac#1031
The issue is that normally you need to expose a service in a docker container to the host, but in this case it's the other way around - we need to access the host service on port 3000 from inside the container. network_mode: host does this on linux, but I guess there are issues with Mac OS that make it not possible on Macs.
Let me do some more digging to see if there's a good solution that works on both mac and linux.

@sharmaneil
Copy link
Contributor

Thanks Nick for debugging; please don't treat this as a high priority issue -- the e2e works as part of the github actions CI, which is more important.

@nickclyde
Copy link
Member Author

Okay, sounds good - should we merge this PR then, and keep the issue open so I can update there if I find any solution for running locally on mac?

Copy link
Contributor

@nullflux nullflux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@nullflux nullflux merged commit 6e302fc into main Feb 2, 2021
@nullflux nullflux deleted the nc/fix-e2e branch February 2, 2021 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't run E2E tests locally
3 participants