Skip to content

chore(test,ci): added option to enable GPU support and preferences verification #2887

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

Merged
merged 1 commit into from
May 28, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/recipe-catalog-change-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
DEFAULT_NPM_TARGET: 'test:e2e'
DEFAULT_ENV_VARS: 'TEST_PODMAN_MACHINE=true,ELECTRON_ENABLE_INSPECT=true'
DEFAULT_PODMAN_OPTIONS: 'INIT=1,START=1,ROOTFUL=1,NETWORKING=0'
DEFAULT_EXT_TESTS_OPTIONS: 'EXT_RUN_TESTS_FROM_EXTENSION=1,EXT_RUN_TESTS_AS_ADMIN=1'
DEFAULT_EXT_TESTS_OPTIONS: 'EXT_RUN_TESTS_FROM_EXTENSION=1,EXT_RUN_TESTS_AS_ADMIN=1,EXT_TEST_GPU_SUPPORT_ENABLED=0'
DEFAULT_EXT_REPO_OPTIONS: 'REPO=podman-desktop-extension-ai-lab,FORK=containers,BRANCH=main'
DEFAULT_PODMAN_VERSION: "${{ env.PD_PODMAN_VERSION || '5.3.2' }}"
DEFAULT_URL: "https://github.com/containers/podman/releases/download/v$DEFAULT_PODMAN_VERSION/podman-$DEFAULT_PODMAN_VERSION-setup.exe"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/recipe-catalog-change-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ jobs:
trigger-workflow-branch: ${{ needs.extract-context.outputs.fork-branch }}
trigger-workflow-commit-sha: ${{ needs.extract-context.outputs.commit-sha }}
trigger-workflow-base-repo: ${{ needs.extract-context.outputs.base-repo }}
ext_tests_options: 'EXT_RUN_TESTS_FROM_EXTENSION=1,EXT_RUN_TESTS_AS_ADMIN=0'
ext_tests_options: 'EXT_RUN_TESTS_FROM_EXTENSION=1,EXT_RUN_TESTS_AS_ADMIN=0,EXT_TEST_GPU_SUPPORT_ENABLED=0'
secrets: inherit
40 changes: 40 additions & 0 deletions tests/playwright/src/ai-lab-extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
getExtensionCard,
getExtensionVersion,
openAILabExtensionDetails,
openAILabPreferences,
reopenAILabDashboard,
waitForExtensionToInitialize,
} from './utils/aiLabHandler';
Expand Down Expand Up @@ -106,6 +107,45 @@ test.describe.serial(`AI Lab extension installation and verification`, () => {
});
});

test.describe.serial(`AI Lab extension GPU preferences`, { tag: '@smoke' }, () => {
test(`Verify GPU support banner is visible, preferences are disabled`, async ({ page, navigationBar }) => {
test.setTimeout(15_000);
await playExpect(aiLabPage.gpuSupportBanner).toBeVisible();
await playExpect(aiLabPage.enableGpuButton).toBeVisible();
await playExpect(aiLabPage.dontDisplayButton).toBeVisible();
const preferencesPage = await openAILabPreferences(navigationBar, page);
await preferencesPage.waitForLoad();
playExpect(await preferencesPage.isGPUPreferenceEnabled()).toBeFalsy();
});

test(`Enable GPU support and verify preferences`, async ({ runner, page, navigationBar }) => {
test.setTimeout(30_000);
aiLabPage = await reopenAILabDashboard(runner, page, navigationBar);
await aiLabPage.waitForLoad();
await aiLabPage.enableGpuSupport();
const preferencesPage = await openAILabPreferences(navigationBar, page);
await preferencesPage.waitForLoad();
playExpect(await preferencesPage.isGPUPreferenceEnabled()).toBeTruthy();
});

test.afterAll(
`Disable GPU support, return to AI Lab Dashboard and hide banner`,
async ({ runner, page, navigationBar }) => {
test.setTimeout(30_000);
const preferencesPage = await openAILabPreferences(navigationBar, page);
await preferencesPage.waitForLoad();
await preferencesPage.disableGPUPreference();
playExpect(await preferencesPage.isGPUPreferenceEnabled()).toBeFalsy();
aiLabPage = await reopenAILabDashboard(runner, page, navigationBar);
await playExpect(aiLabPage.gpuSupportBanner).toBeVisible();
await playExpect(aiLabPage.enableGpuButton).toBeVisible();
await playExpect(aiLabPage.dontDisplayButton).toBeVisible();
await aiLabPage.dontDisplayButton.click();
await playExpect(aiLabPage.gpuSupportBanner).toBeHidden();
},
);
});

test.describe.serial('AI Lab API endpoint e2e test', { tag: '@smoke' }, () => {
let localServerPort: string;
let extensionVersion: string | undefined;
Expand Down
13 changes: 13 additions & 0 deletions tests/playwright/src/model/ai-lab-base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,30 @@
***********************************************************************/

import type { Locator, Page } from '@playwright/test';
import { expect as playExpect } from '@playwright/test';

export abstract class AILabBasePage {
readonly page: Page;
readonly webview: Page;
readonly heading: Locator;
readonly gpuSupportBanner: Locator;
readonly enableGpuButton: Locator;
readonly dontDisplayButton: Locator;

constructor(page: Page, webview: Page, heading: string | undefined) {
this.page = page;
this.webview = webview;
this.heading = webview.getByRole('heading', { name: heading, exact: true }).first();
this.gpuSupportBanner = this.webview.getByLabel('GPU promotion banner');
this.enableGpuButton = this.gpuSupportBanner.getByRole('button', { name: 'Enable GPU support' });
this.dontDisplayButton = this.gpuSupportBanner.getByRole('button', { name: `Don't display anymore` });
}

abstract waitForLoad(): Promise<void>;

async enableGpuSupport(): Promise<void> {
await playExpect(this.gpuSupportBanner).toBeVisible();
await this.enableGpuButton.click();
await playExpect(this.gpuSupportBanner).not.toBeVisible();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ExtensionAILabPreferencesPage extends PreferencesPage {

constructor(page: Page) {
super(page);
this.heading = page.getByRole('heading', { name: ExtensionAILabPreferencesPage.tabName });
this.heading = this.content.getByText(ExtensionAILabPreferencesPage.tabName, { exact: true });
this.experimentalGPUCheckbox = this.content.getByRole('checkbox', {
name: 'Experimental GPU support for inference servers',
});
Expand Down
Loading