-
Notifications
You must be signed in to change notification settings - Fork 21
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
Feature/e2e testing #47
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome thanks @ecgan
Managed to get it to work 💪 Cool watching the browser load up and the login test run etc.
On this branch I couldn't get npm install to work unless I switched to Node 12 (using nvm) - using 13 or 14 was trying to compile a bunch of things from source because it couldn't download them
What version of node are you using?
Can we move e2e-tests/
to be within the main tests/
dir? or similar?
I haven't dug in, but are there general WooCommerce installation setup/configuration steps we possibly want to make sure happen as a baseline? I'm guessing at the moment we're largely just getting a vanilla WP installation without Woo actually being ready to go.
Some examples
- https://github.com/woocommerce/automatewoo/pull/704/files#diff-cca819080a0b0cc30c20fc82fa00acfd39b502739d64abdd0fc08e782261fc34
- https://github.com/woocommerce/woocommerce-admin/blob/main/tests/e2e/docker/initialize.sh
- Blocks might do it a bit differently https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/bin/docker/wp-cli/entrypoint.sh
.wp-env.json
Outdated
{ | ||
"core": null, | ||
"plugins": [ | ||
"https://downloads.wordpress.org/plugin/woocommerce.4.6.1.zip", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nice to not tie this to a specific version - perhaps do something similar to https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/.wp-env.json#L3 ?
We might need the basic auth plugin for e2e-utils to work as well https://github.com/woocommerce/automatewoo/pull/704/files#diff-cca819080a0b0cc30c20fc82fa00acfd39b502739d64abdd0fc08e782261fc34R27 - i've see it used in a few of the repos I've been linking to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jconroy ,
Might be nice to not tie this to a specific version - perhaps do something similar to https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/.wp-env.json#L3 ?
Thanks, I'll change it to https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip
, didn't know about that 😄
We might need the basic auth plugin for e2e-utils to work as well https://github.com/woocommerce/automatewoo/pull/704/files#diff-cca819080a0b0cc30c20fc82fa00acfd39b502739d64abdd0fc08e782261fc34R27 - i've see it used in a few of the repos I've been linking to
I was trying to use the @woocommerce/e2e-utils
too but apparently the npm package has a problem and doesn't work. I will create an issue in their repo.
Pretty sure I was seeing something related to |
@jconroy ,
I was using node 10.23.0 which is similar to WooCommerce.
Sure, will do that.
It's actually vanilla WP + WooCommerce installed and activated. I can look into pumping sample data into WooCommerce when we work with more tests later. |
Ok cool, makes sense - I couldn't see anywhere that has a recommendation. I think the wp-env package itself says latest LTS. |
Gotcha, how do we go about setting store configuration? (for things like store location, currency, taxes, shipping etc.) Just curious because I've seen a few different approaches I think this ok to merge as-is (it works) and we can iterate |
@jconroy ,
I'll put in an .nvmrc file when there is no more issue with wp-env and node LTS, I'm tracking it under #50.
I'm thinking maybe we can follow this: https://github.com/woocommerce/automatewoo/pull/704/files#diff-cca819080a0b0cc30c20fc82fa00acfd39b502739d64abdd0fc08e782261fc34. |
Awesome great idea 🙇
Cool yeah I like that. Yeah lets just get a baseline in with this initial setup - we can change the config as we need to later |
Thanks @ecgan nice work. Let's merge and keep iterating 💪 |
Changes proposed in this Pull Request:
Closes #42 - Add e2e testing, using @wordpress/env.
Detailed test instructions:
You can follow the steps as mentioned in the readme.md file, or the following:
composer install
,npm install
andnpm build
.npm run wp-env start
to auto download and start WordPress Docker container. It will also auto download and install WooCommerce plugin, and attach current working directory as a plugin (as seen in.wp-env.json
file).npm run test-e2e:watch -- --puppeteer-interactive
. E2E testing will run in a visible browser UI and then close when it is done.