woocommerce/plugins/woocommerce-blocks/tests/e2e/block-theme.setup.ts

25 lines
766 B
TypeScript
Raw Normal View History

/**
* External dependencies
*/
import { BLOCK_THEME_SLUG, cli } from '@woocommerce/e2e-utils';
import { test as setup, expect } from '@woocommerce/e2e-playwright-utils';
setup( 'Sets up the block theme', async () => {
let cliOutput = await cli(
`npm run wp-env run tests-cli -- wp theme install ${ BLOCK_THEME_SLUG } --activate`
);
expect(
cliOutput.stdout,
`Could not install and/or activate ${ BLOCK_THEME_SLUG }`
).toContain( 'Success' );
// Enable permalinks and perform a hard flush.
cliOutput = await cli(
Refactor Cart and Checkout Page Templates (https://github.com/woocommerce/woocommerce-blocks/pull/10773) * Rename checkout template slug * Remove redirect and custom title * Classic shortcode block for checkout * Empty title * WIP placeholder * Change blockified template * Prefix cart and checkout templates with "Page: " * Template migration routine * Apply same treatment to cart template * Notices * Update placeholder text * Classic shortcodes block * Page content wrapper for templates * Update default * Do not save attributes * Update templates * Remove cart classic template * Reverted endpoints for Cart & Checkout templates. This reverts PR 9406 * Migrate page content wrapper. * Removed useless method arg. Minor tweaks. * Skip migration if the theme has a template file for this page. * Removed impossible condition. * Migrate page content wrapper. * Remove TemplateNotice in favour of DefaultNotice * Documentation links in shortcode placeholder * Hide cart and checkout page selector when using block themes * Unused var * Add tests for template changes * Revert changes to classic-template * Allow frontend redirect * Unused file * Bump version for updater * Support x template naming as well as page-x * Need to add item to cart to test checkout * Fix header test by fixing utility for adding to cart * Remove permalink tests * Click body * Wait for content to finish loading * Wait for add to cart response when adding to cart without item name * Wait for save before visiting frontend * Set content instead of inserting block * Perform test in site editor rather than page editor * Prevent notice to set the default cart/checkout page from showing on the site editor. --------- Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2023-09-19 09:58:18 +00:00
`npm run wp-env run tests-cli -- wp rewrite structure /%postname%/ --hard`
);
expect( cliOutput.stdout ).toContain( 'Success: Rewrite structure set' );
expect( cliOutput.stdout ).toContain( 'Success: Rewrite rules flushed' );
} );