Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Playwright E2E tests #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BrianHenryIE
Copy link

@BrianHenryIE BrianHenryIE commented Sep 19, 2023

This PR makes no changes to the plugin itself.

It adds the wp-env Docker environment which provides two sites, at http://localhost:8888 is a development site, configured so changes made to the plugin are immediately reflected, and at http://localhost:8889 a test site, which when the environment is started, a zip of the plugin is built and installed.

There are two very simple tests included. The .env.secret.dist file needs to be copied to .env.secret and a valid wallet address and viewkey configured.

npx wp-env start
npx playwright test

More commands are documented in the tests/e2e-pw/README.md file.

Playwright (developed by Microsoft) is the end-to-end test framework chosen by WordPress and WooCommerce.

Playwright and wp-env are installed via NPM

npm install

Additionally, the WooCommerce plugin is installed twice, and two copies of WordPress are installed, via Composer

composer install

One copy of WooCommerce is used during the tests, i.e. the distribution build of WooCommerce, and the full woocommerce/woocommerce GitHub repo is installed for access to documentation and code samples. One copy of WordPress is installed for use with Xdebug and the second install is the full WordPress/wordpress-develop repository.

wp-cli/dist-archive-command is installed via Composer to build the plugin zip file. It uses the .distignore file to control what is included in the archive.

The intention is to add more test to truly verify end to end operation of the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant