From 7d8b2bb58cbd21f2069992b52698f4c40ddd2327 Mon Sep 17 00:00:00 2001 From: Tibor Dancs Date: Mon, 26 Aug 2024 15:25:50 +0200 Subject: [PATCH 1/4] chore(test): parametrize deploy AI App method Signed-off-by: Tibor Dancs --- tests/playwright/src/ai-lab-extension.spec.ts | 2 +- tests/playwright/src/model/ai-lab-app-details-page.ts | 4 ++-- tests/playwright/src/model/ai-lab-start-recipe-page.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/playwright/src/ai-lab-extension.spec.ts b/tests/playwright/src/ai-lab-extension.spec.ts index f55c4cb52..e9dd8bc45 100644 --- a/tests/playwright/src/ai-lab-extension.spec.ts +++ b/tests/playwright/src/ai-lab-extension.spec.ts @@ -89,7 +89,7 @@ test.describe.serial(`AI Lab extension installation and verification`, () => { AI_LAB_AI_APP_NAME, ); await chatBotApp.waitForLoad(); - await chatBotApp.startNewDeployment(); + await chatBotApp.startNewDeployment(720_000); }); }); }); diff --git a/tests/playwright/src/model/ai-lab-app-details-page.ts b/tests/playwright/src/model/ai-lab-app-details-page.ts index 24099b578..7c6e1a81e 100644 --- a/tests/playwright/src/model/ai-lab-app-details-page.ts +++ b/tests/playwright/src/model/ai-lab-app-details-page.ts @@ -39,12 +39,12 @@ export class AILabAppDetailsPage extends AILabBasePage { throw new Error('Method Not implemented'); } - async startNewDeployment(): Promise { + async startNewDeployment(timeout: number = 720_000): Promise { await playExpect(this.startRecipeButton).toBeEnabled(); await this.startRecipeButton.click(); const starRecipePage: AILabStartRecipePage = new AILabStartRecipePage(this.page, this.webview); await starRecipePage.waitForLoad(); - await starRecipePage.startRecipe(); + await starRecipePage.startRecipe(timeout); } async openRunningApps(): Promise { diff --git a/tests/playwright/src/model/ai-lab-start-recipe-page.ts b/tests/playwright/src/model/ai-lab-start-recipe-page.ts index 31c7d2d9b..056dd785f 100644 --- a/tests/playwright/src/model/ai-lab-start-recipe-page.ts +++ b/tests/playwright/src/model/ai-lab-start-recipe-page.ts @@ -41,7 +41,7 @@ export class AILabStartRecipePage extends AILabBasePage { await playExpect(this.heading).toBeVisible(); } - async startRecipe(): Promise { + async startRecipe(timeout: number = 720_000): Promise { await playExpect(this.startRecipeButton).toBeEnabled(); await this.startRecipeButton.click(); try { @@ -49,6 +49,6 @@ export class AILabStartRecipePage extends AILabBasePage { } catch (error) { console.warn(`Warning: Could not reset the app, repository probably clean.\n\t${error}`); } - await playExpect(this.recipeStatus).toContainText('AI App is running', { timeout: 720_000 }); + await playExpect(this.recipeStatus).toContainText('AI App is running', { timeout: timeout }); } } From b4ecbb01813925162f842669bde66696c815f1df Mon Sep 17 00:00:00 2001 From: Tibor Dancs Date: Mon, 26 Aug 2024 15:46:27 +0200 Subject: [PATCH 2/4] chore(tests): wait for machine and take screenshot Signed-off-by: Tibor Dancs --- tests/playwright/src/ai-lab-extension.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/playwright/src/ai-lab-extension.spec.ts b/tests/playwright/src/ai-lab-extension.spec.ts index e9dd8bc45..9115555a1 100644 --- a/tests/playwright/src/ai-lab-extension.spec.ts +++ b/tests/playwright/src/ai-lab-extension.spec.ts @@ -18,7 +18,7 @@ import type { Page } from '@playwright/test'; import type { DashboardPage, ExtensionsPage, Runner } from '@podman-desktop/tests-playwright'; -import { NavigationBar, expect as playExpect, test, RunnerOptions } from '@podman-desktop/tests-playwright'; +import { NavigationBar, expect as playExpect, test, RunnerOptions, waitForPodmanMachineStartup } from '@podman-desktop/tests-playwright'; import { AILabPage } from './model/ai-lab-page'; import type { AILabRecipesCatalogPage } from './model/ai-lab-recipes-catalog-page'; import type { AILabAppDetailsPage } from './model/ai-lab-app-details-page'; @@ -48,6 +48,8 @@ test.beforeAll(async ({ runner, welcomePage, page }) => { await welcomePage.handleWelcomePage(true); navigationBar = new NavigationBar(page); + await waitForPodmanMachineStartup(page); + await runner.screenshot('ai-lab-tests-dashboard-podman-machine.png'); }); test.afterAll(async ({ runner }) => { From d6b1e544503e6bd639697cfebc2724cdc9549bfe Mon Sep 17 00:00:00 2001 From: Tibor Dancs Date: Thu, 29 Aug 2024 12:00:43 +0200 Subject: [PATCH 3/4] chore(test): testing with debug build of AI Lab Signed-off-by: Tibor Dancs --- tests/playwright/src/ai-lab-extension.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/playwright/src/ai-lab-extension.spec.ts b/tests/playwright/src/ai-lab-extension.spec.ts index 9115555a1..699824979 100644 --- a/tests/playwright/src/ai-lab-extension.spec.ts +++ b/tests/playwright/src/ai-lab-extension.spec.ts @@ -25,7 +25,7 @@ import type { AILabAppDetailsPage } from './model/ai-lab-app-details-page'; import * as os from 'node:os'; const AI_LAB_EXTENSION_OCI_IMAGE: string = - process.env.AI_LAB_OCI ?? 'ghcr.io/containers/podman-desktop-extension-ai-lab:nightly'; + process.env.AI_LAB_OCI ?? 'quay.io/rh-ee-astefani/demo-ai-lab:debug-wsl-upload-disabled-1725025190'; 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'; From fdb91fb67a7b7e17ebe4b77b1fca544a6fc545d1 Mon Sep 17 00:00:00 2001 From: Tibor Dancs Date: Thu, 5 Sep 2024 11:47:37 +0200 Subject: [PATCH 4/4] chore(test): pass custom settings object into podman-desktop-runner Signed-off-by: Tibor Dancs --- tests/playwright/src/ai-lab-extension.spec.ts | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/tests/playwright/src/ai-lab-extension.spec.ts b/tests/playwright/src/ai-lab-extension.spec.ts index 699824979..7ad684c49 100644 --- a/tests/playwright/src/ai-lab-extension.spec.ts +++ b/tests/playwright/src/ai-lab-extension.spec.ts @@ -18,7 +18,13 @@ import type { Page } from '@playwright/test'; import type { DashboardPage, ExtensionsPage, Runner } from '@podman-desktop/tests-playwright'; -import { NavigationBar, expect as playExpect, test, RunnerOptions, waitForPodmanMachineStartup } from '@podman-desktop/tests-playwright'; +import { + NavigationBar, + expect as playExpect, + test, + RunnerOptions, + waitForPodmanMachineStartup, +} from '@podman-desktop/tests-playwright'; import { AILabPage } from './model/ai-lab-page'; import type { AILabRecipesCatalogPage } from './model/ai-lab-recipes-catalog-page'; import type { AILabAppDetailsPage } from './model/ai-lab-app-details-page'; @@ -30,7 +36,11 @@ 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'; const AI_LAB_AI_APP_NAME: string = 'ChatBot'; -const isLinux = os.platform() === 'linux'; +const isWindows = os.platform() === 'win32'; +const isCI = process.env.AI_LAB_CI_RUN; +const customSettingsPodmanPath = isWindows + ? `${process.env.USERPROFILE}\\tools\\podman\\podman-5.2.0\\usr\\bin\\podman.exe` + : '/usr/bin/podman'; //todo: need to get podman path for linux and mac let webview: Page; let aiLabPage: AILabPage; @@ -41,7 +51,21 @@ let dashboardPage: DashboardPage; let extensionsPage: ExtensionsPage; test.use({ - runnerOptions: new RunnerOptions({ customFolder: 'ai-lab-tests-pd' }), + runnerOptions: new RunnerOptions({ + customFolder: 'ai-lab-e2e', + autoCheckUpdates: false, + autoUpdate: false, + extesionsDisabled: [ + 'podman-desktop.compose', + 'podman-desktop.docker', + 'podman-desktop.kind', + 'podman-desktop.kube-context', + 'podman-desktop.kubectl-cli', + 'podman-desktop.registries', + 'podman-desktop.lima', + ], + binaryPath: isCI ? customSettingsPodmanPath : undefined, + }), }); test.beforeAll(async ({ runner, welcomePage, page }) => { runner.setVideoAndTraceName('ai-lab-e2e'); @@ -79,7 +103,7 @@ test.describe.serial(`AI Lab extension installation and verification`, () => { }); }); test.describe.serial(`AI Lab extension verification`, () => { - test.skip(isLinux, `Skipping AI App deployment on Linux`); + test.skip(os.platform() === 'linux', `Skipping AI App deployment on Linux`); test(`Open Recipes Catalog`, async () => { recipesCatalogPage = await aiLabPage.navigationBar.openRecipesCatalog(); await recipesCatalogPage.waitForLoad();