Merge pull request #29735 from woocommerce/e2e/e2e-merchant-initiate-wccom

Added new e2e test to initiate WCCOM connection
This commit is contained in:
Ron Rennick 2021-05-05 10:35:01 -03:00 committed by GitHub
commit 0d59195657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 66 additions and 0 deletions

View File

@ -45,6 +45,7 @@ const runMerchantOrderEmailsTest = require( './merchant/wp-admin-order-emails.te
const runOrderSearchingTest = require( './merchant/wp-admin-order-searching.test' );
const runAnalyticsPageLoadsTest = require( './merchant/wp-admin-analytics-page-loads.test' );
const runImportProductsTest = require( './merchant/wp-admin-product-import-csv.test' );
const runInitiateWccomConnectionTest = require( './merchant/wp-admin-extensions-connect-wccom.test' );
// REST API tests
const runExternalProductAPITest = require( './api/external-product.test' );
@ -97,6 +98,7 @@ const runMerchantTests = () => {
runProductSearchTest();
runMerchantOrdersCustomerPaymentPage();
runAnalyticsPageLoadsTest();
runInitiateWccomConnectionTest();
}
const runApiTests = () => {
@ -154,4 +156,5 @@ module.exports = {
runCartRedirectionTest,
runMyAccountCreateAccountTest,
runOrderEmailReceivingTest,
runInitiateWccomConnectionTest,
};

View File

@ -0,0 +1,47 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests */
/**
* Internal dependencies
*/
const {
merchant,
} = require( '@woocommerce/e2e-utils' );
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const runInitiateWccomConnectionTest = () => {
describe('Merchant > Initiate WCCOM Connection', () => {
beforeAll(async () => {
await merchant.login();
});
it('can initiate WCCOM connection', async () => {
await merchant.openExtensions();
// Click on a tab to choose WooCommerce Subscriptions extension
await Promise.all([
expect(page).toClick('a.nav-tab', {text: "WooCommerce.com Subscriptions"}),
page.waitForNavigation({waitUntil: 'networkidle0'}),
]);
// Click on Connect button to initiate a WCCOM connection
await Promise.all([
expect(page).toClick('.button-helper-connect'),
page.waitForNavigation({waitUntil: 'networkidle0'}),
]);
// Verify that you see a login page for connecting WCCOM account
await expect(page).toMatchElement('div.login');
await expect(page).toMatchElement('input#usernameOrEmail');
await expect(page).toMatchElement('button.button', {text: "Continue"});
});
});
}
module.exports = runInitiateWccomConnectionTest;

View File

@ -0,0 +1,6 @@
/*
* Internal dependencies
*/
const { runInitiateWccomConnectionTest } = require( '@woocommerce/e2e-core-tests' );
runInitiateWccomConnectionTest();

View File

@ -62,6 +62,7 @@ This package provides support for enabling retries in tests:
- `WP_ADMIN_ANALYTICS_PAGES` - WooCommerce analytics page root
- `WP_ADMIN_WC_SETTINGS` - WooCommerce settings page root
- `WP_ADMIN_NEW_SHIPPING_ZONE` - WooCommerce new shipping zone
- `WP_ADMIN_WC_EXTENSIONS` - WooCommerce extensions page
#### Front end
@ -100,6 +101,7 @@ This package provides support for enabling retries in tests:
| `openAnalyticsPage` | | Open any Analytics page |
| `openAllUsersView` | | Open the All Users page |
| `openImportProducts` | | Open the Import Products page |
| `openExtensions` | | Go to WooCommerce -> Extensions |
### Shopper `shopper`

View File

@ -36,6 +36,7 @@ export const WP_ADMIN_SETUP_WIZARD = WP_ADMIN_WC_HOME + '&path=%2Fsetup-wizard';
export const WP_ADMIN_ANALYTICS_PAGES = WP_ADMIN_WC_HOME + '&path=%2Fanalytics%2F';
export const WP_ADMIN_WC_SETTINGS = WP_ADMIN_PLUGIN_PAGE + 'wc-settings&tab=';
export const WP_ADMIN_NEW_SHIPPING_ZONE = WP_ADMIN_WC_SETTINGS + 'shipping&zone_id=new';
export const WP_ADMIN_WC_EXTENSIONS = WP_ADMIN_PLUGIN_PAGE + 'wc-addons';
/**
* Shop pages.
* @type {string}

View File

@ -20,6 +20,7 @@ const {
WP_ADMIN_SETUP_WIZARD,
WP_ADMIN_WC_HOME,
WP_ADMIN_WC_SETTINGS,
WP_ADMIN_WC_EXTENSIONS,
WP_ADMIN_NEW_SHIPPING_ZONE,
WP_ADMIN_ANALYTICS_PAGES,
WP_ADMIN_ALL_USERS_VIEW,
@ -121,6 +122,12 @@ const merchant = {
} );
},
openExtensions: async () => {
await page.goto( WP_ADMIN_WC_EXTENSIONS, {
waitUntil: 'networkidle0',
} );
},
runSetupWizard: async () => {
const setupWizard = IS_RETEST_MODE ? WP_ADMIN_SETUP_WIZARD : WP_ADMIN_WC_HOME;
await page.goto( setupWizard, {