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

WIP: Setup E2E testing using @woocommerce/e2e-environment #786

Open
wants to merge 19 commits into
base: trunk
Choose a base branch
from

Conversation

mattallan
Copy link
Contributor

@mattallan mattallan commented Jul 6, 2020

This PR will act as a WIP for setting up the e2e tests and writing our first couple of e2e tests.

Changes proposed in this PR

  • Sets up e2e test environment using the @woocommerce/e2e-environment package
  • Adds a readme with testing instructions and running the tests locally
  • Adds our first example E2E test which just loads the checkout page 🎉

Other things to note:

  • While WooCommerce is still working on a @woocommerce/e2e-util package, I have copied the util files from core into our own utils folder, see f7a3473.
  • The default docker init script was just installing and activating WooCommerce and the 2019 theme, so to help with testing, I have modified this script to be similar some of what is done in WC Payments. See 8cb68a4.

How to run the e2e tests?

Check out the README added in this PR which has more detailed instructions.

  1. Install docker and make sure it's running
  2. npm install
  3. npm run docker:up
    1. This command is booting up the test environment, which includes installing and setting up WooCommerce and importing some dummy/test products. This happens in the background so it can take a while to finish even though the docker:up command has completed.
    2. To check that the site is ready for testing and set up properly, go to http://localhost:8084/shop/ and confirm the shop loads with the storefront theme and there are products in your store. It should look like this.
  4. Run the example test: npm run test:e2e

  1. To watch the tests running in a chrome window you can use npm run test:e2e-dev
  2. npm run docker:down when finished testing

TODOs
At the moment this PR is for running the e2e tests locally

  • Travis CI integration/setup

@mattallan mattallan force-pushed the e2e-init branch 5 times, most recently from a5ea52e to 23589ee Compare July 8, 2020 04:29
@mattallan
Copy link
Contributor Author

At the start of every test I've currently got it importing calling await importSampleProducts() to make sure our shop page is populated but I'd like to find a better way of doing this.

I originally had the importing of sample products using wp CLI which I changed in 23589ee because Travis was running the e2e tests before the initialize.sh had time to finish importing the products so the tests would fail.

I think we'll need to look at how other extensions handle setting up the test environment using WPI CLI

@chickenn00dle chickenn00dle changed the base branch from master to main August 17, 2020 07:33
@chickenn00dle chickenn00dle changed the base branch from main to trunk August 26, 2020 05:06
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