-
Notifications
You must be signed in to change notification settings - Fork 210
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
Add Pre-Orders E2E Shortcode/Blocks Tests #3932
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
f29ffe3
Clean-up: Remove unused 'loginCustomerAndSaveState' function
lovo-h 89c9382
Refactor: Re-use 'installPluginFromRepository()' function
lovo-h b66a2c2
Clean-up: Remove unused 'checkWooGutenbergProductsBlockVersion' import
lovo-h a95eb33
Add 'woocommerce-pre-orders' plugin as part of e2e global-setup
lovo-h a3625fb
Rephrase plugin installation errors' verbiage
lovo-h a4b1fbf
Add 'products' utility to re-use product data
lovo-h 36055eb
Add Pre-Order e2e tests
lovo-h 1d58d42
Update Stripe iFrame selectors
lovo-h fde397f
Fix legacy tests: Differentiate between UPE and legacy iFrame
lovo-h 00ca1fe
Fix setup script to include the Pre-Orders plugin
lovo-h bd2e091
Add additional logging for Pre-Orders installation steps
lovo-h 9249ba3
Merge branch 'develop' into add/pre-orders-e2e-tests
diegocurbelo 97e1788
Enable DEBUG mode for docker setup
diegocurbelo 3d21f42
Disable DEBUG mode
lovo-h 7ba1bec
Code cleanup: Re-use E2E_ROOT variable
lovo-h fb40165
Fix installation path for Woo Pre-Orders
lovo-h 1fdfaf3
Code clean-up: Add options variable for readability
lovo-h 3d55a3a
Fix legacy E2E tests: Retrieve independent CC input iFrames
lovo-h 218b89f
Merge branch 'develop' into add/pre-orders-e2e-tests
lovo-h d838091
Only run Pre-Order E2E tests if the plugin is installed
lovo-h f327b8b
Add quotation marks around text selectors
lovo-h 1e90f06
Log selector used when error thrown because CC input field not found
lovo-h 6e8ab30
Merge branch 'develop' into add/pre-orders-e2e-tests
lovo-h 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
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
19 changes: 2 additions & 17 deletions
19
tests/e2e/tests/_legacy-experience/woocommerce-blocks/subscription-product.spec.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
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,48 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import config from 'config'; | ||
import { api, payments, products } from '../../../utils'; | ||
import { isPluginInstalled } from '../../../utils/plugin-utils'; | ||
|
||
const { setupBlocksCheckout, fillCreditCardDetails } = payments; | ||
|
||
let productId; | ||
|
||
test.skip( async () => { | ||
return ! ( await isPluginInstalled( 'woocommerce-pre-orders' ) ); | ||
}, 'Woo Pre-Orders plugin is not active. Skipping tests.' ); | ||
|
||
test.beforeAll( async () => { | ||
productId = await api.create.product( products.preOrderData() ); | ||
} ); | ||
|
||
test.afterAll( async () => { | ||
if ( ! productId ) { | ||
return; | ||
} | ||
|
||
await api.deletePost.product( productId ); | ||
} ); | ||
|
||
test( 'customer can purchase a pre-order product @blocks @pre-orders', async ( { | ||
page, | ||
} ) => { | ||
await page.goto( `?p=${ productId }` ); | ||
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. I guess we are using permalinks but this is easier for redirecting the browser to the product URL without knowing the post slug. |
||
await page.locator( 'button[name="add-to-cart"]' ).click(); | ||
|
||
// Subscriptions will create an account for this checkout, we need a random email. | ||
const customerData = { | ||
...config.get( 'addresses.customer.billing' ), | ||
email: | ||
Date.now() + '+' + config.get( 'addresses.customer.billing.email' ), | ||
}; | ||
|
||
await setupBlocksCheckout( page, customerData ); | ||
await fillCreditCardDetails( page, config.get( 'cards.no-3ds' ) ); | ||
|
||
await page.locator( 'text="Place Order"' ).click(); | ||
await page.waitForURL( '**/checkout/order-received/**' ); | ||
|
||
await expect( page.locator( 'h1.entry-title' ) ).toHaveText( | ||
'Order received' | ||
); | ||
} ); |
19 changes: 2 additions & 17 deletions
19
tests/e2e/tests/checkout/blocks/subscription-product.spec.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
Oops, something went wrong.
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.
Since this is an open-source plugin that anyone can contribute to, only people with access to this repository would be able to run the E2E tests. Wondering if we should not run pre-order tests by default.
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.
Or perhaps skip pre-order tests if the plugin isn’t installed successfully?
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.
Good call. Addressed in d838091.