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

Improve testing on cht-conf #425

Closed
njogz opened this issue Sep 9, 2021 · 2 comments · Fixed by #620
Closed

Improve testing on cht-conf #425

njogz opened this issue Sep 9, 2021 · 2 comments · Fixed by #620
Assignees
Labels
Type: Technical issue Improve something that users won't notice

Comments

@njogz
Copy link
Contributor

njogz commented Sep 9, 2021

Describe the issue
We currently do not have integration/e2e tests on cht-conf.

Describe the improvement you'd like
Add some happy path tests to get started on this type of testing. Tests to add might include:

  • a local edit through the actual cli
  • starting up API and couch and ensuring the edits get pushed correctly

Describe alternatives you've considered
None.

@njogz njogz added the Type: Technical issue Improve something that users won't notice label Sep 9, 2021
@njogz njogz self-assigned this Sep 9, 2021
@njogz
Copy link
Contributor Author

njogz commented Sep 13, 2021

Refactor fetch-document-list.js to address this PR comment

@sugat009
Copy link
Member

Updates:
After a brief assessment of the current codebase of cht-conf and obtaining insights from @garethbowen , @andrablaj , @jkuester and @m5r , the e2e tests will be conducted for each action(backup-all-forms, backup-app-settings, etc.) available on cht-conf.

The e2e test plan will be roughly as follows:

  1. Run a latest version cht-core instance using docker-helper at the beginning of the e2e test. This can be extended to include multiple supported versions of cht-core but for initial setup purposes we'll be running tests against the latest version only.
  2. Run the cht-conf actions against the cht-core instance. Check if the output is as expected in that cht-core instance.
  3. Stop the cht-core instance using the docker-helper.

Additionally, to make the reviews and feedback short and often, I plan on sending PR for each action. I've created a feature branch 425-improve-testing-on-cht-conf onto which I'll be sending the PR for each action.
Let me know if there's anything.

sugat009 added a commit that referenced this issue Jan 30, 2024
sugat009 added a commit that referenced this issue Feb 1, 2024
sugat009 added a commit that referenced this issue Feb 1, 2024
@m5r m5r self-assigned this Jun 27, 2024
m5r pushed a commit that referenced this issue Jul 1, 2024
m5r added a commit that referenced this issue Jul 15, 2024
* feat(#425): Create e2e test setup

* Setup mocha hooks and add to npm run command

* orchestrate with mocha hooks

* test run in the ci

* test run in the ci

* move session-token test to test/integration folder

* add trace logs

* add trace logs

* remove traces

* split logic if we have an existing project configuration file

* refactor hooks and extract utils functions to deal with cht-docker-helper

* refactor `spinUpCht` to fix eslint warning about promise executor cannot be async

* finally get the first e2e test out, working as expected

* trace errors in CI

* check for existence of project configuration before running teardown

* add more traces

* do we have the latest version of the script?

* what's wrong with `docker exec`?

* create make parent directories as needed same as `mkdir -p`

* organize todos, remove debugging logs

* replace 4 spaces => 2 spaces to follow coding style in the repo

* oops forgot these

* extract utils functions to reuse in other tests

* logs

* pass project name to `runChtConf` as expected

* await getProjectUrl()

* sonar :)

* clean up

* more clean up

* clearer test title

* - switch back to cht-docker-compose.sh from cht-core master
- hardcode local-ip IP address in the CI job

* add trace

* clean up trace

* replace hardcoded package.json name

* add comments to explain the rationale behind the `stdio` option when running the docker helper script

* remove linting before running e2e tests

* increase timeout to prevent frequent failures due to CHT instance taking too long to be ready

* remove `.cht-docker-helper` in teardown

* fix import of `DEFAULT_PROJECT_NAME`

* dedup code in `initProject`

* remove unnecessary `structuredClone`

* add assertions about `baseSettings.language`

* throw error early when config file doesn't exist

* extract `readCompiledAppSettings` & `writeBaseAppSettings` cht conf utils

* touch a word about e2e tests in readme

* it's better with the right npm script...

* format

---------

Co-authored-by: Sugat Bajracharya <sugatbajracharya49@gmail.com>
@m5r m5r linked a pull request Jul 15, 2024 that will close this issue
@m5r m5r closed this as completed Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Technical issue Improve something that users won't notice
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants