Skip to content

Commit

Permalink
Merge pull request #2081 from woocommerce/dev/2070-connecting-merchan…
Browse files Browse the repository at this point in the history
…t-account-e2e-test

E2E tests: Onboarding Step 1 - Set up accounts - Connect Merchant Center account
  • Loading branch information
ianlin authored Sep 6, 2023
2 parents 48ac6ce + d5ef12d commit 338300f
Show file tree
Hide file tree
Showing 9 changed files with 1,215 additions and 115 deletions.
14 changes: 11 additions & 3 deletions tests/e2e/global-setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
const { chromium, expect } = require( '@playwright/test' );
/**
* Internal dependencies
*/
const { admin } = require( './config/default.json' ).users;
const { LOAD_STATE } = require( './utils/constants' );

/**
* External dependencies
*/
const { chromium, expect } = require( '@playwright/test' );
const fs = require( 'fs' );

/* eslint-disable no-console */
Expand Down Expand Up @@ -48,9 +56,9 @@ module.exports = async ( config ) => {
.locator( 'input[name="pwd"]' )
.fill( admin.password );
await adminPage.locator( 'text=Log In' ).click();
await adminPage.waitForLoadState( 'networkidle' );
await adminPage.waitForLoadState( LOAD_STATE.NETWORK_IDLE );
await adminPage.goto( `/wp-admin` );
await adminPage.waitForLoadState( 'domcontentloaded' );
await adminPage.waitForLoadState( LOAD_STATE.DOM_CONTENT_LOADED );

await expect( adminPage.locator( 'div.wrap > h1' ) ).toHaveText(
'Dashboard'
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/specs/dashboard/edit-free-listings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
* External dependencies
*/
import { expect, test } from '@playwright/test';

/**
* Internal dependencies
*/
import { clearOnboardedMerchant, setOnboardedMerchant } from '../../utils/api';
import { LOAD_STATE } from '../../utils/constants';
import { checkSnackBarMessage } from '../../utils/page';
import DashboardPage from '../../utils/pages/dashboard.js';
import EditFreeListingsPage from '../../utils/pages/edit-free-listings.js';
Expand Down Expand Up @@ -55,7 +57,7 @@ test.describe( 'Edit Free Listings', () => {
test( 'Edit Free Listings should show modal', async () => {
await dashboardPage.clickEditFreeListings();

await page.waitForLoadState( 'domcontentloaded' );
await page.waitForLoadState( LOAD_STATE.DOM_CONTENT_LOADED );

const continueToEditButton =
await dashboardPage.getContinueToEditButton();
Expand All @@ -66,7 +68,7 @@ test.describe( 'Edit Free Listings', () => {

test( 'Continue to edit Free listings', async () => {
await dashboardPage.clickContinueToEditButton();
await page.waitForLoadState( 'domcontentloaded' );
await page.waitForLoadState( LOAD_STATE.DOM_CONTENT_LOADED );
} );

test( 'Check recommended shipping settings', async () => {
Expand Down
9 changes: 7 additions & 2 deletions tests/e2e/specs/get-started.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Internal dependencies
*/
import { LOAD_STATE } from '../utils/constants';

/**
* External dependencies
*/
Expand All @@ -22,13 +27,13 @@ test( 'Merchant who is getting started clicks on the Marketing > GLA link, click
// the submenu is now opened, the GLA sub menu item is now visible to the user,
// we can call `click` now.
await page.getByRole( 'link', { name: 'Google Listings & Ads' } ).click();
await page.waitForLoadState( 'networkidle' );
await page.waitForLoadState( LOAD_STATE.NETWORK_IDLE );

await expect( page ).toHaveTitle( /Google Listings & Ads/ );

// click on the call-to-action button.
await page.getByText( 'Start listing products →' ).first().click();
await page.waitForLoadState( 'networkidle' );
await page.waitForLoadState( LOAD_STATE.NETWORK_IDLE );

// Check we are in the Setup MC page.
await expect(
Expand Down
Loading

0 comments on commit 338300f

Please sign in to comment.