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

Feature/e2e testing #47

Merged
merged 11 commits into from
Nov 10, 2020
Merged

Feature/e2e testing #47

merged 11 commits into from
Nov 10, 2020

Conversation

ecgan
Copy link
Member

@ecgan ecgan commented Nov 4, 2020

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:

  1. Make sure you have Docker running in your machine.
  2. Make sure you already run composer install, npm install and npm build.
  3. 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).
  4. npm run test-e2e:watch -- --puppeteer-interactive. E2E testing will run in a visible browser UI and then close when it is done.
  5. Verify that you see test passed in your console.

@ecgan ecgan requested a review from jconroy November 4, 2020 18:23
@ecgan ecgan changed the title Feature/e2e testing DRAFT: Feature/e2e testing Nov 4, 2020
@ecgan ecgan removed the request for review from jconroy November 4, 2020 18:26
@ecgan ecgan requested a review from jconroy November 5, 2020 17:31
@ecgan ecgan changed the title DRAFT: Feature/e2e testing Feature/e2e testing Nov 5, 2020
Copy link
Member

@jconroy jconroy left a 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

.wp-env.json Outdated
{
"core": null,
"plugins": [
"https://downloads.wordpress.org/plugin/woocommerce.4.6.1.zip",
Copy link
Member

@jconroy jconroy Nov 5, 2020

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

Copy link
Member Author

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.

@jconroy
Copy link
Member

jconroy commented Nov 6, 2020

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

Pretty sure I was seeing something related to

WordPress/gutenberg#26660

@ecgan
Copy link
Member Author

ecgan commented Nov 6, 2020

@jconroy ,

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?

I was using node 10.23.0 which is similar to WooCommerce.

Can we move e2e-tests/ to be within the main tests/ dir? or similar?

Sure, will do that.

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.

It's actually vanilla WP + WooCommerce installed and activated.

Screenshot on 2020-11-06 at 16-36-53

I can look into pumping sample data into WooCommerce when we work with more tests later.

@jconroy
Copy link
Member

jconroy commented Nov 6, 2020

I was using node 10.23.0 which is similar to WooCommerce.

Ok cool, makes sense - I couldn't see anywhere that has a recommendation. I think the wp-env package itself says latest LTS.

@jconroy
Copy link
Member

jconroy commented Nov 6, 2020

It's actually vanilla WP + WooCommerce installed and activated.

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

@ecgan
Copy link
Member Author

ecgan commented Nov 6, 2020

@jconroy ,

Ok cool, makes sense - I couldn't see anywhere that has a recommendation. I think the wp-env package itself says latest LTS.

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.

Gotcha, how do we go about setting store configuration? (for things like store location, currency, taxes, shipping etc.)

I'm thinking maybe we can follow this: https://github.com/woocommerce/automatewoo/pull/704/files#diff-cca819080a0b0cc30c20fc82fa00acfd39b502739d64abdd0fc08e782261fc34.
Should I do this now, in this PR?

@jconroy
Copy link
Member

jconroy commented Nov 6, 2020

I'll put in an .nvmrc file

Awesome great idea 🙇

I'm thinking maybe we can follow this....Should I do this now, in this PR?

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

@jconroy
Copy link
Member

jconroy commented Nov 10, 2020

Thanks @ecgan nice work. Let's merge and keep iterating 💪

@jconroy jconroy merged commit 82d93e9 into trunk Nov 10, 2020
@jconroy jconroy deleted the feature/e2e-testing branch November 10, 2020 08:48
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.

Add/Implement e2e tests
2 participants