Skip to content

Commit

Permalink
chore(tests): add check for settings/preferences assets
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Villanueva <[email protected]>

chore(tests): putting test.fail() properly

Signed-off-by: Daniel Villanueva <[email protected]>

chore(tests): fixes on the assertions

Signed-off-by: Daniel Villanueva <[email protected]>

chore(tests): missing awaits

Signed-off-by: Daniel Villanueva <[email protected]>

chore(tests): check tab existence differently

Signed-off-by: Daniel Villanueva <[email protected]>

chore(tests): check inside settings/preferences

Signed-off-by: Daniel Villanueva <[email protected]>

chore(tests): missing not fixed

Signed-off-by: Daniel Villanueva <[email protected]>
  • Loading branch information
danivilla9 committed Nov 11, 2024
1 parent a532ce1 commit 73cd962
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tests/src/openshift-local-extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 }) => {
Expand Down Expand Up @@ -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);
Expand All @@ -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 }) => {
Expand All @@ -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();
});
});

Expand Down

0 comments on commit 73cd962

Please sign in to comment.