Use canvas param instead of manually entering edit mode
This commit is contained in:
parent
25bc03f893
commit
5e6cc17154
|
@ -62,8 +62,8 @@ test.describe( `${ blockData.name } Block`, () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//archive-product`,
|
postId: `woocommerce/woocommerce//archive-product`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
|
|
||||||
await editor.insertBlock( { name: 'woocommerce/single-product' } );
|
await editor.insertBlock( { name: 'woocommerce/single-product' } );
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ test.describe( `${ blockData.name } Block`, () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//single-product`,
|
postId: `woocommerce/woocommerce//single-product`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
|
|
||||||
await editor.setContent( '' );
|
await editor.setContent( '' );
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@ test.describe( 'Merchant → Cart', () => {
|
||||||
const blockSelectorInEditor = blockData.selectors.editor.block as string;
|
const blockSelectorInEditor = blockData.selectors.editor.block as string;
|
||||||
|
|
||||||
test.describe( 'in page editor', () => {
|
test.describe( 'in page editor', () => {
|
||||||
test.beforeEach( async ( { editorUtils, admin } ) => {
|
test.beforeEach( async ( { admin } ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: 'woocommerce/woocommerce//page-cart',
|
postId: 'woocommerce/woocommerce//page-cart',
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'renders without crashing and can only be inserted once', async ( {
|
test( 'renders without crashing and can only be inserted once', async ( {
|
||||||
|
|
|
@ -42,12 +42,13 @@ test.describe( 'Merchant → Checkout', () => {
|
||||||
// `as string` is safe here because we know the variable is a string, it is defined above.
|
// `as string` is safe here because we know the variable is a string, it is defined above.
|
||||||
const blockSelectorInEditor = blockData.selectors.editor.block as string;
|
const blockSelectorInEditor = blockData.selectors.editor.block as string;
|
||||||
|
|
||||||
test.beforeEach( async ( { editorUtils, admin, editor } ) => {
|
test.beforeEach( async ( { admin, editor } ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: 'woocommerce/woocommerce//page-checkout',
|
postId: 'woocommerce/woocommerce//page-checkout',
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editor.openDocumentSettingsSidebar();
|
await editor.openDocumentSettingsSidebar();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -147,8 +148,8 @@ test.describe( 'Merchant → Checkout', () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: 'woocommerce/woocommerce//page-checkout',
|
postId: 'woocommerce/woocommerce//page-checkout',
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editor.openDocumentSettingsSidebar();
|
await editor.openDocumentSettingsSidebar();
|
||||||
await editor.selectBlocks(
|
await editor.selectBlocks(
|
||||||
blockSelectorInEditor +
|
blockSelectorInEditor +
|
||||||
|
@ -190,8 +191,8 @@ test.describe( 'Merchant → Checkout', () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: 'woocommerce/woocommerce//page-checkout',
|
postId: 'woocommerce/woocommerce//page-checkout',
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editor.openDocumentSettingsSidebar();
|
await editor.openDocumentSettingsSidebar();
|
||||||
await editor.selectBlocks(
|
await editor.selectBlocks(
|
||||||
blockSelectorInEditor +
|
blockSelectorInEditor +
|
||||||
|
|
|
@ -237,33 +237,31 @@ test.describe( 'Shopper → Shipping and Billing Addresses', () => {
|
||||||
// `as string` is safe here because we know the variable is a string, it is defined above.
|
// `as string` is safe here because we know the variable is a string, it is defined above.
|
||||||
const blockSelectorInEditor = blockData.selectors.editor.block as string;
|
const blockSelectorInEditor = blockData.selectors.editor.block as string;
|
||||||
|
|
||||||
test.beforeEach(
|
test.beforeEach( async ( { editor, admin, editorUtils, page } ) => {
|
||||||
async ( { editor, frontendUtils, admin, editorUtils, page } ) => {
|
await admin.visitSiteEditor( {
|
||||||
await admin.visitSiteEditor( {
|
postId: 'woocommerce/woocommerce//page-checkout',
|
||||||
postId: 'woocommerce/woocommerce//page-checkout',
|
postType: 'wp_template',
|
||||||
postType: 'wp_template',
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
await editor.openDocumentSettingsSidebar();
|
||||||
await editor.openDocumentSettingsSidebar();
|
await editor.selectBlocks(
|
||||||
await editor.selectBlocks(
|
blockSelectorInEditor +
|
||||||
blockSelectorInEditor +
|
' [data-type="woocommerce/checkout-shipping-address-block"]'
|
||||||
' [data-type="woocommerce/checkout-shipping-address-block"]'
|
);
|
||||||
);
|
|
||||||
|
|
||||||
const checkbox = page.getByRole( 'checkbox', {
|
const checkbox = page.getByRole( 'checkbox', {
|
||||||
name: 'Company',
|
name: 'Company',
|
||||||
exact: true,
|
exact: true,
|
||||||
} );
|
} );
|
||||||
await checkbox.check();
|
await checkbox.check();
|
||||||
await expect( checkbox ).toBeChecked();
|
await expect( checkbox ).toBeChecked();
|
||||||
await expect(
|
await expect(
|
||||||
editor.canvas.locator(
|
editor.canvas.locator(
|
||||||
'div.wc-block-components-address-form__company'
|
'div.wc-block-components-address-form__company'
|
||||||
)
|
)
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await editorUtils.saveSiteEditorEntities();
|
await editorUtils.saveSiteEditorEntities();
|
||||||
}
|
} );
|
||||||
);
|
|
||||||
|
|
||||||
test( 'User can add postcodes for different countries', async ( {
|
test( 'User can add postcodes for different countries', async ( {
|
||||||
frontendUtils,
|
frontendUtils,
|
||||||
|
|
|
@ -44,8 +44,8 @@ test.describe( 'Shopper → Order Confirmation (logged in user)', () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: 'woocommerce/woocommerce//order-confirmation',
|
postId: 'woocommerce/woocommerce//order-confirmation',
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editorUtils.transformIntoBlocks();
|
await editorUtils.transformIntoBlocks();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,8 @@ for ( const { templateTitle, slug } of Object.values( templates ) ) {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//${ slug }`,
|
postId: `woocommerce/woocommerce//${ slug }`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
const block = await editorUtils.getBlockByName( blockData.name );
|
const block = await editorUtils.getBlockByName( blockData.name );
|
||||||
|
|
||||||
await expect( block ).toBeVisible();
|
await expect( block ).toBeVisible();
|
||||||
|
@ -75,14 +75,13 @@ for ( const { templateTitle, slug } of Object.values( templates ) ) {
|
||||||
test.skip( `is rendered on ${ templateTitle } template - frontend side`, async ( {
|
test.skip( `is rendered on ${ templateTitle } template - frontend side`, async ( {
|
||||||
admin,
|
admin,
|
||||||
editor,
|
editor,
|
||||||
editorUtils,
|
|
||||||
page,
|
page,
|
||||||
} ) => {
|
} ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//${ slug }`,
|
postId: `woocommerce/woocommerce//${ slug }`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editor.insertBlock( {
|
await editor.insertBlock( {
|
||||||
name: 'core/paragraph',
|
name: 'core/paragraph',
|
||||||
attributes: { content: 'Hello World' },
|
attributes: { content: 'Hello World' },
|
||||||
|
|
|
@ -37,8 +37,8 @@ test.describe( 'Merchant → Local Pickup Settings', () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: 'woocommerce/woocommerce//page-checkout',
|
postId: 'woocommerce/woocommerce//page-checkout',
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
|
|
||||||
const block = await editorUtils.getBlockByName(
|
const block = await editorUtils.getBlockByName(
|
||||||
'woocommerce/checkout-shipping-method-block'
|
'woocommerce/checkout-shipping-method-block'
|
||||||
|
@ -73,8 +73,8 @@ test.describe( 'Merchant → Local Pickup Settings', () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: 'woocommerce/woocommerce//page-checkout',
|
postId: 'woocommerce/woocommerce//page-checkout',
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
editor.canvas.getByText( 'Edited from settings page' )
|
editor.canvas.getByText( 'Edited from settings page' )
|
||||||
|
|
|
@ -24,8 +24,8 @@ test.describe( 'Merchant → Mini Cart', () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//single-product`,
|
postId: `woocommerce/woocommerce//single-product`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
|
|
||||||
await editor.setContent( '' );
|
await editor.setContent( '' );
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ test.describe( 'Merchant → Mini Cart', () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//single-product`,
|
postId: `woocommerce/woocommerce//single-product`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editorUtils.openGlobalBlockInserter();
|
await editorUtils.openGlobalBlockInserter();
|
||||||
|
|
||||||
await editorUtils.page
|
await editorUtils.page
|
||||||
|
|
|
@ -72,12 +72,12 @@ const getBoundingClientRect = async ( {
|
||||||
};
|
};
|
||||||
test.describe( `${ blockData.name }`, () => {
|
test.describe( `${ blockData.name }`, () => {
|
||||||
test.describe( `On the Single Product Template`, () => {
|
test.describe( `On the Single Product Template`, () => {
|
||||||
test.beforeEach( async ( { admin, editorUtils, editor } ) => {
|
test.beforeEach( async ( { admin, editor } ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editor.setContent( '' );
|
await editor.setContent( '' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
|
@ -953,8 +953,8 @@ test.describe( 'Product Collection', () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//taxonomy-product_cat`,
|
postId: `woocommerce/woocommerce//taxonomy-product_cat`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editorUtils.insertBlockUsingGlobalInserter(
|
await editorUtils.insertBlockUsingGlobalInserter(
|
||||||
pageObject.BLOCK_NAME
|
pageObject.BLOCK_NAME
|
||||||
);
|
);
|
||||||
|
@ -982,8 +982,8 @@ test.describe( 'Product Collection', () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//taxonomy-product_tag`,
|
postId: `woocommerce/woocommerce//taxonomy-product_tag`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editorUtils.insertBlockUsingGlobalInserter(
|
await editorUtils.insertBlockUsingGlobalInserter(
|
||||||
pageObject.BLOCK_NAME
|
pageObject.BLOCK_NAME
|
||||||
);
|
);
|
||||||
|
|
|
@ -182,9 +182,8 @@ class ProductCollectionPage {
|
||||||
await this.admin.visitSiteEditor( {
|
await this.admin.visitSiteEditor( {
|
||||||
postId: template,
|
postId: template,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await this.editorUtils.waitForSiteEditorFinishLoading();
|
|
||||||
await this.editorUtils.enterEditMode();
|
|
||||||
await this.editorUtils.replaceBlockByBlockName(
|
await this.editorUtils.replaceBlockByBlockName(
|
||||||
'core/query',
|
'core/query',
|
||||||
this.BLOCK_SLUG
|
this.BLOCK_SLUG
|
||||||
|
|
|
@ -87,12 +87,12 @@ const test = base.extend< { pageObject: ProductGalleryPage } >( {
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test.describe( `${ blockData.name }`, () => {
|
test.describe( `${ blockData.name }`, () => {
|
||||||
test.beforeEach( async ( { admin, editorUtils } ) => {
|
test.beforeEach( async ( { admin } ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
// eslint-disable-next-line playwright/no-skipped-test
|
||||||
|
|
|
@ -1,19 +1,14 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { EditorUtils } from '@woocommerce/e2e-utils';
|
|
||||||
import { Admin, Editor } from '@wordpress/e2e-test-utils-playwright';
|
import { Admin, Editor } from '@wordpress/e2e-test-utils-playwright';
|
||||||
|
|
||||||
export const addBlock = async (
|
export const addBlock = async ( admin: Admin, editor: Editor ) => {
|
||||||
admin: Admin,
|
|
||||||
editor: Editor,
|
|
||||||
editorUtils: EditorUtils
|
|
||||||
) => {
|
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//single-product`,
|
postId: `woocommerce/woocommerce//single-product`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
|
|
||||||
await editor.insertBlock( {
|
await editor.insertBlock( {
|
||||||
name: 'woocommerce/product-gallery',
|
name: 'woocommerce/product-gallery',
|
||||||
|
|
|
@ -31,12 +31,12 @@ const test = base.extend< { pageObject: ProductGalleryPage } >( {
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test.describe( `${ blockData.name }`, () => {
|
test.describe( `${ blockData.name }`, () => {
|
||||||
test.beforeEach( async ( { admin, editorUtils, editor } ) => {
|
test.beforeEach( async ( { admin, editor } ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editor.openDocumentSettingsSidebar();
|
await editor.openDocumentSettingsSidebar();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,12 @@ const test = base.extend< { pageObject: ProductGalleryPage } >( {
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test.describe( `${ blockData.name }`, () => {
|
test.describe( `${ blockData.name }`, () => {
|
||||||
test.beforeEach( async ( { admin, editorUtils, editor } ) => {
|
test.beforeEach( async ( { admin, editor } ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editor.openDocumentSettingsSidebar();
|
await editor.openDocumentSettingsSidebar();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,12 @@ const test = base.extend< { pageObject: ProductGalleryPage } >( {
|
||||||
},
|
},
|
||||||
} );
|
} );
|
||||||
test.describe( `${ blockData.name }`, () => {
|
test.describe( `${ blockData.name }`, () => {
|
||||||
test.beforeEach( async ( { admin, editorUtils } ) => {
|
test.beforeEach( async ( { admin } ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'Renders Product Gallery Thumbnails block on the editor and frontend side', async ( {
|
test( 'Renders Product Gallery Thumbnails block on the editor and frontend side', async ( {
|
||||||
|
|
|
@ -1,24 +1,17 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { EditorUtils } from '@woocommerce/e2e-utils';
|
|
||||||
import { Admin, Editor } from '@wordpress/e2e-test-utils-playwright';
|
import { Admin, Editor } from '@wordpress/e2e-test-utils-playwright';
|
||||||
|
|
||||||
// Define a utility function to add the "woocommerce/product-gallery" block to the editor
|
// Define a utility function to add the "woocommerce/product-gallery" block to the editor
|
||||||
export const addBlock = async (
|
export const addBlock = async ( admin: Admin, editor: Editor ) => {
|
||||||
admin: Admin,
|
|
||||||
editor: Editor,
|
|
||||||
editorUtils: EditorUtils
|
|
||||||
) => {
|
|
||||||
// Visit the site editor for the specific product page
|
// Visit the site editor for the specific product page
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//single-product`,
|
postId: `woocommerce/woocommerce//single-product`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Enter the edit mode
|
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
|
|
||||||
// Insert the "woocommerce/product-gallery" block
|
// Insert the "woocommerce/product-gallery" block
|
||||||
await editor.insertBlock( {
|
await editor.insertBlock( {
|
||||||
name: 'woocommerce/product-gallery',
|
name: 'woocommerce/product-gallery',
|
||||||
|
|
|
@ -83,12 +83,12 @@ const getThumbnailImageIdByNth = async (
|
||||||
};
|
};
|
||||||
|
|
||||||
test.describe( `${ blockData.name }`, () => {
|
test.describe( `${ blockData.name }`, () => {
|
||||||
test.beforeEach( async ( { admin, editorUtils } ) => {
|
test.beforeEach( async ( { admin } ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
postId: `woocommerce/woocommerce//${ blockData.slug }`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test.describe( 'with thumbnails', () => {
|
test.describe( 'with thumbnails', () => {
|
||||||
|
@ -532,8 +532,8 @@ test.describe( `${ blockData.name }`, () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//product-gallery`,
|
postId: `woocommerce/woocommerce//product-gallery`,
|
||||||
postType: 'wp_template_part',
|
postType: 'wp_template_part',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editorUtils.openGlobalBlockInserter();
|
await editorUtils.openGlobalBlockInserter();
|
||||||
await page.getByRole( 'tab', { name: 'Blocks' } ).click();
|
await page.getByRole( 'tab', { name: 'Blocks' } ).click();
|
||||||
const productGalleryBlockOption = page
|
const productGalleryBlockOption = page
|
||||||
|
|
|
@ -32,13 +32,12 @@ test.describe( `${ blockData.name } Block`, () => {
|
||||||
test( "can't be added in the Post Editor - Product Catalog Template", async ( {
|
test( "can't be added in the Post Editor - Product Catalog Template", async ( {
|
||||||
admin,
|
admin,
|
||||||
editor,
|
editor,
|
||||||
editorUtils,
|
|
||||||
} ) => {
|
} ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//archive-product`,
|
postId: `woocommerce/woocommerce//archive-product`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await editor.insertBlock( { name: blockData.slug } );
|
await editor.insertBlock( { name: blockData.slug } );
|
||||||
|
@ -55,8 +54,8 @@ test.describe( `${ blockData.name } Block`, () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `woocommerce/woocommerce//single-product`,
|
postId: `woocommerce/woocommerce//single-product`,
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
|
|
||||||
await editor.setContent( '' );
|
await editor.setContent( '' );
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,12 @@ test.describe( 'Test the cart template', async () => {
|
||||||
test( 'Template can be opened in the site editor', async ( {
|
test( 'Template can be opened in the site editor', async ( {
|
||||||
admin,
|
admin,
|
||||||
page,
|
page,
|
||||||
editorUtils,
|
|
||||||
} ) => {
|
} ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: templatePath,
|
postId: templatePath,
|
||||||
postType: templateType,
|
postType: templateType,
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
.frameLocator( 'iframe[title="Editor canvas"i]' )
|
.frameLocator( 'iframe[title="Editor canvas"i]' )
|
||||||
|
@ -37,7 +36,6 @@ test.describe( 'Test the cart template', async () => {
|
||||||
.getByRole( 'button', { name: 'Cart', exact: true } )
|
.getByRole( 'button', { name: 'Cart', exact: true } )
|
||||||
.click();
|
.click();
|
||||||
await editorUtils.enterEditMode();
|
await editorUtils.enterEditMode();
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
editor.canvas.locator( 'h1:has-text("Cart")' ).first()
|
editor.canvas.locator( 'h1:has-text("Cart")' ).first()
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
@ -66,14 +64,13 @@ test.describe( 'Test the cart template', async () => {
|
||||||
test.describe( 'Test editing the cart template', async () => {
|
test.describe( 'Test editing the cart template', async () => {
|
||||||
test( 'Merchant can transform shortcode block into blocks', async ( {
|
test( 'Merchant can transform shortcode block into blocks', async ( {
|
||||||
admin,
|
admin,
|
||||||
editorUtils,
|
|
||||||
editor,
|
editor,
|
||||||
} ) => {
|
} ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: templatePath,
|
postId: templatePath,
|
||||||
postType: templateType,
|
postType: templateType,
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editor.setContent(
|
await editor.setContent(
|
||||||
'<!-- wp:woocommerce/classic-shortcode {"shortcode":"cart"} /-->'
|
'<!-- wp:woocommerce/classic-shortcode {"shortcode":"cart"} /-->'
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,13 +11,12 @@ test.describe( 'Test the checkout template', async () => {
|
||||||
test( 'Template can be opened in the site editor', async ( {
|
test( 'Template can be opened in the site editor', async ( {
|
||||||
admin,
|
admin,
|
||||||
page,
|
page,
|
||||||
editorUtils,
|
|
||||||
} ) => {
|
} ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: templatePath,
|
postId: templatePath,
|
||||||
postType: templateType,
|
postType: templateType,
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
.frameLocator( 'iframe[title="Editor canvas"i]' )
|
.frameLocator( 'iframe[title="Editor canvas"i]' )
|
||||||
|
@ -75,14 +74,13 @@ test.describe( 'Test the checkout template', async () => {
|
||||||
test.describe( 'Test editing the checkout template', async () => {
|
test.describe( 'Test editing the checkout template', async () => {
|
||||||
test( 'Merchant can transform shortcode block into blocks', async ( {
|
test( 'Merchant can transform shortcode block into blocks', async ( {
|
||||||
admin,
|
admin,
|
||||||
editorUtils,
|
|
||||||
editor,
|
editor,
|
||||||
} ) => {
|
} ) => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: templatePath,
|
postId: templatePath,
|
||||||
postType: templateType,
|
postType: templateType,
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editor.setContent(
|
await editor.setContent(
|
||||||
'<!-- wp:woocommerce/classic-shortcode {"shortcode":"checkout"} /-->'
|
'<!-- wp:woocommerce/classic-shortcode {"shortcode":"checkout"} /-->'
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,8 +12,8 @@ test.describe( 'Test the order confirmation template', async () => {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: 'woocommerce/woocommerce//order-confirmation',
|
postId: 'woocommerce/woocommerce//order-confirmation',
|
||||||
postType: 'wp_template',
|
postType: 'wp_template',
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editorUtils.transformIntoBlocks();
|
await editorUtils.transformIntoBlocks();
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
|
|
|
@ -48,9 +48,8 @@ for ( const testData of testToRun ) {
|
||||||
await admin.visitSiteEditor( {
|
await admin.visitSiteEditor( {
|
||||||
postId: `${ BLOCK_THEME_WITH_TEMPLATES_SLUG }//${ testData.templatePath }`,
|
postId: `${ BLOCK_THEME_WITH_TEMPLATES_SLUG }//${ testData.templatePath }`,
|
||||||
postType: testData.templateType,
|
postType: testData.templateType,
|
||||||
|
canvas: 'edit',
|
||||||
} );
|
} );
|
||||||
await editorUtils.enterEditMode();
|
|
||||||
await editorUtils.waitForSiteEditorFinishLoading();
|
|
||||||
await editorUtils.editor.insertBlock( {
|
await editorUtils.editor.insertBlock( {
|
||||||
name: 'core/paragraph',
|
name: 'core/paragraph',
|
||||||
attributes: { content: userText },
|
attributes: { content: userText },
|
||||||
|
|
Loading…
Reference in New Issue