-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c55380d
commit 32fde31
Showing
3 changed files
with
37 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# RDC Test Runner | ||
|
||
A repository of [Playwright](https://playwright.dev/) tests for capturing and running end to end tests for NULib applications | ||
A repository of [Playwright](https://playwright.dev/) 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. | ||
|
||
## Getting Started | ||
|
||
|
@@ -12,13 +12,21 @@ 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 | ||
|
||
# Change into the repository directory | ||
# Navigate into your new folder | ||
cd rdc-test-runner | ||
|
||
# Install dependencies | ||
npm install # if you get errors, try `npm install --legacy-peer-deps` | ||
``` | ||
|
||
#### VSCode | ||
|
||
VSCode is an IDE application that can be used to write and run tests. | ||
|
||
Install [VSCode](https://code.visualstudio.com/download) and the following extensions: | ||
|
||
- [Playwright Test for VSCode](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright) | ||
|
||
### Set up Authenticated User | ||
|
||
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: | ||
|
@@ -32,16 +40,38 @@ Contact a member of the NULib RDC team for the values to use for `AUTH_USER` and | |
|
||
## Run tests | ||
|
||
Tests for Digital Collections are located in the `/tests/dc` directory. To run Digital Collections tests: | ||
Tests can be run locally or in a CI environment. | ||
|
||
### Locally | ||
|
||
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: | ||
|
||
```bash | ||
# Run Digital Collections tests | ||
npx playwright test tests/dc | ||
|
||
# Run All tests | ||
npx playwright test tests | ||
``` | ||
|
||
### CI Environment | ||
|
||
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: | ||
|
||
1. In a browser, open the repo homepage: https://github.com/nulib/rdc-test-runner | ||
2. Click the "Actions" tab | ||
3. Click the "Playwright Tests" workflow (see screenshot below) | ||
|
||
![Github Actions Workflow Button Screenshot](./assets/git-actions-screenshot.png) | ||
|
||
4. Click the "Run workflow" button (see screenshot below) | ||
|
||
![Github Actions Workflow Button Screenshot](./assets/git-actions-screenshot-run.png) | ||
|
||
## Write new tests | ||
|
||
Playwright has a code generation tool that can be used to generate tests for a given URL. To use it, run the following command from the root of the repository (this example is for Digital Collections): | ||
For detailed info and best practices on writing tests, view the Playwright documentation: https://playwright.dev/docs/intro | ||
|
||
```bash | ||
npx playwright codegen dc.library.northwestern.edu | ||
``` | ||
It's recommended to write and edit tests directly within VSCode, using the [Playwright Test for VSCode extension](https://playwright.dev/docs/getting-started-vscode). The extension provides syntax highlighting, code completion, and other features to help write tests. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.