This repository contains Playwright tests for use with Aspen Discovery.
- 📁
/lib: Contains helper files for TypeScript architecture - 📁
/page-objects: Contains repeat actions that can be used across tests, organized by the page on which they occur (e.g., Home, Grouped Works, etc.) - 📁
/sites: Contains site-specific directories- 📁
/example: Example site directory- 📄
config.json: Example site configuration file
- 📄
- 📁
- 📁
/tests: Contains test suites, organized by related user behavior or workflows (e.g., Holds, Lists, etc.) - 📄
.env.example: Example environment variables file - 📄
playwright.config.ts: Playwright configuration file
Note
If you're a testing librarian, you likely DON'T want the Docker version, so scroll down until you see "get a prebuilt Node.js® for..." and use that instead.
Choose the method that sounds the easiest to you.
With GitHub Desktop
- Install GitHub Desktop
- Go to File > Clone repository
- Use
myr-onl/aspen-playwright-testsas the URL - Set your Local Path (this is where the repo will be copied)
- Click Clone
Via command line
- Open a terminal on your computer
- Navigate to the folder where you want to copy this repo
- Run
git clone https://github.com/myr-onl/aspen-playwright-tests.git
- Open the repo in your favorite IDE (e.g., VSCode, IntelliJ, etc.) and open its terminal OR open your computer terminal and navigate inside the repository
- Run
npm install
Important
If you are asked to install browsers with Playwright during install, say yes. If not, enter the command below to manually download them. These are testing browsers and not regular browsers that should appear in your computer applications list.
npx playwright install- Copy the
sites/exampledirectory to a new directory - Name the new directory your intended site name (e.g.
grove.production,aspen.localhost, etc.) - Open your new directory's
config.json - Add your unique variables to the config file
Site configuration variables
catalog: Basic info about your Aspen siteurl: Aspen home page URLils: ILS that is connected to your Aspen (accepted values: `carlx`, `evergreen`, `evolve`, `koha`, `polaris`, `sierra`, or `symphony`)patron: A test patron with hold and checkout privileges in your ILSusername: username or barcodepassword: password or PINinvalidPassword: incorrect password or PINholdItem: A grouped work with a bib record in your ILS that can be placed on holdtitle: Title exactly as it appears within grouped work viewformat: Format label value exactly as it appears within grouped work viewgroupedWorkId: Unique ID for the grouped work (can be found in Staff view or grouped work URL)bibRecordId: Unique ID for the bib record (can be found with full record view URL)volumeHoldItem: A grouped work with a bib record in your ILS that has volume data and can be placed on hold- Same variables as
holdItem
- Copy the
.env.examplefile to a new file called.envinside the root directory - Open
.env - Set your environment variables
Environment variables
SITE_NAME: Active site configuration against which to run testsALLOW_MANUAL_REFRESH: Whether account data (like holds and checkouts) should be manually reloaded when performing testsALLOW_VOLUME_HOLDS: Whether volume holds suite should be run
Open this repository inside your IDE and open its terminal OR open your computer terminal and navigate to be inside of this repository.
Running tests in UI mode gives you the most control over how tests are run and let's you inspect where failures have occurred as a snapshot. To open UI mode in a separate window, use the following command:
npx playwright test --uiRunning tests in headed mode most closely resembles how we ran tests in the Selenium IDE browser extension. To watch your tests in real time using the base playwright.config.ts configuration, run:
npx playwright test --headedTo run your tests in the background, run:
npx playwright testInformation about whether your tests passed or failed will display inside the terminal.
Once tests have finished, you can also view test results by running npx playwright show-report.