university-of-denver / quicksilver-qa-prep
Prepare a Pantheon environment for automated QA tests by enabling the testing module and granting login roles
Package info
github.com/DU-University-Relations/quicksilver-qa-prep
Type:quicksilver-script
pkg:composer/university-of-denver/quicksilver-qa-prep
Requires
- composer/installers: ~1.0
This package is auto-updated.
Last update: 2026-05-04 20:44:31 UTC
README
This Quicksilver script automates the preparation of a Pantheon environment for running automated QA tests. It replaces two manual steps that were previously run after every database clone:
- Enable the
du_functional_testingmodule – equivalent to:terminus drush "$SITE.$ENV" -- en du_functional_testing -y - Grant the
legacy_test_and_training_accountsrole to everyqa_*test user – thedu_functional_testingmodule creates one test user per non-built-in Drupal role (e.g.qa_administrator,qa_editor, …). Thelegacy_test_and_training_accountsrole allows those accounts to bypass SSO/SAML during automated testing.
The script is triggered automatically by the Pantheon env:clone workflow
(database clone), so no manual intervention is required after a sync.
Environment restriction: The script only executes on the dev and test Pantheon environments. If it runs on any other environment (e.g. live), it exits immediately without making changes.
Note: The
du_functional_testinginstall hook is known to sometimes return a non-zero exit code. The script logs any such error and continues regardless, because theqa_*test users are still created even when the hook exits with an error.
This project was developed from a template for new Quicksilver projects to utilize so that Quicksilver scripts can be installed through Composer.
Original template: https://github.com/pantheon-quicksilver/quicksilver-template
Requirements
- PHP 8.0 or higher
- Composer
- Drupal 9+ site running on Pantheon with the
du_functional_testingmodule available in the codebase - The
legacy_test_and_training_accountsrole must exist on the site
Installation
This project is designed to be included from a site's composer.json file, and
placed in its appropriate installation directory by
Composer Installers.
In order for this to work, you should have the following in your composer.json
file:
{
"require": {
"composer/installers": "^1"
},
"extra": {
"installer-paths": {
"web/private/scripts/quicksilver/{$name}/": ["type:quicksilver-script"]
}
}
}
Then, install this package via Composer:
composer require university-of-denver/quicksilver-qa-prep:^1
Add to pantheon.yml
Add the following to your pantheon.yml file to run the Quicksilver script
whenever a database clone occurs (e.g. syncing Live → Test or Test → Dev):
api_version: 1 workflows: clone_database: after: - type: webphp description: Prepare environment for QA tests script: private/scripts/quicksilver/quicksilver-qa-prep/qa-prep.php
What the script does
- Runs
drush en du_functional_testing -yto enable the functional testing module, which createsqa_*test user accounts (one per non-built-in role). Any errors from the install hook are logged but do not stop execution. - Runs
drush role:list --format=jsonto retrieve all role machine names (excluding the built-inanonymousandauthenticatedroles). - For each role, derives the corresponding
qa_username (e.g.administrator→qa_administrator) and runsdrush user:role:add legacy_test_and_training_accounts <username>.
If a qa_* user does not exist on the cloned environment the script emits a
warning and continues rather than failing the workflow.
No Pantheon secrets are required.