From 73cd962c3cd4d3add4fba42b9b3b70d65513f31a Mon Sep 17 00:00:00 2001 From: Daniel Villanueva Date: Thu, 7 Nov 2024 13:12:38 +0100 Subject: [PATCH] chore(tests): add check for settings/preferences assets Signed-off-by: Daniel Villanueva chore(tests): putting test.fail() properly Signed-off-by: Daniel Villanueva chore(tests): fixes on the assertions Signed-off-by: Daniel Villanueva chore(tests): missing awaits Signed-off-by: Daniel Villanueva chore(tests): check tab existence differently Signed-off-by: Daniel Villanueva chore(tests): check inside settings/preferences Signed-off-by: Daniel Villanueva chore(tests): missing not fixed Signed-off-by: Daniel Villanueva --- tests/src/openshift-local-extension.spec.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/src/openshift-local-extension.spec.ts b/tests/src/openshift-local-extension.spec.ts index 5ed3fa7..a9610e3 100644 --- a/tests/src/openshift-local-extension.spec.ts +++ b/tests/src/openshift-local-extension.spec.ts @@ -17,13 +17,14 @@ ***********************************************************************/ import type { NavigationBar } from '@podman-desktop/tests-playwright'; -import { expect as playExpect, ExtensionCardPage, RunnerOptions, test, ResourceConnectionCardPage } from '@podman-desktop/tests-playwright'; +import { expect as playExpect, ExtensionCardPage, RunnerOptions, test, ResourceConnectionCardPage, PreferencesPage } from '@podman-desktop/tests-playwright'; import { OpenShiftLocalExtensionPage } from './model/pages/openshift-local-extension-page'; let extensionInstalled = false; let extensionCard: ExtensionCardPage; let resourcesPage: ResourceConnectionCardPage; +let preferencesPage: PreferencesPage; const imageName = 'ghcr.io/crc-org/crc-extension:latest'; const extensionLabelCrc = 'redhat.openshift-local'; const extensionLabelNameCrc = 'openshift-local'; @@ -42,6 +43,7 @@ test.beforeAll(async ({ runner, page, welcomePage }) => { await welcomePage.handleWelcomePage(true); extensionCard = new ExtensionCardPage(page, extensionLabelNameCrc, extensionLabelCrc); resourcesPage = new ResourceConnectionCardPage(page, 'crc'); + preferencesPage = new PreferencesPage(page); }); test.afterAll(async ({ runner }) => { @@ -112,7 +114,7 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => { }); test.describe.serial('Red Hat OpenShift Local extension handling', () => { - test('Extension can be disabled', async ({ navigationBar }) => { + test.fail('Extension can be disabled -- Preferences value should be removed after extension removal, but isn\'t, BUG #393', async ({ navigationBar }) => { const extensions = await navigationBar.openExtensions(); playExpect(await extensions.extensionIsInstalled(extensionLabelCrc)).toBeTruthy(); const extensionCard = await extensions.getInstalledExtension(extensionLabelNameCrc, extensionLabelCrc); @@ -123,8 +125,13 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => { const dashboard = await navigationBar.openDashboard(); await playExpect(dashboard.openshiftLocalProvider).toHaveCount(0); //checking settings/resources assets - await navigationBar.openSettings(); + const settingsBar = await navigationBar.openSettings(); await playExpect(resourcesPage.card).toHaveCount(0); + //checking settings/preferences assets + const preferencesTab = await preferencesPage.getTab(); + await preferencesTab.click(); + await playExpect(settingsBar.getSettingsNavBarTabLocator('Extension: Red Hat OpenShift Local')).not.toBeVisible(); //this step will fail + await playExpect(preferencesPage.getPage().getByRole('region', {name: 'Content'}).getByText('Extension: Red Hat OpenShift Local')).not.toBeVisible(); //this step will fail }); test('Extension can be re-enabled correctly', async ({ navigationBar }) => { @@ -139,8 +146,13 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => { await playExpect(dashboard.openshiftLocalProvider).toBeVisible(); await playExpect(dashboard.openshiftLocalStatusLabel).toHaveText(notInstalledExtensionStatus); // if locally, delete binary //checking settings/resources assets - await navigationBar.openSettings(); + const settingsBar = await navigationBar.openSettings(); await playExpect(resourcesPage.card).toBeVisible(); + //checking settings/preferences assets + const preferencesTab = await preferencesPage.getTab(); + await preferencesTab.click(); + await playExpect(settingsBar.getSettingsNavBarTabLocator('Extension: Red Hat OpenShift Local')).toBeVisible(); + await playExpect(preferencesPage.getPage().getByRole('region', {name: 'Content'}).getByText('Extension: Red Hat OpenShift Local')).toBeVisible(); }); });