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

chore: add steps to run upgrade e2e #1218

Merged
merged 13 commits into from
Dec 4, 2023
27 changes: 25 additions & 2 deletions content/en/contribute/code/core/fixing-e2e-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,31 @@ There are logs and screenshots stored in the allure reports. [Here](https://gith

Running e2e tests can be quite slow so to save time modify the `specs` property of `/tests/e2e/**/wdio.conf.js` so it only finds your test. You can also use `describe.skip` and `it.skip` to skip specific tests.

```

## Watching the test run

Running the tests locally with `npm run wdio-local` or `npm run standard-wdio-local` will allow you to watch it run but if you interact with the page the test will fail in unexpected ways. Furthermore the browser will close after a short timeout so you won't be able to inspect the console or DOM. To do this, force quit the process running the test before it tears down and you will be able to navigate around the app, use Chrome dev tools, and inspect the docs in the database to (hopefully) work out what's going wrong.

## Running upgrade e2e test locally

To run the upgrade e2e tests in your local environment, follow these steps:
- Make sure your branch has been published and it's available in the market:
- A way to do this is by pushing the branch, let the GitHubActions to run, if all the other e2e as okay, then it will publish the branch.
latin-panda marked this conversation as resolved.
Show resolved Hide resolved
- Check that your branch name is available [here](https://staging.dev.medicmobile.org/_couch/builds_4/_design/builds/_view/releases).
- Make sure to stop all existing containers
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean with this step? Because you need the cht-docker container to be able to run cht-core.
Maybe you could add the link to the CouchDB Setup and say that only that container should be running.

- Run CHT as usual:
Copy link
Contributor

Choose a reason for hiding this comment

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

What about couchdb? with what config? I used this.
Maybe it is better to reference dev environment setup

- `npm run build-dev-watch`
- `npm run dev-api`
- `npm run dev-sentinel`
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add the link to run the CHT? It will be easier in case someone needs more help

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this steps are not needed. npm run upgrade-wdio should set up everything.

- Set these environment variables:
- `export MARKET_URL_READ=https://staging.dev.medicmobile.org`
- `export STAGING_SERVER=_couch/builds`
- `export BRANCH=<your branch name>`
- Run the upgrade e2e tests: `npm run upgrade-wdio`
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add where should that command be run? I assumed it was in the cht-core/ root level, but it would be a good idea to confirm it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It took some debugging but the correct STAGIG_SERVER for 4.x releases is _couch/builds_4
While for anything previous 4.x the value should be _couch/builds


If you experience errors such as:
```
Error in hook: StatusCodeError: 404 - "{\"error\":\"not_found\",\"reason\":\"Document is missing attachment\"}\n"
```
Try the following:
- Make sure to stop all existing containers, because maybe the Nginx port was already allocated and it couldn't start.
- If you keep getting errors, check that the Nginx ports are available.
Copy link
Contributor

Choose a reason for hiding this comment

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

I keep getting the error:
Error in hook: StatusCodeError: 404 - "{\"error\":\"not_found\",\"reason\":\"Document is missing attachment\"}\n"
What did you do to fix it?

Copy link
Contributor Author

@latin-panda latin-panda Nov 3, 2023

Choose a reason for hiding this comment

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

I ran wdio-local before and that fixed it but I don't think that's the proper way.
@tatilepizs is also getting the same error

@dianabarsan, what other troubleshooting steps can they follow here?

Loading