Common Setup
- Ensure the Drupal module QA Accounts is in your project (i.e. in composer.json) and is enabled (or change the accounts located in {tests,cypress}/data/qaUsers.json).
- For Playwright, set the
baseURL
in playwright.config.js. For Cypress, set thebaseUrl
in cypress.config.js. - If using DDEV (or other containerization system), adjust
drushCmd
in {playwright,cypress}.atk.config.js. (For example,'ddev drush'
).
Entity Tests Setup
For these tests:
(ATK-XX-1110) Create, update, delete a node via the UI.
(ATK-XX-1120) Create, update, delete a taxonomy term via the UI.
(ATK-XX-1130) Create, update, delete an image via the UI.
Enable Automated Testing Kit so that the included hook can insert the nid, tid and mid into the page HTML.
Contact Us Test Setup
(ATK-XX-1050) Contact Us form accepts input, sends email uses Webform. Once the module is enabled, the default Contact Us form will be immediately available.
- Form editing is located as admin/structure/webform
- By default, the Contact Form is located at <your site>/form/contact
- The settings for the Contact Form are at admin/structure/webform/manage/contact/settings
- The email handling for the Contact Form is located at admin/structure/webform/manage/contact/handlers
- There are two emails that are sent by default, the administrator notification email and the user confirmation email. (ATK-XX-1050) Contact Us uses the etherealUser.json user and checks only for the user confirmation email at Ethereal.email.
Error Page Tests Setup
(ATK-XX-1060) Validate 403 page appears expects:
- create a Basic Page node with the alias /403-error-page with the Body containing the text "ATK 403 Error Page"
- In /admin/config/system/site-information, set Default Default 403 (access denied) page to"/403-error-page"
(ATK-XX-1061) Validate 404 page appears expects:
- create a Basic Page node with the alias /404-error-page with the Body containing the text "ATK 404 Error Page"
- In /admin/config/system/site-information, set Default Default 404 (not found) page to"/404-error-page"
Media Entity Tests
(ATK-XX-1130) Create, update, delete an image via the UI expects:
- Enable the Media module.
Search Tests
(ATK-XX-1160) Search content by a keyword
(ATK-XX-1161) Advanced search.
(ATK-XX-1162) Search by a keyword: empty input
(ATK-XX-1163) Advanced search: empty input
- Enable the Search module. Add some test data. Index the content by running cron at /admin/config/system/cron
- Update {tests,cypress}/data/search.yml to match added test data.
Register/login Tests Setup
By default, in Drupal 11 registration for anonymous users is disabled, to enable it for the registration test, go to /admin/config/people/accounts and under "Who can register accounts?" select "Visitors".
XML Sitemap
(ATK-XX-1070) Return # of sitemap files; fail if zero and (ATK-XX-1071) Regenerate sitemap files expect:
- Enable the XML Sitemap module.
Communicating with Pantheon
Communicating with Pantheon happens using Terminus. Install Terminus using this documentation at Pantheon. Tell ATK that the target site is on Pantheon by pantheon section in {playwright,cypress}.atk.config.js:
isTarget
- truesite
- target site name (not the site URL)env
- the environment (usually "dev," "test" or "live").
With these properly set, the Drush commands will be piped to your Pantheon site via the Terminus command.
pantheon : {
isTarget: true,
site: "<site_name>",
environment: "dev"
}
Communicating to Remote Servers with Drush
Set up aliases this Drush . In {playwright,cypress}.atk.config.js file (located in the project root after running atk_setup
), change the line below from:
drushCmd: "drush"
to
drushCmd: "drush @alias"
This will pipe the drush commands to the remote server. If the destination is Pantheon, use the instructions above instead.
Communicating to Remote Servers with SSH
To avoid Drush dependency on the test executor, ATK can be configured to execute remote Drush commands directly via SSH connection, to configure this, in {playwright,cypress}.atk.config.js file update targetSite
section like below:
targetSite: {
isTarget: true,
root: null, // optional
remoteHost: 'my.remote.sever',
remoteUser: 'myremoteuser', // optional
sshOptions: '-p 32809 -o SetEnv=IS_DDEV_PROJECT=true', // optional
},