This directory contains Selenium IDE tests for Aspen Discovery.
- 📁
sites/- Contains site-specific configuration files and processed test files- 📁
example/- Example site directory (included in git)- 📁
conf/- Example configuration files for the example site- 📄
example-test-config.json- Example configuration file
- 📄
- 📁
- 📁
[site-name]/- Site-specific directories (not included in git)- 📁
conf/- Site-specific configuration files- 📄
[site-name]-test-config.json- Site-specific configuration file
- 📄
- 📁
- 📁
- Make sure you have Node.js installed on your system. (Download from nodejs.org).
- If you're a testing librarian, you probably do NOT want the Docker version, so scroll down until you see "get a prebuilt Node.js® for..." and use that instead.
- Make sure you have a browser with the Selenium IDE extension installed. The two browsers that currently work with the Selenium IDE Add-on are Edge and Firefox.
- Create a site-specific directory at
sites/[site-name]with your site name ( e.g., "nashville.production"). - Create a
confdirectory within your [site-name] directory. - Copy the example site's conf file
sites/example/conf/example-test-config.jsoninto your [site-name]confdirectory. - Change the new conf file to
[site-name]-test-config.json(e.g., "nashville-test-config.json"). - Edit the configuration file to set the values for your site. See the "Configuration File" section below for details.
siteName- A unique name for your site (e.g., "nashville.production")url- The URL of your Aspen Discovery instancepatron- Test patron with hold and borrow privilegesusername- Patron usernamepassword- Patron passwordinvalidPassword- Invalid password for the patron
holdBook- A grouped work with a book with a bibliographic record in your ILS that can be placed on holdtitle- Title of the book to hold, exactly as it appears in Aspen DiscoverygroupedWorkId- The ID of the grouped work in Aspen DiscoverybibRecordId- The ID of the bibliographic record in your ILS
volumeHold- A grouped work with a bibliographic record in your ILS that has volume data and can be placed on holdtitle- Title of the item to hold exactly as it appears in Aspen DiscoverygroupedWorkId- The ID of the grouped work in Aspen DiscoverybibRecordId- The ID of the bibliographic record in your ILS
Before running the tests in Selenium IDE, you need to prepare the test file by replacing variables with values from your configuration:
Simply double-click the prepare-selenium-tests.bat file in Windows File Explorer.
Open this repo in your terminal, either from inside your IDE or by opening the terminal and running cd /path/to/git/repo.
The script should be executable by default, so just run the script:
./prepare-selenium-tests.shIf you get an error attempting to run it, make sure the script is executable and then run it:
chmod +x prepare-selenium-tests.sh
./prepare-selenium-tests.shnode prepare-selenium-tests.jsAny of these methods will:
- Find all site configuration files in
sites/[siteName]/conf/[siteName]-test-config.json - Create site-specific directories based on the site names if they don't exist
- Process the test file for each site by replacing variables with values from the configurations
- Save the processed files to
sites/[siteName]/
- Install the Selenium IDE extension in your web browser.
- Open Selenium IDE from your browser extension menu.
- Click "Open an existing project".
- Navigate to and select the processed file from your site directory:
sites/[siteName]/aspen-suite.[siteName].side.
Important: Always open the processed file in your site directory, not the original file in the test-templates directory. The original file contains variables that need to be replaced before running the tests.
Note: Each site has its own directory under sites/ where processed test files are stored. This ensures that site-specific test files don't accidentally get committed to the shared repository. Only the example site directory is included in git.
If you see an error like this when trying to open the file in Selenium IDE:
200: filename content-length last-modified file-type
201: META-INF/ 0 Tue,%2001%20Jan%201980%2006:00:00%20GMT DIRECTORY
201: assets/ 0 Tue,%2001%20Jan%201980%2006:00:00%20GMT DIRECTORY
...
It means you're trying to open the original file with variables instead of the processed file. Make sure to run node prepare-selenium-tests.js first and then open the processed file.
// TO DO: Add instructions for updating tests
To add a new site:
- Create a new directory in
sites/with your site name:mkdir sites/[site-name]
- Create a configuration directory within your site directory:
mkdir sites/[site-name]/conf
- Create a configuration file named
[site-name]-test-config.jsonin the newconf/directory:cp sites/example/conf/example-test-config.json sites/[site-name]/conf/[site-name]-test-config.json
- Edit the configuration file to set your site-specific values.
- Follow the steps in the "Running the Tests" section to prepare and run the tests for your new site.