Skip to content

Commit

Permalink
fix(test): close notification before start
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Mar 27, 2023
1 parent 38fc459 commit 541592d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
8 changes: 1 addition & 7 deletions e2e-tests/fixtures.ts
Expand Up @@ -121,12 +121,6 @@ base.beforeEach(async () => {
await page.keyboard.press('Escape')
await page.keyboard.press('Escape')

/*
const locator = page.locator('.notification-close-button').first()
while (await locator.isVisible()) {
locator.click() // ignore error
}
*/
await expect(page.locator('.notification-close-button')).not.toBeVisible()

const rightSidebar = page.locator('.cp__right-sidebar-inner')
Expand Down Expand Up @@ -297,7 +291,7 @@ export let traceAll = function(){
test.beforeAll(async () => {
await context.tracing.startChunk();
})

test.afterAll(async () => {
await context.tracing.stopChunk({ path: getTracingFilePath() });
})
Expand Down
14 changes: 6 additions & 8 deletions e2e-tests/utils.ts
Expand Up @@ -143,15 +143,13 @@ export async function loadLocalGraph(page: Page, path: string): Promise<void> {

// If there is an error notification from a previous test graph being deleted,
// close it first so it doesn't cover up the UI
let locator = page.locator('.notification-close-button').first()
while (await locator?.isVisible()) {
try { // don't fail if unable to click (likely disappeared already)
await locator.click()
} catch (error) {}
await page.waitForTimeout(250)

expect(locator.isVisible()).resolves.toBe(false)
let n = await page.locator('.notification-close-button').count()
if (n > 1) {
await page.locator('button >> text="Clear all"').click()
} else if (n == 1) {
await page.locator('.notification-close-button').click()
}
await expect(page.locator('.notification-close-button').first()).not.toBeVisible({ timeout: 2000 })

console.log('Graph loaded for ' + path)
}
Expand Down

0 comments on commit 541592d

Please sign in to comment.