A repository of Playwright tests for running and writing end to end tests. This repository tests can be organized into folders representing NULib applications. The tests can be run locally or in a CI environment.
Run the following from a terminal window on your machine
# Clone the repository (only need to do this once)
git clone [email protected]:nulib/rdc-test-runner.git
# Navigate into your new folder
cd rdc-test-runner
# Install dependencies
npm install # if you get errors, try `npm install --legacy-peer-deps`
VSCode is an IDE application that can be used to write and run tests.
Install VSCode and the following extensions:
We'll set up a user that can log in to the application. This user will be used to run tests that require authentication. Create a new file in the root of the repository called .env
and add the following lines to it:
AUTH_USER=[VALUE_GOES_HERE]
AUTH_PASSWORD=[VALUE_GOES_HERE]
Contact a member of the NULib RDC team for the values to use for AUTH_USER
and AUTH_PASSWORD
.
Tests can be run locally or in a CI environment.
Test scripts/files for Digital Collections are located in the /tests/dc
directory. For example, to run Digital Collections tests locally, use the following command:
# Run Digital Collections tests
npx playwright test tests/dc
# Run All tests
npx playwright test tests
Tests are configured to run in a CI environment using GitHub Actions. The configuration for the tests is located in the .github/workflows
directory. The configuration is set up to run tests on a schedule (coming soon) and when a pull request is created or updated.
To manually run tests in the CI Environment:
- In a browser, open the repo homepage: https://github.com/nulib/rdc-test-runner
- Click the "Actions" tab
- Click the "Playwright Tests" workflow (see screenshot below)
- Click the "Run workflow" button (see screenshot below)
For detailed info and best practices on writing tests, view the Playwright documentation: https://playwright.dev/docs/intro
It's recommended to write and edit tests directly within VSCode, using the Playwright Test for VSCode extension. The extension provides syntax highlighting, code completion, and other features to help write tests.