-
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
Limits steps in onboarding based on previously completed state #2568
base: feature/2458-streamline-onboarding
Are you sure you want to change the base?
Changes from 4 commits
f99117f
d6f3a76
67ad90d
20ed5c7
31a3ba5
abc86c3
b3d8730
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than creating a whole new spec here, I think we should test for these scenarios in either the existing productListingsPage.mockContactInformation( {
phone_number: '+15555555',
phone_verification_status: 'verified',
mc_address: {
street_address: '556 Woo St.',
locality: 'City',
region: 'California',
postal_code: '90210',
country: 'US',
},
wc_address: {
street_address: '556 Woo St.',
locality: 'City',
region: 'California',
postal_code: '90210',
country: 'US',
},
is_mc_address_different: false,
wc_address_errors: [],
} ); One tricky part here is that the step is only removed when the stepper is first loaded, so we'll need a beforeAll step that reloads the page after the state is correctly mocked. I'm going to take a look tomorrow to see if I can get the state for this set up properly, since it's a bit tricky. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import SetUpAccountsPage from '../../utils/pages/setup-mc/step-1-set-up-accounts'; | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
const { test, expect } = require( '@playwright/test' ); | ||
|
||
test.use( { storageState: process.env.ADMINSTATE } ); | ||
|
||
test.describe.configure( { mode: 'serial' } ); | ||
|
||
/** | ||
* @type {import('../../utils/pages/setup-mc/step-1-set-up-accounts.js').default} setUpAccountsPage | ||
*/ | ||
let setUpAccountsPage = null; | ||
|
||
/** | ||
* @type {import('@playwright/test').Page} page | ||
*/ | ||
let page = null; | ||
|
||
test.describe( 'Hide Store Requirements Step', () => { | ||
test.beforeAll( async ( { browser } ) => { | ||
page = await browser.newPage(); | ||
setUpAccountsPage = new SetUpAccountsPage( page ); | ||
await Promise.all( [ | ||
// Mock google as connected. | ||
setUpAccountsPage.mockGoogleNotConnected(), | ||
|
||
// Mock MC contact information | ||
setUpAccountsPage.mockContactInformation(), | ||
] ); | ||
} ); | ||
|
||
test.afterAll( async () => { | ||
await setUpAccountsPage.closePage(); | ||
} ); | ||
|
||
test( 'should have store requirements step if incomplete', async () => { | ||
await setUpAccountsPage.goto(); | ||
|
||
// Mock MC step at step 1: | ||
setUpAccountsPage.mockMCSetup( 'incomplete', 'accounts' ); | ||
|
||
// 1. Assert there are 3 steps | ||
const steps = await page.locator( '.woocommerce-stepper__step' ); | ||
await expect( steps ).toHaveCount( 4 ); | ||
|
||
// 2. Assert the label of the 3rd step is 'Confirm store requirements' | ||
const thirdStepLabel = await steps | ||
.nth( 2 ) | ||
.locator( '.woocommerce-stepper__step-label' ); | ||
await expect( thirdStepLabel ).toHaveText( | ||
'Confirm store requirements' | ||
); | ||
} ); | ||
|
||
test( 'should not have store requirements step if complete', async () => { | ||
await setUpAccountsPage.goto(); | ||
|
||
// TODO: Mock email is verified & address is filled | ||
setUpAccountsPage.mockMCSetup( 'complete', 'accounts' ); | ||
|
||
// 1. Assert there are 3 steps | ||
const steps = await page.locator( '.woocommerce-stepper__step' ); | ||
await expect( steps ).toHaveCount( 3 ); | ||
|
||
// 2. Assert the label of the 3rd step is not 'Confirm store requirements' | ||
const thirdStepLabel = await steps | ||
.nth( 2 ) | ||
.locator( '.woocommerce-stepper__step-label' ); | ||
await expect( thirdStepLabel ).not.toHaveText( | ||
'Confirm store requirements' | ||
); | ||
|
||
// 3. Assert the label of the 3rd step equals 'Create a campaign' | ||
await expect( thirdStepLabel ).toHaveText( 'Create a campaign' ); | ||
} ); | ||
} ); |
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.
These can be combined: