Shopper → Mini Cart → Can view translated mini cart contents block (https://github.com/woocommerce/woocommerce-blocks/pull/6214)
This commit is contained in:
parent
8297085662
commit
ad85348151
|
@ -20,4 +20,10 @@ wp plugin list
|
|||
wp theme activate storefront
|
||||
wp wc customer update 1 --user=1 --billing='{"first_name":"John","last_name":"Doe","company":"Automattic","country":"US","address_1":"addr 1","address_2":"addr 2","city":"San Francisco","state":"CA","postcode":"94107","phone":"123456789"}' --shipping='{"first_name":"John","last_name":"Doe","company":"Automattic","country":"US","address_1":"addr 1","address_2":"addr 2","city":"San Francisco","state":"CA","postcode":"94107","phone":"123456789"}'
|
||||
|
||||
## Prepare translation for the test suite
|
||||
wp language core install nl_NL
|
||||
wp language plugin install woo-gutenberg-products-block nl_NL
|
||||
# We need to run update after installing the langauge to update it to the latest version. Otherwise, new strings won't be available.
|
||||
wp language plugin update woo-gutenberg-products-block nl_NL
|
||||
|
||||
exit $EXIT_CODE
|
||||
|
|
|
@ -13,7 +13,9 @@ import {
|
|||
* Internal dependencies
|
||||
*/
|
||||
import { shopper } from '../../../utils';
|
||||
import { merchant } from '../../../utils/merchant';
|
||||
import { getTextContent } from '../../page-utils';
|
||||
import { useTheme } from '../../utils';
|
||||
|
||||
const block = {
|
||||
name: 'Mini Cart',
|
||||
|
@ -559,4 +561,77 @@ describe( 'Shopper → Mini Cart', () => {
|
|||
await expect( page ).toMatch( productTitle );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( 'Translations', () => {
|
||||
beforeAll( async () => {
|
||||
await merchant.changeLanguage( 'nl_NL' );
|
||||
await shopper.block.emptyCart();
|
||||
} );
|
||||
|
||||
afterAll( async () => {
|
||||
await merchant.changeLanguage( '' );
|
||||
} );
|
||||
|
||||
describe( 'Classic Themes', () => {
|
||||
afterAll( async () => {
|
||||
await shopper.block.emptyCart();
|
||||
} );
|
||||
|
||||
it( 'User can see translation in empty Mini Cart', async () => {
|
||||
await clickMiniCartButton();
|
||||
|
||||
await expect( page ).toMatchElement(
|
||||
'.wc-block-mini-cart__drawer',
|
||||
{
|
||||
text: 'Begin met winkelen',
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
it( 'User can see translation in filled Mini Cart', async () => {
|
||||
await page.click(
|
||||
'.wc-block-grid__product:first-child .add_to_cart_button'
|
||||
);
|
||||
|
||||
await expect( page ).toMatchElement(
|
||||
'.wc-block-mini-cart__title',
|
||||
{
|
||||
text: 'Je winkelwagen (1 stuk)',
|
||||
}
|
||||
);
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( 'Block Themes', () => {
|
||||
useTheme( 'twentytwentytwo' );
|
||||
|
||||
afterAll( async () => {
|
||||
await shopper.block.emptyCart();
|
||||
} );
|
||||
|
||||
it( 'User can see translation in empty Mini Cart', async () => {
|
||||
await clickMiniCartButton();
|
||||
|
||||
await expect( page ).toMatchElement(
|
||||
'.wc-block-mini-cart__drawer',
|
||||
{
|
||||
text: 'Begin met winkelen',
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
it( 'User can see translation in filled Mini Cart', async () => {
|
||||
await page.click(
|
||||
'.wc-block-grid__product:first-child .add_to_cart_button'
|
||||
);
|
||||
|
||||
await expect( page ).toMatchElement(
|
||||
'.wc-block-mini-cart__title',
|
||||
{
|
||||
text: 'Je winkelwagen (1 stuk)',
|
||||
}
|
||||
);
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -10,5 +10,8 @@ export const merchant = {
|
|||
await visitAdminPage( 'options-general.php' );
|
||||
await page.select( 'select#WPLANG', language );
|
||||
await page.click( 'input[type="submit"]' );
|
||||
await page.waitForSelector( '#setting-error-settings_updated', {
|
||||
visible: true,
|
||||
} );
|
||||
},
|
||||
};
|
||||
|
|
|
@ -100,9 +100,9 @@ export const shopper = {
|
|||
|
||||
await page.waitForSelector( '.woocommerce-info' );
|
||||
// eslint-disable-next-line jest/no-standalone-expect
|
||||
await expect( page ).toMatchElement( '.woocommerce-info', {
|
||||
text: 'Your cart is currently empty.',
|
||||
} );
|
||||
await expect( page ).toMatchElement(
|
||||
'.woocommerce-info.cart-empty'
|
||||
);
|
||||
},
|
||||
|
||||
placeOrder: async () => {
|
||||
|
|
Loading…
Reference in New Issue