Skip to content

Commit

Permalink
Updated e2e tests with reset prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Sep 27, 2023
1 parent 7cfc79f commit ece22b4
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions tests/golden-layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,37 @@ test.describe('tests golden-layout operations', () => {
});

test.afterAll(async () => {
// reset layout
await page.getByTestId('app-main-panels-button').click();
await page.getByLabel('Reset Layout').click();
/**
* Open panels menu, reset layout, confirm or cancel "Reset Layout" prompt
*/
async function resetLayout(confirm: boolean) {
await page.getByTestId('app-main-panels-button').click();
await page.getByLabel('Reset Layout').click();

if (confirm) {
await page
.locator('.modal .btn-danger')
.filter({ hasText: 'Reset' })
.click();
} else {
await page
.locator('[data-dismiss=modal]')
.filter({ hasText: 'Cancel' })
.click();
}

await expect(page.locator('.modal')).toHaveCount(0);
}

// Reset layout cancelled by user
await resetLayout(false);

await expect(
page.locator('.lm_tab').filter({ has: page.getByText('test-a') })
).toHaveCount(1);

// Reset layout confirmed by user
await resetLayout(true);

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

0 comments on commit ece22b4

Please sign in to comment.