Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): add check for settings/preferences assets #400

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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