Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Investigate E2E CI caching issue (#11874)
Browse files Browse the repository at this point in the history
* Try env:restart instead of env:start

* Change env:restart to env:start again

* Try env:restart instead of env:start

* Change env:restart to env:start again

* Adjust heading level of cart and checkout template

* Replace button selector with label selector

* Try env:restart instead of env:start

* Change env:restart to env:start again

* Ensure to close welcome guide modal

* Adjust heading level of default template content

* Try env:restart instead of env:start

* Change env:restart to env:start again

* Try env:restart instead of env:start

* Change env:restart to env:start again

* Address existing TS issues

* View template in edit mode

* Keep certain tests skipped

* Fix broken tests after addressing TS issues
  • Loading branch information
nielslange authored Nov 28, 2023
1 parent 2f82680 commit 5634c76
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 22 deletions.
2 changes: 1 addition & 1 deletion assets/js/blocks/page-content-wrapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Edit = ( {
setAttributes: ( attrs: BlockAttributes ) => void;
} ) => {
const TEMPLATE: InnerBlockTemplate[] = [
[ 'core/post-title', { align: 'wide' } ],
[ 'core/post-title', { align: 'wide', level: 1 } ],
[ 'core/post-content', { align: 'wide' } ],
];

Expand Down
2 changes: 1 addition & 1 deletion src/Utils/BlockTemplateMigrationUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected static function get_default_template( $template_slug ) {
$default_template_content = '
<!-- wp:group {"layout":{"inherit":true,"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:woocommerce/page-content-wrapper {"page":"' . $template_slug . '"} -->
<!-- wp:post-title {"align":"wide"} /-->
<!-- wp:post-title {"align":"wide", "level":1} /-->
<!-- wp:post-content {"align":"wide"} /-->
<!-- /wp:woocommerce/page-content-wrapper --></div>
<!-- /wp:group -->
Expand Down
33 changes: 21 additions & 12 deletions tests/e2e/tests/templates/cart-template.block_theme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ test.describe( 'Test the cart template', async () => {
page,
editorUtils,
} ) => {
await admin.visitSiteEditor();
await page.getByRole( 'button', { name: /Templates/i } ).click();
await page.getByRole( 'button', { name: /Page: Cart/i } ).click();
await admin.visitSiteEditor( {
postId: templatePath,
postType: templateType,
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await expect(
page
.frameLocator( 'iframe[title="Editor canvas"i]' )
.locator( 'h2:has-text("Cart")' )
.locator( 'h1:has-text("Cart")' )
.first()
).toBeVisible();
} );
Expand All @@ -33,17 +35,22 @@ test.describe( 'Test the cart template', async () => {
page,
editorUtils,
} ) => {
await admin.visitSiteEditor();
await admin.visitSiteEditor( {
postId: templatePath,
postType: templateType,
} );
await editor.page.getByRole( 'button', { name: /Pages/i } ).click();
await editor.page.getByRole( 'button', { name: /Cart/i } ).click();
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await expect(
editor.canvas.locator( 'h2:has-text("Cart")' ).first()
editor.canvas.locator( 'h1:has-text("Cart")' ).first()
).toBeVisible();
await editor.openDocumentSettingsSidebar();
await page.getByLabel( 'Template options' ).click();
await page.getByRole( 'button', { name: 'Edit template' } ).click();
await expect(
editor.canvas.locator( 'h2:has-text("Cart")' ).first()
editor.canvas.locator( 'h1:has-text("Cart")' ).first()
).toBeVisible();
} );

Expand All @@ -53,7 +60,7 @@ test.describe( 'Test the cart template', async () => {
await expect(
admin.page
.frameLocator( 'iframe[title="Editor canvas"i]' )
.locator( 'h2:has-text("Cart")' )
.locator( 'h1:has-text("Cart")' )
.first()
).toBeVisible();
} );
Expand All @@ -69,12 +76,13 @@ test.describe( 'Test editing the cart template', async () => {
admin,
editorUtils,
editor,
page,
} ) => {
await admin.visitSiteEditor();
await page.getByRole( 'button', { name: /Templates/i } ).click();
await page.getByRole( 'button', { name: /Page: Checkout/i } ).click();
await admin.visitSiteEditor( {
postId: templatePath,
postType: templateType,
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await editor.setContent(
'<!-- wp:woocommerce/classic-shortcode {"shortcode":"cart"} /-->'
);
Expand All @@ -101,6 +109,7 @@ test.describe( 'Test editing the cart template', async () => {
postType: templateType,
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await editorUtils.editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: 'Hello World in the template' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ test.describe( 'Test the checkout header template part', async () => {
postType: templateType,
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await editorUtils.editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: 'Hello World in the header' },
Expand Down
25 changes: 17 additions & 8 deletions tests/e2e/tests/templates/checkout-template.block_theme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ test.describe( 'Test the checkout template', async () => {
page,
editorUtils,
} ) => {
await admin.visitSiteEditor();
await page.getByRole( 'button', { name: /Templates/i } ).click();
await page.getByRole( 'button', { name: /Page: Checkout/i } ).click();
await admin.visitSiteEditor( {
postId: templatePath,
postType: templateType,
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await expect(
page
.frameLocator( 'iframe[title="Editor canvas"i]' )
Expand All @@ -33,14 +35,19 @@ test.describe( 'Test the checkout template', async () => {
page,
editorUtils,
} ) => {
await admin.visitSiteEditor();
await admin.visitSiteEditor( {
postId: templatePath,
postType: templateType,
} );
await editor.page.getByRole( 'button', { name: /Pages/i } ).click();
await editor.page.getByRole( 'button', { name: /Checkout/i } ).click();
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await expect(
editor.canvas.locator( 'h1:has-text("Checkout")' ).first()
).toBeVisible();
await editor.openDocumentSettingsSidebar();
await page.getByLabel( 'Template options' ).click();
await page.getByRole( 'button', { name: 'Edit template' } ).click();
await expect(
editor.canvas.locator( 'h1:has-text("Checkout")' ).first()
Expand Down Expand Up @@ -69,12 +76,13 @@ test.describe( 'Test editing the checkout template', async () => {
admin,
editorUtils,
editor,
page,
} ) => {
await admin.visitSiteEditor();
await page.getByRole( 'button', { name: /Templates/i } ).click();
await page.getByRole( 'button', { name: /Page: Checkout/i } ).click();
await admin.visitSiteEditor( {
postId: templatePath,
postType: templateType,
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await editor.setContent(
'<!-- wp:woocommerce/classic-shortcode {"shortcode":"checkout"} /-->'
);
Expand All @@ -99,6 +107,7 @@ test.describe( 'Test editing the checkout template', async () => {
postType: templateType,
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await editorUtils.editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: 'Hello World in the template' },
Expand Down

0 comments on commit 5634c76

Please sign in to comment.