PluginProbe
Extendify / 3.1.0
Extendify v3.1.0
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / tests / playwright / HelpCenter / page-editor.spec.ts

page-editor.spec.ts in Extendify 3.1.0, at tests/playwright/HelpCenter/page-editor.spec.ts

51 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { expect, test } from '../fixtures';
2
3 const categoriesStub = [
4 { id: 8, slug: 'hero', name: 'Hero' },
5 { id: 6, slug: 'content', name: 'Content' },
6 ];
7
8 const patternsStub = [
9 {
10 id: '1-stub-hero',
11 slug: 'stub-hero',
12 name: 'Stub Hero',
13 code: '<!-- wp:paragraph --><p>Stub pattern</p><!-- /wp:paragraph -->',
14 categories: ['hero'],
15 },
16 ];
17
18 test.beforeEach(async ({ page, requestUtils }) => {
19 await requestUtils.login();
20
21 await page.route(/\/api\/categories/, (route) =>
22 route.fulfill({ status: 200, json: categoriesStub }),
23 );
24 await page.route(/\/api\/patterns/, (route) =>
25 route.fulfill({ status: 200, json: patternsStub }),
26 );
27 });
28
29 test('Help Center editor-page button opens the modal after closing Library', async ({
30 admin,
31 page,
32 }) => {
33 await admin.visitAdminPage('post-new.php', 'post_type=page');
34
35 // Library auto-opens on the page editor (default openOnNewPage when a
36 // partner-id is set and disableLibraryAutoOpen is not).
37 const libraryModal = page.locator('.extendify-library-modal');
38 await expect(libraryModal).toBeVisible({ timeout: 15_000 });
39
40 await page.getByTestId('modal-close-button').click();
41 await expect(libraryModal).toHaveCount(0);
42
43 const hcButton = page.getByTestId('help-center-editor-page-button');
44 await expect(hcButton).toBeVisible();
45 await hcButton.click();
46
47 // `toBeAttached()` matches the HC convention — sidesteps the
48 // framer-motion initial-opacity issue on the Dialog wrapper.
49 await expect(page.getByTestId('help-center-modal')).toBeAttached();
50 });
51