Install Automated Testing Kit and Its Dependencies
Install only the dependencies needed by the tests you want to run.
Drush: (required) Drush is required for many utility functions in Automated Testing Kit.
SMTP mailer Include this to send emails as part of your tests (use another mailer if you wish).
XML Sitemap: Include this to test the sitemaps generated by XML Sitemap.
Open the composer.json file in the project root directory and add the following to the list of required modules:
"drupal/automated_testing_kit_d7": "^1.0", "drupal/smtp": "^1.9", "drupal/xmlsitemap": "^2.7", "drush/drush": "^8"
Then update with:
rm composer.lock composer update
Or, from the command line use composer require
for each module above that you'll need according to the tests you want to run:
composer require drupal/automated_testing_kit_d7
Visit https://www.drupal.org/node/1897420 for further information.
Install Playwright
When installing Playwright for development, install it in the native OS. If you install it in a container, the GUI won't be available to you.
Instructions to install Playwright are here. If npm is installed, the following will work:
cd <project_root> npm init playwright@latest
These instructions and accompanying configuration files assume that you are installing in the same directory as the project.
If you choose to use Docker, use containers maintained by Microsoft (who makes Playwright).
Playwright
When installing Playwright, choose Javascript for this prompt:
✔ Do you want to use TypeScript or JavaScript?
This will give you the a config.js file rather than a config.ts configuration file.
Enable Automated Testing Kit in Drupal
Using the Drupal GUI
Go to admin/modules
, set the checkbox for Automated Testing Kit, SMTP and Symfony XML Sitemap then click the Install button.
The configuration screens are located in the UI at admin/automated_testing_kit_d7/configuration
.
Using Drush
Install Automated Testing Kit D7 (above) then run the following to enable the modules:
drush -y en automated_testing_kit_d7 smtp xmlsitemap
Uninstallation
Uninstall the module through the UI at admin/modules/uninstall
. Currently, Automated Testing Kit D7 does not add tables or configuration.
Or use Drush:
drush -y pm:uninstall automated_testing_kit_d7 smtp xmlsitemap
Run atk_setup
With atk_setup,
set the argument to playwright. atk_setup copies the tests, configuration files and support files to the default locations for the framework. If you want to link the files instead of copying them, add "link" to the command. However, be aware that debugging in your IDE may not work with linking. If you are using non-default locations, edit the setup script first.
cd <project root> web/sites/all/modules/contrib/automated_testing_kit_d7/module_support/atk_setup playwright [link]
You will see something like this:
== Setting up for Playwright. ==
Copying playwright.atk.config.js to <project_root>/playwright.atk.config.js.
Copying or linking tests to <project_root>/playwright/tests.
Copying or linking data files to <project_root>/playwright.
Copying or linking test framework support files to <project_root>/playwright.
Playwright
atk_setup playwright will copy or link the files to:
- configuration files --> <project_root>
- tests --> <project_root>/tests
- data files --> <project_root>/tests/data
- support files --> <project_root>/tests/support
- This includes atk_commands.js, which holds many of the common functions related to Playwright, and atk_utilities.js, which holds general utility functions. An example is a random string generator.
Upgrading Automated Testing Kit D7
The goal is to make new releases within the same major version number backwards compatible.
Install Dependencies for Playwright
Install the following packages:
npm install dotenv fast-xml-parser axios