ArchivesSpace End-to-End Test Suite
For more context on the End-to-End test suite and how to contribute tests, see our wiki-page.
Recommended setup
Section titled “Recommended setup”Using a Ruby version manager
Section titled “Using a Ruby version manager”The required Ruby version for the e2e test application is documented in [./.ruby-version](./.ruby-version).
It is strongly recommended to use a Ruby version manager to be able to switch to any version that a given project requires.
We recommend using the rbenv Ruby version manager.
Linux and macOS
Section titled “Linux and macOS”Find the installation guide here: https://github.com/rbenv/rbenv#readme.
Windows
Section titled “Windows”A Windows rbenv installer exists here: https://github.com/RubyMetric/rbenv-for-windows#readme.
Alternatives to rbenv
Section titled “Alternatives to rbenv”If you wish to use a different Ruby manager or installation method, see Ruby’s installation documentation.
Installation
Section titled “Installation”From the ArchivesSpace root directory, navigate to the e2e test application, then install Ruby, Bundler, and the application dependencies:
# 1. Navigate to e2e-tests directorycd e2e-tests
# 2. Install Ruby at the version specified in ./.ruby-versionrbenv install
# 3. Install the Bundler dependency managergem install bundler
# 4. Install project dependenciesbundle installRunning the tests locally
Section titled “Running the tests locally”Just working on the e2e tests with Docker
Section titled “Just working on the e2e tests with Docker”If you are just working on e2e tests and not touching the ArchivesSpace application, you can run e2e tests locally against the latest ArchivesSpace master branch build using Docker.
Install Docker Desktop
Section titled “Install Docker Desktop”Docker Desktop is a one-click-install application for Linux, Mac, and Windows. It provides both terminal and GUI access to Docker. Download and install the appropriate version for your operating system from the link above. You can also use alternative software for running Docker containers, such as OrbStack for macOS.
Run the latest ArchivesSpace Docker image
Section titled “Run the latest ArchivesSpace Docker image”# Get the latest ArchivesSpace `master` branch builddocker compose pull
# Start ArchivesSpace serversdocker compose upVerify the servers are running by opening http://localhost:8080 in a browser.
Working with an ArchivesSpace development environment
Section titled “Working with an ArchivesSpace development environment”You can run the e2e test suite against your local ArchivesSpace development environment. But be aware that your database, Solr index, and any configuration changes will need to be reset.
Reset your database and Solr index
Section titled “Reset your database and Solr index”Make sure your ArchivesSpace instance has a blank database and blank solr index.
Restore default configuration options (except for AppConfig[:db_url])
Section titled “Restore default configuration options (except for AppConfig[:db_url])”Make sure you override any local changes to the default configuration options (via ../common/config/config.rb) by commenting them out or deleting them, except for AppConfig[:db_url] (which is required for using the MySQL database).
Run the frontend dev server
Section titled “Run the frontend dev server”Start the frontend:devserver as described here. Verify it is running by opening http://localhost:3000/ in your browser.
Set the STAFF_URL environment variable
Section titled “Set the STAFF_URL environment variable”Set your STAFF_URL environment variable to point the e2e tests at the local development server:
export STAFF_URL='http://localhost:3000'Running tests
Section titled “Running tests”After setting the appropriate STAFF_URL environment variable as described above, run the desired test(s) according to the following commands.
All test files at once
Section titled “All test files at once”bundle exec cucumber staff_features/All scenarios in a specific file
Section titled “All scenarios in a specific file”bundle exec cucumber staff_features/assessments/assessment_create.featureA specific scenario in a specific file
Section titled “A specific scenario in a specific file”bundle exec cucumber staff_features/assessments/assessment_create.feature --name 'Assessment is created'Debugging
Section titled “Debugging”Add a byebug statement in any .rb file to set a breakpoint and start a debugging session in the console while running. See more here. Don’t forget to remove any byebug statements before a git push…
If you need to see the browser while running the test scenario and debugging, add a HEADLESS='' argument, as in:
bundle exec cucumber HEADLESS='' staff_features/Linters
Section titled “Linters”This test suite uses two linters, cuke_linter and rubocop, to maintain code quality.
# Lints Cucumber .feature filesbundle exec cuke_linter
# Lints Ruby .rb filesbundle exec rubocop