Skip to content

Commit

Permalink
chore(tests): check tab existence differently
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Villanueva <davillan@redhat.com>
  • Loading branch information
danivilla9 committed Nov 7, 2024
1 parent ca7b419 commit e0cce79
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/src/openshift-local-extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { OpenShiftLocalExtensionPage } from './model/pages/openshift-local-exten
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 @@ -126,11 +128,12 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => {
const settingsBar = await navigationBar.openSettings();
await playExpect(resourcesPage.card).toHaveCount(0);
//checking settings/preferences assets
const preferencesPage = await settingsBar.openTabPage(PreferencesPage);
//const preferencesPage = await settingsBar.openTabPage(PreferencesPage);
const preferencesTab = await preferencesPage.getTab();
await preferencesTab.click();
await playExpect(preferencesTab.getByLabel('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')).toBeVisible(); //this step will fail
//await playExpect(preferencesTab.getByLabel('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')).toBeVisible(); //this step will fail
await playExpect(settingsBar.getSettingsNavBarTabLocator('Extension: Red Hat OpenShift Local')).not.toBeVisible(); //this step will fail
});

test('Extension can be re-enabled correctly', async ({ navigationBar }) => {
Expand All @@ -148,11 +151,12 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => {
const settingsBar = await navigationBar.openSettings();
await playExpect(resourcesPage.card).toBeVisible();
//checking settings/preferences assets
const preferencesPage = await settingsBar.openTabPage(PreferencesPage);
//const preferencesPage = await settingsBar.openTabPage(PreferencesPage);
const preferencesTab = await preferencesPage.getTab();
await preferencesTab.click();
await playExpect(preferencesTab.getByLabel('Extension: Red Hat OpenShift Local')).toBeVisible();
await playExpect(preferencesPage.getPage().getByRole('region', {name: 'Content'}).getByText('Extension: Red Hat OpenShift Local')).toBeVisible();
//await playExpect(preferencesTab.getByLabel('Extension: Red Hat OpenShift Local')).toBeVisible();
//await playExpect(preferencesPage.getPage().getByRole('region', {name: 'Content'}).getByText('Extension: Red Hat OpenShift Local')).toBeVisible();
await playExpect(settingsBar.getSettingsNavBarTabLocator('Extension: Red Hat OpenShift Local')).toBeVisible();
});
});

Expand Down

0 comments on commit e0cce79

Please sign in to comment.