Skip to content

Commit

Permalink
chore(tests): add check for settings/preferences assets (#400)
Browse files Browse the repository at this point in the history
chore(tests): putting test.fail() properly



chore(tests): fixes on the assertions



chore(tests): missing awaits



chore(tests): check tab existence differently



chore(tests): check inside settings/preferences



chore(tests): missing not fixed



chore(tests): ondrej's feedback



chore(tests): removed redundant fail test case



chore(tests): fixing test not failing?



chore(tests): another test



chore(tests): removed the wrong step...



chore(tests): fixed linting issue

Signed-off-by: Daniel Villanueva <[email protected]>
  • Loading branch information
danivilla9 authored Nov 12, 2024
1 parent a532ce1 commit 7e7eced
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 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 @@ -114,7 +116,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 }) => {
const extensions = await navigationBar.openExtensions();
playExpect(await extensions.extensionIsInstalled(extensionLabelCrc)).toBeTruthy();
await playExpect.poll(async() => await extensions.extensionIsInstalled(extensionLabelCrc), { timeout: 30000 }).toBeTruthy();
const extensionCard = await extensions.getInstalledExtension(extensionLabelNameCrc, extensionLabelCrc);
await playExpect(extensionCard.status).toHaveText(activeExtensionStatus);
await extensionCard.disableExtension();
Expand All @@ -127,9 +129,16 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => {
await playExpect(resourcesPage.card).toHaveCount(0);
});

test.fail('Extension can be disabled -- Settings/Preferences navbar value should be removed after extension removal, but isn\'t, BUG #393', async () => {
//checking settings/preferences assets
const preferencesTab = await preferencesPage.getTab();
await preferencesTab.click();
await playExpect(preferencesPage.content.getByText('Extension: Red Hat OpenShift Local')).not.toBeVisible(); //this step will fail
});

test('Extension can be re-enabled correctly', async ({ navigationBar }) => {
const extensions = await navigationBar.openExtensions();
playExpect(await extensions.extensionIsInstalled(extensionLabelCrc)).toBeTruthy();
await playExpect.poll(async() => await extensions.extensionIsInstalled(extensionLabelCrc), { timeout: 30000 }).toBeTruthy();
const extensionCard = await extensions.getInstalledExtension(extensionLabelNameCrc, extensionLabelCrc);
await playExpect(extensionCard.status).toHaveText(disabledExtensionStatus);
await extensionCard.enableExtension();
Expand All @@ -139,8 +148,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 7e7eced

Please sign in to comment.