From 0d7c1877747f7a4f64839bb60bff62ae9c71e309 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 26 Apr 2023 14:34:36 +0530 Subject: [PATCH] fix: close all tabs with waitFor --- tests/playwright/pages/Dashboard/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/playwright/pages/Dashboard/index.ts b/tests/playwright/pages/Dashboard/index.ts index 635ca8f546..31ff8a9fa7 100644 --- a/tests/playwright/pages/Dashboard/index.ts +++ b/tests/playwright/pages/Dashboard/index.ts @@ -214,12 +214,13 @@ export class DashboardPage extends BasePage { } async closeAllTabs() { + await this.tabBar.locator(`.ant-tabs-tab`).waitFor({ state: 'visible' }); const tab = await this.tabBar.locator(`.ant-tabs-tab`); const tabCount = await tab.count(); for (let i = 0; i < tabCount; i++) { await tab.nth(i).locator('button.ant-tabs-tab-remove').click(); - await this.rootPage.waitForTimeout(200); + await tab.nth(i).waitFor({ state: 'detached' }); } } }