Watts-Lab / researcher-portal

deliberation lab collaborator tools
0 stars 0 forks source link

Set up cypress to automatically run on PR commits, as we do with deliberation-empirica #38

Closed JamesPHoughton closed 1 month ago

JamesPHoughton commented 1 month ago

As a project maintainer, i want to see a report on each PR of the tests that have run and their status, so that I can merge PRs confidently, knowing nothing will break due to changes in the PR.

The way we've addressed this in deliberation-empirica is to set up automated tests that run as a GH action, and report to cypress.io their results. Then cypress.io displays the results in the PR comment chain.

JamesPHoughton commented 1 month ago

We decided that we want the GH action to run cypress tests on the built version. To do this we'll need to update the cypress.yml github action to build the code, with the option build: npm run build. As an example, see the example in deliberation-empirica: https://github.com/Watts-Lab/deliberation-empirica/blob/main/.github/workflows/cypress.yml#L24

In order to make this work locally, we need to run npm run build to build the production version, and then run npm run start to start the production version.

In doing this we discovered that the builder is strict about having types specified, even though the dev server is not (which makes sense). So we need to add the remaining types. We opened an issue to do this here: https://github.com/Watts-Lab/researcher-portal/issues/43

evanping commented 1 month ago

46