This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix php notice when selecting paid theme (#8493)
* Add initial E2E tests for purchase task * Update paid theme logic to remove PHP warning and keep the correct price * Fix php unit tests * Address some PR feedback * Add changelog * Include the purchase task e2e test * Disable test * Delete purchase E2E test file
- Loading branch information
Showing
10 changed files
with
239 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: Fix | ||
|
||
Fix handling of paid themes in purchase task. #8493 |
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
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
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { resetWooCommerceState } from '../../fixtures'; | ||
import { Login } from '../../pages/Login'; | ||
import { OnboardingWizard } from '../../pages/OnboardingWizard'; | ||
import { WcHomescreen } from '../../pages/WcHomescreen'; | ||
import { getElementByText, waitForElementByText } from '../../utils/actions'; | ||
|
||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const { afterAll, beforeAll, describe, it } = require( '@jest/globals' ); | ||
/* eslint-enable @typescript-eslint/no-var-requires */ | ||
|
||
const testAdminPurchaseSetupTask = () => { | ||
describe( 'Purchase setup task', () => { | ||
const profileWizard = new OnboardingWizard( page ); | ||
const homeScreen = new WcHomescreen( page ); | ||
const login = new Login( page ); | ||
|
||
beforeAll( async () => { | ||
await login.login(); | ||
} ); | ||
|
||
afterAll( async () => { | ||
await login.logout(); | ||
} ); | ||
|
||
describe( 'selecting paid product', () => { | ||
beforeAll( async () => { | ||
await resetWooCommerceState(); | ||
|
||
await profileWizard.navigate(); | ||
await profileWizard.walkThroughAndCompleteOnboardingWizard( { | ||
products: [ 'Memberships' ], | ||
} ); | ||
|
||
await homeScreen.isDisplayed(); | ||
await homeScreen.possiblyDismissWelcomeModal(); | ||
} ); | ||
|
||
it( 'should display add <product name> to my store task', async () => { | ||
expect( | ||
await getElementByText( '*', 'Add Memberships to my store' ) | ||
).toBeDefined(); | ||
} ); | ||
|
||
it( 'should show paid features modal with option to buy now', async () => { | ||
const task = await getElementByText( | ||
'*', | ||
'Add Memberships to my store' | ||
); | ||
await task?.click(); | ||
await waitForElementByText( | ||
'h1', | ||
'Would you like to add the following paid features to your store now?' | ||
); | ||
expect( | ||
await getElementByText( 'button', 'Buy now' ) | ||
).toBeDefined(); | ||
} ); | ||
} ); | ||
|
||
describe( 'selecting paid theme', () => { | ||
beforeAll( async () => { | ||
await resetWooCommerceState(); | ||
|
||
await profileWizard.navigate(); | ||
await profileWizard.walkThroughAndCompleteOnboardingWizard( { | ||
themeTitle: 'Blooms', | ||
} ); | ||
|
||
await homeScreen.isDisplayed(); | ||
await homeScreen.possiblyDismissWelcomeModal(); | ||
} ); | ||
|
||
it( 'should display add <theme name> to my store task', async () => { | ||
expect( | ||
await getElementByText( '*', 'Add Blooms to my store' ) | ||
).toBeDefined(); | ||
} ); | ||
|
||
it( 'should show paid features modal with option to buy now', async () => { | ||
const task = await getElementByText( | ||
'*', | ||
'Add Blooms to my store' | ||
); | ||
await task?.click(); | ||
await waitForElementByText( | ||
'h1', | ||
'Would you like to add the following paid features to your store now?' | ||
); | ||
expect( | ||
await getElementByText( 'button', 'Buy now' ) | ||
).toBeDefined(); | ||
} ); | ||
} ); | ||
} ); | ||
}; | ||
|
||
module.exports = { testAdminPurchaseSetupTask }; |
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
Oops, something went wrong.