Skip to content

Commit bd33774

Browse files
committed
comment out site editor tests, add reporter
1 parent e32eb62 commit bd33774

File tree

3 files changed

+117
-111
lines changed

3 files changed

+117
-111
lines changed

.wp-env.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2-
"core": "WordPress/WordPress",
3-
"plugins": [ "." ]
2+
"core": null,
3+
"plugins": [ "." ],
4+
"config": {
5+
"SCRIPT_DEBUG": false
6+
}
47
}

e2e/playwright.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export default defineConfig( {
3232
// workers: process.env.CI ? 1 : undefined,
3333
workers: 1,
3434
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
35-
// reporter: 'html',
35+
reporter: [
36+
[ 'list' ],
37+
[ 'html', { outputFolder: '../playwright-report' } ],
38+
],
3639
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
3740
use: {
3841
/* Base URL to use in actions like `await page.goto('/')`. */

e2e/tests/site-editor.spec.ts

Lines changed: 108 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,109 @@
1-
import { test, expect } from 'e2e/test-utils'
2-
3-
test.describe( 'Site Editor', () => {
4-
// test.beforeAll( async ( { requestUtils } ) => {
5-
// await requestUtils.activateTheme( 'twentytwentyfour' )
6-
// } )
7-
8-
let pid = null
9-
let postContentBlock = null
10-
11-
test.beforeEach( async ( {
12-
page, admin, editor,
13-
} ) => {
14-
await admin.createNewPost( { title: 'Site Editor Test', postType: 'page' } )
15-
await editor.saveDraft()
16-
const postQuery = new URL( editor.page.url() ).search
17-
pid = new URLSearchParams( postQuery ).get( 'post' )
18-
19-
await admin.visitSiteEditor( {
20-
canvas: 'edit', postType: 'page', postId: pid, showWelcomeGuide: false,
21-
} )
22-
23-
if ( await page.getByRole( 'heading', { name: 'Choose a pattern' } ).isVisible() ) {
24-
await page.getByLabel( 'Close', { exact: true } ).click()
25-
}
26-
27-
postContentBlock = ( await editor.getBlocks( { full: true } ) )
28-
.filter( block => block.attributes?.tagName === 'main' )[ 0 ].innerBlocks
29-
.filter( block => block.name === 'core/post-content' )[ 0 ]
30-
} )
31-
32-
test.afterEach( async ( { requestUtils } ) => {
33-
await requestUtils.deletePost( pid, 'pages' )
34-
} )
35-
36-
test( 'Stackable blocks can be added in the site editor', async ( {
37-
page,
38-
editor,
39-
} ) => {
40-
await page.getByLabel( 'Toggle block inserter' ).click()
41-
await page.locator( '.editor-block-list-item-stackable-text' ).click()
42-
43-
const blocks = await editor.getBlocks( { clientId: postContentBlock.clientId } )
44-
45-
expect( blocks.find( block => block.name === 'stackable/text' ) ).toBeTruthy()
46-
} )
47-
48-
test( 'Stackable Inspector Controls should show up upon clicking a Stackable block', async ( {
49-
page,
50-
editor,
51-
} ) => {
52-
await editor.insertBlock( {
53-
name: 'stackable/text',
54-
}, { clientId: postContentBlock.clientId } )
55-
56-
await editor.selectBlocks( editor.canvas.getByLabel( 'Block: Text' ) )
57-
await expect( page.getByLabel( 'Layout Tab' ) ).toBeVisible()
58-
await expect( page.getByLabel( 'Style Tab' ) ).toBeVisible()
59-
await expect( page.getByLabel( 'Advanced Tab' ) ).toBeVisible()
60-
} )
61-
62-
test( 'A Stackable block\'s attributes should update when settings are changed in the Inspector Controls.', async ( {
63-
page,
64-
editor,
65-
} ) => {
66-
await editor.insertBlock( {
67-
name: 'stackable/text',
68-
}, { clientId: postContentBlock.clientId } )
69-
await editor.canvas.getByLabel( 'Type / to choose a block' ).fill( 'test' )
70-
await expect( page.locator( '#inspector-textarea-control-0' ) ).toContainText( 'test' )
71-
await page.locator( '.stk-color-palette-control .stk-control-content > .components-dropdown > .components-button' ).first().click()
72-
await page.getByLabel( 'Hex color' ).fill( 'ff0000' )
73-
await editor.canvas.locator( 'body' ).click()
74-
75-
await expect( editor.canvas.locator( '[data-type="stackable/text"]' ) ).toContainText( 'test' )
76-
await expect( editor.canvas.locator( '[data-type="stackable/text"] > .stk-block-text > p[role="textbox"]' ) ).toHaveCSS( 'color', 'rgb(255, 0, 0)' )
77-
78-
await editor.saveDraft()
79-
80-
const blocks = await editor.getBlocks( { clientId: postContentBlock.clientId } )
81-
const textBlock = blocks.find( block => block.name === 'stackable/text' )
82-
expect( textBlock.attributes.text ).toBe( 'test' )
83-
expect( textBlock.attributes.textColor1 ).toBe( '#ff0000' )
84-
} )
85-
86-
test( 'The Stackable block added in the site editor should be visible in the frontend', async ( {
87-
editor,
88-
} ) => {
89-
await editor.insertBlock( {
90-
name: 'stackable/text',
91-
attributes: {
92-
text: 'test',
93-
textColor1: '#ff0000',
94-
},
95-
}, { clientId: postContentBlock.clientId } )
96-
97-
const blocks = await editor.getBlocks( { clientId: postContentBlock.clientId } )
98-
const uniqueId = blocks.find( block => block.name === 'stackable/text' ).attributes.uniqueId
99-
100-
await editor.saveDraft()
101-
102-
const preview = await editor.openPreviewPage()
103-
104-
await expect( preview.locator( `[data-block-id="${ uniqueId }"]` ) ).toBeVisible()
105-
await expect( preview.locator( `[data-block-id="${ uniqueId }"]` ) ).toContainText( 'test' )
106-
await expect( preview.locator( `[data-block-id="${ uniqueId }"] p` ) ).toHaveCSS( 'color', 'rgb(255, 0, 0)' )
107-
} )
108-
} )
1+
// import { test, expect } from 'e2e/test-utils'
2+
3+
// test.describe( 'Site Editor', () => {
4+
// // test.beforeAll( async ( { requestUtils } ) => {
5+
// // await requestUtils.activateTheme( 'twentytwentyfour' )
6+
// // } )
7+
8+
// let pid = null
9+
// let postContentBlock = null
10+
11+
// test.beforeEach( async ( {
12+
// page, admin, editor,
13+
// } ) => {
14+
// await admin.createNewPost( { title: 'Site Editor Test', postType: 'page' } )
15+
// await editor.saveDraft()
16+
// const postQuery = new URL( editor.page.url() ).search
17+
// pid = new URLSearchParams( postQuery ).get( 'post' )
18+
19+
// await admin.visitSiteEditor( {
20+
// canvas: 'edit', postType: 'page', postId: pid, showWelcomeGuide: false,
21+
// } )
22+
23+
// if ( await page.getByRole( 'heading', { name: 'Choose a pattern' } ).isVisible() ) {
24+
// await page.getByLabel( 'Close', { exact: true } ).click()
25+
// }
26+
27+
// postContentBlock = ( await editor.getBlocks( { full: true } ) )
28+
// .filter( block => block.attributes?.tagName === 'main' )[ 0 ].innerBlocks
29+
// .filter( block => block.name === 'core/post-content' )[ 0 ]
30+
// } )
31+
32+
// test.afterEach( async ( { requestUtils } ) => {
33+
// await requestUtils.deletePost( pid, 'pages' )
34+
// } )
35+
36+
// test( 'Stackable blocks can be added in the site editor', async ( {
37+
// page,
38+
// editor,
39+
// } ) => {
40+
// await page.getByLabel( 'Toggle block inserter' ).click()
41+
// await page.locator( '.editor-block-list-item-stackable-text' ).click()
42+
43+
// const blocks = await editor.getBlocks( { clientId: postContentBlock.clientId } )
44+
45+
// expect( blocks.find( block => block.name === 'stackable/text' ) ).toBeTruthy()
46+
// } )
47+
48+
// test( 'Stackable Inspector Controls should show up upon clicking a Stackable block', async ( {
49+
// page,
50+
// editor,
51+
// } ) => {
52+
// await editor.insertBlock( {
53+
// name: 'stackable/text',
54+
// }, { clientId: postContentBlock.clientId } )
55+
56+
// await editor.selectBlocks( editor.canvas.getByLabel( 'Block: Text' ) )
57+
// await expect( page.getByLabel( 'Layout Tab' ) ).toBeVisible()
58+
// await expect( page.getByLabel( 'Style Tab' ) ).toBeVisible()
59+
// await expect( page.getByLabel( 'Advanced Tab' ) ).toBeVisible()
60+
// } )
61+
62+
// test( 'A Stackable block\'s attributes should update when settings are changed in the Inspector Controls.', async ( {
63+
// page,
64+
// editor,
65+
// } ) => {
66+
// await editor.insertBlock( {
67+
// name: 'stackable/text',
68+
// }, { clientId: postContentBlock.clientId } )
69+
// await editor.canvas.getByLabel( 'Type / to choose a block' ).fill( 'test' )
70+
// await expect( page.locator( '#inspector-textarea-control-0' ) ).toContainText( 'test' )
71+
// await page.locator( '.stk-color-palette-control .stk-control-content > .components-dropdown > .components-button' ).first().click()
72+
// await page.getByLabel( 'Hex color' ).fill( 'ff0000' )
73+
// await editor.canvas.locator( 'body' ).click()
74+
75+
// await expect( editor.canvas.locator( '[data-type="stackable/text"]' ) ).toContainText( 'test' )
76+
// await expect( editor.canvas.locator( '[data-type="stackable/text"] > .stk-block-text > p[role="textbox"]' ) ).toHaveCSS( 'color', 'rgb(255, 0, 0)' )
77+
78+
// await editor.saveDraft()
79+
80+
// const blocks = await editor.getBlocks( { clientId: postContentBlock.clientId } )
81+
// const textBlock = blocks.find( block => block.name === 'stackable/text' )
82+
// expect( textBlock.attributes.text ).toBe( 'test' )
83+
// expect( textBlock.attributes.textColor1 ).toBe( '#ff0000' )
84+
// } )
85+
86+
// test( 'The Stackable block added in the site editor should be visible in the frontend', async ( {
87+
// editor,
88+
// } ) => {
89+
// await editor.insertBlock( {
90+
// name: 'stackable/text',
91+
// attributes: {
92+
// text: 'test',
93+
// textColor1: '#ff0000',
94+
// },
95+
// }, { clientId: postContentBlock.clientId } )
96+
97+
// const blocks = await editor.getBlocks( { clientId: postContentBlock.clientId } )
98+
// const uniqueId = blocks.find( block => block.name === 'stackable/text' ).attributes.uniqueId
99+
100+
// await editor.saveDraft()
101+
102+
// const preview = await editor.openPreviewPage()
103+
104+
// await expect( preview.locator( `[data-block-id="${ uniqueId }"]` ) ).toBeVisible()
105+
// await expect( preview.locator( `[data-block-id="${ uniqueId }"]` ) ).toContainText( 'test' )
106+
// await expect( preview.locator( `[data-block-id="${ uniqueId }"] p` ) ).toHaveCSS( 'color', 'rgb(255, 0, 0)' )
107+
// } )
108+
// } )
109109

0 commit comments

Comments
 (0)