Skip to content

Commit

Permalink
chore(test): renaming test file to be in sync with bootc, fixing exte…
Browse files Browse the repository at this point in the history
…nsion installation

Signed-off-by: Tibor Dancs <[email protected]>

chore(fixup): addressing vladimir lazar review comment

Signed-off-by: Tibor Dancs <[email protected]>
  • Loading branch information
ScrewTSW committed Jun 4, 2024
1 parent 8d06aef commit 21516d9
Showing 1 changed file with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,30 @@
import type { Locator, Page } from '@playwright/test';
import { expect as playExpect } from '@playwright/test';
import { afterAll, beforeAll, beforeEach, describe, test } from 'vitest';
import type { DashboardPage, SettingsBar, RunnerTestContext } from '@podman-desktop/tests-playwright';
import type { DashboardPage, ExtensionsPage, RunnerTestContext } from '@podman-desktop/tests-playwright';
import {
NavigationBar,
SettingsExtensionsPage,
WelcomePage,
PodmanDesktopRunner,
removeFolderIfExists,

Check failure on line 27 in tests/playwright/src/ai-lab-extension.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

'removeFolderIfExists' is defined but never used

Check failure on line 27 in tests/playwright/src/ai-lab-extension.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

'removeFolderIfExists' is defined but never used

Check failure on line 27 in tests/playwright/src/ai-lab-extension.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

'removeFolderIfExists' is defined but never used
} from '@podman-desktop/tests-playwright';

const AI_LAB_EXTENSION_OCI_IMAGE: string = 'ghcr.io/containers/podman-desktop-extension-ai-lab:nightly';
const AI_LAB_CATALOG_EXTENSION_LABEL: string = 'redhat.ai-lab';
const AI_LAB_NAVBAR_EXTENSION_LABEL: string = 'AI Lab';
const AI_LAB_PAGE_BODY_LABEL: string = 'Webview AI Lab';

let pdRunner: PodmanDesktopRunner;
let page: Page;

let navigationBar: NavigationBar;
let dashboardPage: DashboardPage;
let settingsBar: SettingsBar;
let extensionsPage: SettingsExtensionsPage;
let extensionsPage: ExtensionsPage;

beforeAll(async () => {
pdRunner = new PodmanDesktopRunner();
pdRunner = new PodmanDesktopRunner({ customFolder: 'ai-lab-tests-pd', autoUpdate: false, autoCheckUpdate: false });
page = await pdRunner.start();
pdRunner.setVideoAndTraceName('podman-desktop-extension-ai-lab-installation');
pdRunner.setVideoAndTraceName('ai-lab-e2e');

await new WelcomePage(page).handleWelcomePage(true);
navigationBar = new NavigationBar(page);
Expand All @@ -59,31 +61,24 @@ describe(`AI Lab extension installation and verification`, async () => {
test(`Open Settings -> Extensions page`, async () => {
dashboardPage = await navigationBar.openDashboard();
await playExpect(dashboardPage.mainPage).toBeVisible();
settingsBar = await navigationBar.openSettings();
await playExpect(settingsBar.extensionsTab).toBeVisible();
await settingsBar.extensionsTab.click();
extensionsPage = new SettingsExtensionsPage(page);
await playExpect(extensionsPage.imageInstallBox).toBeVisible();
extensionsPage = await navigationBar.openExtensions();
await playExpect(extensionsPage.header).toBeVisible();
});
test(`Install AI Lab extension`, async () => {
await extensionsPage.installExtensionFromOCIImage(AI_LAB_EXTENSION_OCI_IMAGE);
});
test(`Verify AI Lab extension in extension list`, async () => {
const aiStudioExtension: Locator = extensionsPage.installedExtensions.getByLabel('ai-lab');
await playExpect(aiStudioExtension).toBeVisible({ timeout: 60_000 });
await playExpect(aiStudioExtension.getByLabel('Extension Status Label')).toHaveText('ACTIVE', {
timeout: 10_000,
});
await playExpect
.poll(async () => await extensionsPage.extensionIsInstalled(AI_LAB_CATALOG_EXTENSION_LABEL), { timeout: 30000 })
.toBeTruthy();
});
});
describe(`AI Lab extension verification`, async () => {
test(`Verify AI Lab is present in notification bar and open it`, async () => {
const aiLabNavBarItem: Locator = navigationBar.navigationLocator.getByLabel('AI Lab');
const aiLabNavBarItem: Locator = navigationBar.navigationLocator.getByLabel(AI_LAB_NAVBAR_EXTENSION_LABEL);
await playExpect(aiLabNavBarItem).toBeVisible();
await aiLabNavBarItem.click();
});
test(`Verify AI Lab is running`, async () => {
const aiLabWebview: Locator = page.getByLabel('Webview AI Lab');
const aiLabWebview: Locator = page.getByLabel(AI_LAB_PAGE_BODY_LABEL);
await playExpect(aiLabWebview).toBeVisible();
});
});
Expand Down

0 comments on commit 21516d9

Please sign in to comment.