Skip to content

Commit 6279764

Browse files
committed
Update e2e-test for query block pattern selection.
1 parent 19b93a8 commit 6279764

File tree

1 file changed

+10
-54
lines changed

1 file changed

+10
-54
lines changed

packages/e2e-tests/specs/editor/blocks/query.test.js

Lines changed: 10 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe( 'Query block', () => {
3131
await trashAllPosts( 'page' );
3232
} );
3333
describe( 'Query block insertion', () => {
34-
it( 'Carousel', async () => {
34+
it( 'List', async () => {
3535
await insertBlock( 'Query' );
3636
// Wait for the choose pattern button
3737
const choosePatternButton = await page.waitForSelector(
@@ -40,64 +40,20 @@ describe( 'Query block', () => {
4040
await choosePatternButton.click();
4141
// Wait for pattern blocks to be loaded.
4242
await page.waitForSelector(
43-
'.block-editor-block-pattern-setup__container iframe[title="Editor canvas"]'
43+
'.block-library-query-pattern__selection-content iframe[title="Editor canvas"]'
4444
);
45-
/**
46-
* Ensure that carousel is working by checking slider css classes
47-
* and navigating to the next pattern.
48-
*/
49-
await page.waitForSelector(
50-
'li.pattern-slide.active-slide[aria-label="Query Test 1"]'
51-
);
52-
const nextPatternButton = await page.waitForSelector(
53-
'.block-editor-block-pattern-setup__navigation button[aria-label="Next pattern"]'
54-
);
55-
await nextPatternButton.click();
56-
await page.waitForSelector(
57-
'li.pattern-slide.active-slide[aria-label="Query Test 2"]'
45+
// Choose the standard pattern.
46+
const chosenPattern = await page.waitForSelector(
47+
'.block-editor-block-patterns-list__item[aria-label="Standard"]'
5848
);
59-
// Choose the selected pattern.
60-
const chooseButton = await page.waitForXPath(
61-
'//div[contains(@class, "block-editor-block-pattern-setup__actions")]//button[text()="Choose"]'
62-
);
63-
chooseButton.click();
49+
chosenPattern.click();
6450
// Wait for pattern setup to go away.
65-
await page.waitForSelector( '.block-editor-block-pattern-setup', {
66-
hidden: true,
67-
} );
68-
/**
69-
* We can't use `getEditedPostContent` easily for now because
70-
* `query` makes used of `instanceId` so it's not very reliable.
71-
* This should be revisited.
72-
*/
73-
await page.waitForSelector( '.wp-block-post-date' );
74-
await page.waitForSelector( '.wp-block-post-title' );
75-
} );
76-
it( 'Grid view', async () => {
77-
await insertBlock( 'Query' );
78-
// Wait for the choose pattern button
79-
const choosePatternButton = await page.waitForSelector(
80-
'div[data-type="core/query"] button.is-primary'
81-
);
82-
await choosePatternButton.click();
83-
// Wait for patterns setup to be loaded.
8451
await page.waitForSelector(
85-
'.block-editor-block-pattern-setup__display-controls'
52+
'.block-library-query-pattern__selection-content',
53+
{
54+
hidden: true,
55+
}
8656
);
87-
// Click the Grid view button.
88-
const gridViewButton = await page.waitForSelector(
89-
'.block-editor-block-pattern-setup__display-controls button[aria-label="Grid view"]'
90-
);
91-
await gridViewButton.click();
92-
// Wait for patterns to be loaded and click the wanted pattern.
93-
const gridPattern = await page.waitForSelector(
94-
'.block-editor-block-pattern-setup-list__list-item[aria-label="Query Test 2"]'
95-
);
96-
await gridPattern.click();
97-
// Wait for pattern setup to go away.
98-
await page.waitForSelector( '.block-editor-block-pattern-setup', {
99-
hidden: true,
100-
} );
10157
/**
10258
* We can't use `getEditedPostContent` easily for now because
10359
* `query` makes used of `instanceId` so it's not very reliable.

0 commit comments

Comments
 (0)