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

tests: e2e fixes #2467

Merged
merged 1 commit into from
Aug 12, 2021
Merged

tests: e2e fixes #2467

merged 1 commit into from
Aug 12, 2021

Conversation

frosso
Copy link
Contributor

@frosso frosso commented Aug 4, 2021

Description

Fixing the e2e tests.

The main issue here was that the @woocommerce/e2e-environment was outdated.
It took me a while to figure it out with my local, because my local was not configured correctly.

In the end, it can be summarized with this statement:

NOTE: Since March 2021, WordPress images use a customized wp-config.php that pulls the values directly from the environment variables defined above (see wp-config-docker.php in docker-library/wordpress#572 and docker-library/wordpress#577). As a result of reading environment variables directly, the cli container also needs the same set of environment variables to properly evaluate wp-config.php.
(source: https://hub.docker.com/_/wordpress )

And this PR: woocommerce/woocommerce#29346

With this fix, the e2e started (properly) failing.
It turns out, some of the selector names changed because we migrated away from Calypso. So I fixed those too.

Related issue(s)

Trying to fix #2454

Steps to reproduce & screenshots/GIFs

  • Run the e2e tests with npm run test:e2e-dev (or just notice that they're now passing in the GH actions below 👇 )
  • Done

Checklist

  • unit tests
  • changelog.txt entry added

@frosso frosso self-assigned this Aug 4, 2021
@frosso frosso requested a review from waclawjacek August 4, 2021 18:28
@frosso frosso mentioned this pull request Aug 4, 2021
@@ -18,8 +18,8 @@ jobs:
node-version: '10.16.0'
- run: npm ci
- run: npm install jest --global
- run: npm run dist
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this down, after test:e2e-docker-up, because the test:e2e-docker-up might take a while. While that's completing, we can build the package in the meantime.
This should save us some time on the duration of the workflow, as well as reduce errors while calling test:e2e-docker-ping

await StoreOwnerFlow.openExistingOrderPage( order.id );

await clickReactButton( '.ellipsis-menu > .button' );
await clickReactButton( 'div > .popover > .popover__inner > .popover__menu > .popover__menu-item:nth-child(3)' );
await clickReactButton( '.ReactModalPortal > .ReactModal__Overlay > .ReactModal__Content > .dialog__action-buttons > .button:nth-child(2)' );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm puzzled by the old behavior - the newLabelButton is not present to create a shipping label; and the purchase flow does not present a "purchase" button, but it requires the whole address verification and package purchase.
So I'm deleting this, we're just verifying that the refund process works.


const verifyAndPublish = async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used anywhere

/**
* Create simple product.
*/
const createSimpleProduct = async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used anywhere

/**
* Login and confirm that extension is activated on the site.
*/
const loginAndConfirmExtensionActivation = async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used anywhere

@@ -1,21 +1,40 @@
#!/bin/bash
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A space should not be valid here, I don't think

@@ -1,9 +0,0 @@
#!/usr/bin/env bash
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not needed - it's residual from when we used Travis CI

@@ -1,10 +1,8 @@
const { useE2EJestPuppeteerConfig } = require( '@woocommerce/e2e-environment' );

const puppeteerConfig = useE2EJestPuppeteerConfig( {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just inlined this, no need to have another const

define( 'WOOCOMMERCE_SERVICES_LOCAL_TEST_MODE', true );
define( 'WOOCOMMERCE_CONNECT_FREQUENT_FETCH', true );
define( 'WOOCOMMERCE_CONNECT_SERVER_URL', 'http://host.docker.internal:5000/' );
define( 'WOOCOMMERCE_SERVICES_CI_TEST_MODE', true );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed when WOOCOMMERCE_SERVICES_LOCAL_TEST_MODE and JETPACK_DEV_DEBUG are already specified:

if ( false !== getenv( 'WOOCOMMERCE_SERVICES_CI_TEST_MODE' ) ) {
if ( ! defined( 'WOOCOMMERCE_SERVICES_LOCAL_TEST_MODE' ) ) {
define( 'WOOCOMMERCE_SERVICES_LOCAL_TEST_MODE', true );
}
if ( ! defined( 'JETPACK_DEV_DEBUG' ) ) {
define( 'JETPACK_DEV_DEBUG', true );
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this PR, these are also now set in tests/bin/install.sh

@frosso frosso removed the request for review from waclawjacek August 11, 2021 22:05
@frosso
Copy link
Contributor Author

frosso commented Aug 11, 2021

Adding next PR reviewer on rotation

@frosso frosso requested a review from harriswong August 11, 2021 22:05
@harriswong
Copy link
Contributor

👀

Copy link
Contributor

@harriswong harriswong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E2E tests passes. LGTM 👍

@frosso frosso merged commit fab6f55 into trunk Aug 12, 2021
@frosso frosso deleted the fix/e2e-tests branch August 12, 2021 19:39
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.

Fix E2E tests
2 participants