From 5d407ae54fabd6ffbb2d162f31ea4430171e5469 Mon Sep 17 00:00:00 2001 From: Christopher Mead Date: Thu, 19 Dec 2024 08:03:49 -0700 Subject: [PATCH] E2E test: minor flake fix (#5831) If trying to close all toasts, allow for case when toasts auto close before you get to them ### QA Notes Not doing a test run for just this --- test/automation/src/positron/positronPopups.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/automation/src/positron/positronPopups.ts b/test/automation/src/positron/positronPopups.ts index aead3626b14..3aa93e13911 100644 --- a/test/automation/src/positron/positronPopups.ts +++ b/test/automation/src/positron/positronPopups.ts @@ -107,8 +107,12 @@ export class PositronPopups { const count = await this.toastLocator.count(); this.code.logger.log(`Closing ${count} toasts`); for (let i = 0; i < count; i++) { - await this.toastLocator.nth(i).hover(); - await this.code.driver.page.locator(`${NOTIFICATION_TOAST} .codicon-notifications-clear`).nth(i).click(); + try { + await this.toastLocator.nth(i).hover(); + await this.code.driver.page.locator(`${NOTIFICATION_TOAST} .codicon-notifications-clear`).nth(i).click(); + } catch (error) { // toasts can auto close before we get to them + this.code.logger.log(`Failed to close toast ${i}`); + } } }