Skip to content

Commit 046279f

Browse files
committed
Updated e2e tests with reset prompt
#1250
1 parent b00f9b9 commit 046279f

1 file changed

Lines changed: 31 additions & 3 deletions

File tree

tests/golden-layout.spec.ts

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,37 @@ test.describe('tests golden-layout operations', () => {
2626
});
2727

2828
test.afterAll(async () => {
29-
// reset layout
30-
await page.getByTestId('app-main-panels-button').click();
31-
await page.getByLabel('Reset Layout').click();
29+
/**
30+
* Open panels menu, reset layout, confirm or cancel "Reset Layout" prompt
31+
*/
32+
async function resetLayout(confirm: boolean) {
33+
await page.getByTestId('app-main-panels-button').click();
34+
await page.getByLabel('Reset Layout').click();
35+
36+
if (confirm) {
37+
await page
38+
.locator('.modal .btn-danger')
39+
.filter({ hasText: 'Reset' })
40+
.click();
41+
} else {
42+
await page
43+
.locator('[data-dismiss=modal]')
44+
.filter({ hasText: 'Cancel' })
45+
.click();
46+
}
47+
48+
await expect(page.locator('.modal')).toHaveCount(0);
49+
}
50+
51+
// Reset layout cancelled by user
52+
await resetLayout(false);
53+
54+
await expect(
55+
page.locator('.lm_tab').filter({ has: page.getByText('test-a') })
56+
).toHaveCount(1);
57+
58+
// Reset layout confirmed by user
59+
await resetLayout(true);
3260

3361
await expect(
3462
page.locator('.lm_tab').filter({ has: page.getByText('test-a') })

0 commit comments

Comments
 (0)