Skip to content

Commit 2fddd4f

Browse files
authored
Internal: Reduce flakiness of daily test for hello theme [ED-22821] (#624)
1 parent ba94916 commit 2fddd4f

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

modules/admin-home/rest/admin-config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ private function get_elementor_editor_url( ?int $page_id, string $active_tab ):
8686
'post' => $page_id,
8787
'action' => 'elementor',
8888
'active-tab' => $active_tab,
89+
'active-document' => $active_kit_id,
8990
],
9091
admin_url( 'post.php' )
9192
);

tests/playwright/tests/admin/hello-theme-admin-home.test.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,45 +34,47 @@ test.describe( 'Hello Theme Admin Home Page', () => {
3434
const quickLinksTests = [
3535
{
3636
linkText: 'Site Name',
37-
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=settings-site-identity/,
37+
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=settings-site-identity.*active-document=\d+/,
3838
expectedPageSection: '.elementor-control-section_settings-site-identity',
3939
},
4040
{
4141
linkText: 'Site Logo',
42-
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=settings-site-identity/,
42+
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=settings-site-identity.*active-document=\d+/,
4343
expectedPageSection: '.elementor-control-section_settings-site-identity',
4444
},
4545
{
4646
linkText: 'Site Favicon',
47-
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=settings-site-identity/,
47+
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=settings-site-identity.*active-document=\d+/,
4848
expectedPageSection: '.elementor-control-section_settings-site-identity',
4949
},
5050
{
5151
linkText: 'Site Colors',
52-
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=global-colors/,
52+
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=global-colors.*active-document=\d+/,
5353
expectedPageSection: '.elementor-control-section_global_colors',
5454
},
5555
{
5656
linkText: 'Site Fonts',
57-
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=global-typography/,
57+
expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=global-typography.*active-document=\d+/,
5858
expectedPageSection: '.elementor-control-section_text_style',
5959
},
6060
];
61-
for ( const linkTest of quickLinksTests ) {
62-
await page.goto( '/wp-admin/admin.php?page=hello-elementor' );
63-
const linkElement = page.locator( `h6:has-text("${ linkTest.linkText }") a` );
64-
await expect( linkElement ).toBeVisible();
6561

66-
await Promise.all( [
67-
page.waitForURL( linkTest.expectedUrlPattern ),
68-
linkElement.click(),
69-
] );
62+
for ( const linkTest of quickLinksTests ) {
63+
await test.step( linkTest.linkText, async () => {
64+
await page.goto( '/wp-admin/admin.php?page=hello-elementor' );
65+
const linkElement = page.locator( `h6:has-text("${ linkTest.linkText }") a` );
66+
await expect( linkElement ).toBeVisible();
7067

71-
expect( page.url() ).toMatch( linkTest.expectedUrlPattern );
68+
await Promise.all( [
69+
page.waitForURL( linkTest.expectedUrlPattern ),
70+
linkElement.click(),
71+
] );
7272

73-
await page.waitForSelector( '#elementor-kit-panel' );
74-
const location = page.locator( linkTest.expectedPageSection );
75-
await expect( location ).toBeVisible();
73+
expect( page.url() ).toMatch( linkTest.expectedUrlPattern );
74+
await page.waitForSelector( '#elementor-kit-panel' );
75+
const location = page.locator( linkTest.expectedPageSection );
76+
await expect( location ).toBeVisible();
77+
} );
7678
}
7779
} );
7880
} );

0 commit comments

Comments
 (0)