diff --git a/.github/workflows/recipe-catalog-change-template.yaml b/.github/workflows/recipe-catalog-change-template.yaml index 733c41fa9..9a236a0d7 100644 --- a/.github/workflows/recipe-catalog-change-template.yaml +++ b/.github/workflows/recipe-catalog-change-template.yaml @@ -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" diff --git a/.github/workflows/recipe-catalog-change-trigger.yaml b/.github/workflows/recipe-catalog-change-trigger.yaml index 61e3559e7..fb963949e 100644 --- a/.github/workflows/recipe-catalog-change-trigger.yaml +++ b/.github/workflows/recipe-catalog-change-trigger.yaml @@ -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 diff --git a/tests/playwright/src/ai-lab-extension.spec.ts b/tests/playwright/src/ai-lab-extension.spec.ts index a7f5ba104..78cc2395e 100644 --- a/tests/playwright/src/ai-lab-extension.spec.ts +++ b/tests/playwright/src/ai-lab-extension.spec.ts @@ -36,6 +36,7 @@ import { getExtensionCard, getExtensionVersion, openAILabExtensionDetails, + openAILabPreferences, reopenAILabDashboard, waitForExtensionToInitialize, } from './utils/aiLabHandler'; @@ -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; diff --git a/tests/playwright/src/model/ai-lab-base-page.ts b/tests/playwright/src/model/ai-lab-base-page.ts index 2f3925ee5..5c10e7e4f 100644 --- a/tests/playwright/src/model/ai-lab-base-page.ts +++ b/tests/playwright/src/model/ai-lab-base-page.ts @@ -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; + + async enableGpuSupport(): Promise { + await playExpect(this.gpuSupportBanner).toBeVisible(); + await this.enableGpuButton.click(); + await playExpect(this.gpuSupportBanner).not.toBeVisible(); + } } diff --git a/tests/playwright/src/model/preferences-extension-ai-lab-page.ts b/tests/playwright/src/model/preferences-extension-ai-lab-page.ts index b7d910696..f2b8125e9 100644 --- a/tests/playwright/src/model/preferences-extension-ai-lab-page.ts +++ b/tests/playwright/src/model/preferences-extension-ai-lab-page.ts @@ -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', });