-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2516 from woocommerce/update/2487-hide-jetpack-if…
…-already-connected-onboarding Hides jetpack during onboarding if already connected
- Loading branch information
Showing
3 changed files
with
71 additions
and
116 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ test.describe( 'Set up accounts', () => { | |
await setUpAccountsPage.closePage(); | ||
} ); | ||
|
||
test( 'should see accounts step header, "Connect your WordPress.com account" & connect button', async () => { | ||
test( 'JetpackDisconnected: should see accounts step header, "Connect your WordPress.com account" & connect button', async () => { | ||
await setUpAccountsPage.goto(); | ||
|
||
await expect( | ||
|
@@ -58,13 +58,10 @@ test.describe( 'Set up accounts', () => { | |
) | ||
).toBeVisible(); | ||
|
||
await expect( | ||
page.getByRole( 'button', { name: 'Connect' } ).first() | ||
).toBeEnabled(); | ||
|
||
const wpAccountCard = setUpAccountsPage.getWPAccountCard(); | ||
await expect( wpAccountCard ).toBeEnabled(); | ||
await expect( wpAccountCard ).toContainText( 'WordPress.com' ); | ||
await expect( wpAccountCard.getByRole( 'button' ) ).toBeEnabled(); | ||
|
||
const googleAccountCard = setUpAccountsPage.getGoogleAccountCard(); | ||
await expect( googleAccountCard.getByRole( 'button' ) ).toBeDisabled(); | ||
|
@@ -116,7 +113,7 @@ test.describe( 'Set up accounts', () => { | |
} ); | ||
} ); | ||
|
||
test.describe( 'Connect Google account', () => { | ||
test.describe( 'Connected WordPress.com account', async () => { | ||
test.beforeAll( async () => { | ||
// Mock Jetpack as connected | ||
await setUpAccountsPage.mockJetpackConnected( | ||
|
@@ -133,24 +130,48 @@ test.describe( 'Set up accounts', () => { | |
await setUpAccountsPage.goto(); | ||
} ); | ||
|
||
test( 'should see their WPORG email, "Google" title & connect button', async () => { | ||
const jetpackDescriptionRow = | ||
setUpAccountsPage.getJetpackDescriptionRow(); | ||
test( 'should not show the WP.org connection card when already connected', async () => { | ||
await expect( | ||
page.getByRole( 'heading', { name: 'Set up your accounts' } ) | ||
).toBeVisible(); | ||
|
||
await expect( jetpackDescriptionRow ).toContainText( | ||
await expect( | ||
page.getByText( | ||
'Connect the accounts required to use Google for WooCommerce.' | ||
) | ||
).toBeVisible(); | ||
|
||
const wpAccountCard = setUpAccountsPage.getWPAccountCard(); | ||
await expect( wpAccountCard ).not.toBeVisible(); | ||
} ); | ||
} ); | ||
|
||
test.describe( 'Connect Google account', () => { | ||
test.beforeAll( async () => { | ||
// Mock Jetpack as connected | ||
await setUpAccountsPage.mockJetpackConnected( | ||
'Test user', | ||
'[email protected]' | ||
); | ||
|
||
// Mock google as not connected. | ||
// When pending even WPORG will not render yet. | ||
// If not mocked will fail and render nothing, | ||
// as Jetpack is mocked only on the client-side. | ||
await setUpAccountsPage.mockGoogleNotConnected(); | ||
|
||
await setUpAccountsPage.goto(); | ||
} ); | ||
|
||
test( 'should see their WPORG email, "Google" title & connect button', async () => { | ||
const googleAccountCard = setUpAccountsPage.getGoogleAccountCard(); | ||
|
||
await expect( | ||
googleAccountCard.getByText( 'Google', { exact: true } ) | ||
).toBeVisible(); | ||
|
||
await expect( | ||
googleAccountCard | ||
.getByRole( 'button', { name: 'Connect' } ) | ||
.first() | ||
googleAccountCard.getByRole( 'button', { name: 'Connect' } ) | ||
).toBeEnabled(); | ||
|
||
const mcAccountCard = setUpAccountsPage.getMCAccountCard(); | ||
|
@@ -393,12 +414,6 @@ test.describe( 'Set up accounts', () => { | |
} ); | ||
|
||
test( 'should see their WPORG email, Google email, "Google Merchant Center" title & "Create account" button', async () => { | ||
const jetpackDescriptionRow = | ||
setUpAccountsPage.getJetpackDescriptionRow(); | ||
await expect( jetpackDescriptionRow ).toContainText( | ||
'[email protected]' | ||
); | ||
|
||
const googleDescriptionRow = | ||
setUpAccountsPage.getGoogleDescriptionRow(); | ||
await expect( googleDescriptionRow ).toContainText( | ||
|
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