-
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
Draft
dsawardekar
wants to merge
7
commits into
feature/2458-streamline-onboarding
Choose a base branch
from
update/2493-hide-confirm-step-if-possible
base: feature/2458-streamline-onboarding
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f99117f
Limits steps in onboarding based on previously completed state
dsawardekar d6f3a76
Fixes linter warnings
dsawardekar 67ad90d
Updates step conditional per feedback
dsawardekar 20ed5c7
First pass at the hide store requirements e2e tests
dsawardekar 31a3ba5
Fixes linter warning
dsawardekar abc86c3
Switches to complete step mock
dsawardekar b3d8730
Check store requirements in saved setup stepper.
joemcgill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
tests/e2e/specs/setup-mc/step-3-hide-store-requirements.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ); | ||
} ); | ||
} ); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Rather than creating a whole new spec here, I think we should test for these scenarios in either the existing
tests/e2e/specs/setup-mc/step-3-confirm-store-requirements.test.js
spec, or test for this scenario intests/e2e/specs/setup-mc/step-2-product-listings.test.js
whenever the continue button is clicked with the address info already correctly mocked. I think that should look something like this: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.