Merge branch 'trunk' into try/individual-test-files
This commit is contained in:
commit
946f8ec903
|
@ -56,8 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
value="<?php echo esc_attr( isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>"
|
||||
placeholder="<?php esc_attr_e( 'Enter a search term and press enter', 'woocommerce' ); ?>">
|
||||
<input type="hidden" name="page" value="wc-addons">
|
||||
<?php $page_section = ( isset( $_GET['section'] ) && '_featured' !== $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '_all'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>
|
||||
<input type="hidden" name="section" value="<?php echo esc_attr( $page_section ); ?>">
|
||||
<input type="hidden" name="section" value="_all">
|
||||
</form>
|
||||
<?php if ( '_featured' === $current_section ) : ?>
|
||||
<div class="addons-featured">
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
* Internal dependencies
|
||||
*/
|
||||
const {
|
||||
shopper,
|
||||
merchant,
|
||||
clickTab,
|
||||
uiUnblocked,
|
||||
evalAndClick,
|
||||
setCheckbox,
|
||||
verifyAndPublish,
|
||||
} = require( '@woocommerce/e2e-utils' );
|
||||
const {
|
||||
waitAndClick,
|
||||
|
@ -24,7 +25,8 @@ const {
|
|||
} = require( '@jest/globals' );
|
||||
const config = require( 'config' );
|
||||
|
||||
const simpleProductName = config.get( 'products.simple.name' );
|
||||
const VirtualProductName = 'Virtual Product Name';
|
||||
const NonVirtualProductName = 'Non-Virtual Product Name';
|
||||
const simpleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
|
||||
|
||||
const verifyPublishAndTrash = async () => {
|
||||
|
@ -61,23 +63,55 @@ const runAddSimpleProductTest = () => {
|
|||
await merchant.login();
|
||||
});
|
||||
|
||||
it('can create simple virtual product titled "Simple Product" with regular price $9.99', async () => {
|
||||
it('can create simple virtual product and add it to the cart', async () => {
|
||||
await openNewProductAndVerify();
|
||||
|
||||
// Set product data
|
||||
await expect(page).toFill('#title', simpleProductName);
|
||||
// Set product data and publish the product
|
||||
await expect(page).toFill('#title', VirtualProductName);
|
||||
await expect(page).toClick('#_virtual');
|
||||
await clickTab('General');
|
||||
await expect(page).toFill('#_regular_price', simpleProductPrice);
|
||||
await verifyAndPublish();
|
||||
|
||||
// Publish product, verify that it was published. Trash product, verify that it was trashed.
|
||||
await verifyPublishAndTrash(
|
||||
'#publish',
|
||||
'.updated.notice',
|
||||
'Product published.',
|
||||
'Move to Trash',
|
||||
'1 product moved to the Trash.'
|
||||
);
|
||||
await merchant.logout();
|
||||
|
||||
// See product in the shop and add it to the cart
|
||||
await shopper.goToShop();
|
||||
await shopper.addToCartFromShopPage(VirtualProductName);
|
||||
await shopper.goToCart();
|
||||
await shopper.productIsInCart(VirtualProductName);
|
||||
|
||||
// Assert that the page does not contain shipping calculation button
|
||||
await expect(page).not.toMatchElement('a.shipping-calculator-button');
|
||||
|
||||
// Remove product from cart
|
||||
await shopper.removeFromCart(VirtualProductName);
|
||||
});
|
||||
|
||||
it('can create simple non-virtual product and add it to the cart', async () => {
|
||||
await merchant.login();
|
||||
await openNewProductAndVerify();
|
||||
|
||||
// Set product data and publish the product
|
||||
await expect(page).toFill('#title', NonVirtualProductName);
|
||||
await clickTab('General');
|
||||
await expect(page).toFill('#_regular_price', simpleProductPrice);
|
||||
await verifyAndPublish();
|
||||
|
||||
await merchant.logout();
|
||||
|
||||
// See product in the shop and add it to the cart
|
||||
await shopper.goToShop();
|
||||
await shopper.addToCartFromShopPage(NonVirtualProductName);
|
||||
await shopper.goToCart();
|
||||
await shopper.productIsInCart(NonVirtualProductName);
|
||||
|
||||
// Assert that the page does contain shipping calculation button
|
||||
await page.waitForSelector('a.shipping-calculator-button');
|
||||
await expect(page).toMatchElement('a.shipping-calculator-button');
|
||||
|
||||
// Remove product from cart
|
||||
await shopper.removeFromCart(NonVirtualProductName);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -88,7 +122,7 @@ const runAddVariableProductTest = () => {
|
|||
await merchant.login();
|
||||
});
|
||||
|
||||
it('can create variable product', async () => {
|
||||
it('can create product with variations', async () => {
|
||||
await openNewProductAndVerify();
|
||||
|
||||
// Set product data
|
||||
|
|
|
@ -36,7 +36,7 @@ const runCartPageTest = () => {
|
|||
await expect(page).toMatchElement('.cart-empty', {text: 'Your cart is currently empty.'});
|
||||
});
|
||||
|
||||
it('should add the product to the cart when "Add to cart" is clicked', async () => {
|
||||
it('should add the product to the cart from the shop page', async () => {
|
||||
await shopper.goToShop();
|
||||
await shopper.addToCartFromShopPage(simpleProductName);
|
||||
|
||||
|
|
Loading…
Reference in New Issue