From 73cef534b029ea93f5fcdd5cf4e9100aa8529e03 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Wed, 9 Nov 2022 21:13:44 +0530 Subject: [PATCH] fix(test): Appstore will automatically remove a plugin if the plugin required to install is already installed and then will install it --- .../pages/Dashboard/Settings/AppStore.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/nc-gui/tests/playwright/pages/Dashboard/Settings/AppStore.ts b/packages/nc-gui/tests/playwright/pages/Dashboard/Settings/AppStore.ts index 1b66a28634..7670f3c799 100644 --- a/packages/nc-gui/tests/playwright/pages/Dashboard/Settings/AppStore.ts +++ b/packages/nc-gui/tests/playwright/pages/Dashboard/Settings/AppStore.ts @@ -17,6 +17,21 @@ export class AppStoreSettingsPage extends BasePage { async install({ name }: { name: string }) { const card = await this.settings.get().locator(`.nc-app-store-card-${name}`); await card.click(); + + // todo: Hack to solve the issue when if the test installing a plugin fails, the next test will fail because the plugin is already installed + let appAlreadyInstalled = true; + for (let i = 0; i < 5; i++) { + if (await card.locator('.nc-app-store-card-install').isVisible()) { + appAlreadyInstalled = false; + break; + } + await new Promise(resolve => setTimeout(resolve, 1000)); + } + + if (appAlreadyInstalled) { + await this.uninstall({ name }); + } + await card.locator('.nc-app-store-card-install').click(); }