A suite of automated web app tests for the Onspring platform using:
git clone https://github.com/StevanFreeborn/OnspringEnd2EndTests.git
npm install
npx playwright install
Copy the example.env
file and rename it to .env
cp example.env .env
Update the .env
file with values for your environment
npm run test
npx run test:chrome
-- or --
npx run test -- --project=chrome
npm run test -- app.spec.ts
npm run test -- -g "Delete a user"
A helpful script to run tests against a specific target environment without having to alter the .env
file. Note you can pass all the same arguments as you would to npm run test
to this script. But note the --target
argument should come first followed by --
and then the rest of the arguments you want to pass to the test script.
npm run test:env --target=<target> -- emailBody.spec.ts --project chrome
This workflow runs the Playwright tests in a GitHub Actions workflow and allows you to supply an environment variable for the environment you want to run the tests against. It will only run when directly triggered by a user.
This workflow runs ESLint and Prettier against the codebase to ensure code quality and consistency. It will run on any pull request that merges into the master
branch.
This workflow will run on any pull request that aims to merge into the master
branch. It will run all the tests found in .spec.ts
files changed by the PR a total of 3 times in a row allowing for 1 retry to ensure the tests are stable. Making the allowance for 1 retry is an effort to reduce the number of false negatives due to transient timeouts.
Some tests require the ability to verify that an email was sent. This is currently done using IMAP and the imap
package. You can read more about it here. The email account for the system administrator user running the tests can be configured in the .env
file.
When it is necessary to verify an email was sent to specific user currently an alias (e.g. system.admin+<some unique identifier>@gmail.com
) is used to send the email to the system administrator user. The system administrator user's email account is configured in the .env
file. The alias is then used to filter the emails in the inbox to find the email sent to the specific user.
Some tests require the ability to verify the contents of a PDF. This is currently done using the PDF.js
package. This library is used to parse the PDF after it has been downloaded.
Some tests require the ability to verify the contents of an Excel file. This is currently done using the node-xlsx
package. This library is used to parse the Excel file after it has been downloaded.