This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 221
e2e tests for cart and checkout templates #9939
Merged
mikejolley
merged 31 commits into
add/9288_cart-checkout-order-received_fse_templates
from
add/e2e-tests-for-checkout-templates
Jun 28, 2023
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
ae73afe
Merge branch 'trunk' into poc/cart_and_checkout_fse_templates
wavvves 047a42b
Merge branch 'trunk' into add/9288_cart-checkout-order-received_fse_t…
wavvves f79b42b
Resolve merge conflicts
mikejolley f001917
Add e2e for permalink settings
mikejolley 8186549
Test that templates exist
mikejolley f88c03b
Add test to check that templates can be edited
mikejolley e861c1c
Add tests to confirm templates can be edited
mikejolley dbc2171
Ensure cart has contents before running tests on frontend views
mikejolley efb2b52
Commend out problem test
mikejolley 89ac75c
Make sure search has multiple results
mikejolley 97ef316
Remove useThrottle - bad rebase
mikejolley e37bbd4
Revert changes to docs after rebase
mikejolley 0f9893c
Revert function call for noReviewsPlaceholder
mikejolley 12c7119
Bad rebase
mikejolley 314b844
Reverts
mikejolley 1ae9926
Remove revertTemplate
mikejolley 790b53f
Spacing
mikejolley 87f9259
Wait for networkidle after navigation
mikejolley 98d88cd
Always wait for network
mikejolley df350d1
Use button roles in site editor
mikejolley 2cdad1e
More specific button locator
mikejolley 7de932e
Update option comparison
mikejolley 4fbdbbe
Fix template content
mikejolley 6623b3c
Disable failing tests
mikejolley 9587ed4
Disable failing classic template tests
mikejolley 45b2949
Use enterEditMode
mikejolley d51966e
More enterEditMode usage
mikejolley 8e8856a
enterEditMode
mikejolley 0ae69cd
Use test.skip
mikejolley 1b02c07
More robust selectors
mikejolley 41f1f8c
Alt iframe selector
mikejolley 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
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
95 changes: 95 additions & 0 deletions
95
tests/e2e-pw/tests/permalink-settings/permalink-settings.block_theme.spec.ts
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,95 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { test, expect } from '@woocommerce/e2e-playwright-utils'; | ||
import { cli } from '@woocommerce/e2e-utils'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { goToShop, addToCart } from '../../utils'; | ||
|
||
test.describe( | ||
'Tests permalink settings for the cart and checkout templates', | ||
async () => { | ||
test.afterAll( async () => { | ||
await cli( | ||
'npm run wp-env run tests-cli "wp option update woocommerce_cart_page_endpoint cart"' | ||
); | ||
await cli( | ||
'npm run wp-env run tests-cli "wp option update woocommerce_checkout_page_endpoint checkout"' | ||
); | ||
} ); | ||
|
||
test.describe( 'Settings page', () => { | ||
test( 'Load advanced settings', async ( { page } ) => { | ||
await page.goto( | ||
'/wp-admin/admin.php?page=wc-settings&tab=advanced' | ||
); | ||
const title = page | ||
.locator( 'div.wrap.woocommerce > form > h2' ) | ||
.first(); | ||
await expect( title ).toHaveText( 'Page setup' ); | ||
} ); | ||
test( 'Permlink settings exist', async ( { page } ) => { | ||
await page.goto( | ||
'/wp-admin/admin.php?page=wc-settings&tab=advanced' | ||
); | ||
const cartInput = page.getByLabel( 'Cart page', { | ||
exact: true, | ||
} ); | ||
const checkoutInput = page.getByLabel( 'Checkout page', { | ||
exact: true, | ||
} ); | ||
|
||
await expect( cartInput ).toBeVisible(); | ||
await expect( checkoutInput ).toBeVisible(); | ||
} ); | ||
} ); | ||
|
||
test.describe( 'Frontend templates are updated', () => { | ||
test.beforeEach( async ( { page } ) => { | ||
await goToShop( page ); | ||
await addToCart( page ); | ||
} ); | ||
|
||
test( 'Changing cart permalink works', async ( { page } ) => { | ||
await page.goto( | ||
'/wp-admin/admin.php?page=wc-settings&tab=advanced' | ||
); | ||
const cartInput = page.getByLabel( 'Cart page', { | ||
exact: true, | ||
} ); | ||
cartInput.fill( 'updated-cart-permalink' ); | ||
await page.click( 'button[name="save"]' ); | ||
await page.waitForLoadState( 'networkidle' ); | ||
|
||
// Visit the updated page. | ||
await page.goto( '/updated-cart-permalink', { | ||
waitUntil: 'networkidle', | ||
} ); | ||
const cartText = await page.getByText( 'Proceed to checkout' ); | ||
expect( cartText ).toBeVisible(); | ||
} ); | ||
|
||
test( 'Changing checkout permalink works', async ( { page } ) => { | ||
await page.goto( | ||
'/wp-admin/admin.php?page=wc-settings&tab=advanced' | ||
); | ||
const checkoutInput = page.getByLabel( 'Checkout page', { | ||
exact: true, | ||
} ); | ||
checkoutInput.fill( 'updated-checkout-permalink' ); | ||
await page.click( 'button[name="save"]' ); | ||
await page.waitForLoadState( 'networkidle' ); | ||
|
||
// Visit the updated page. | ||
await page.goto( '/updated-checkout-permalink', { | ||
waitUntil: 'networkidle', | ||
} ); | ||
const cartText = await page.getByText( 'Place Order' ); | ||
expect( cartText ).toBeVisible(); | ||
} ); | ||
} ); | ||
} | ||
); |
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.
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.
This was a bug!
getByText
returns arrays