Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions .github/workflows/ai-lab-e2e-nightly-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:

- name: Set the default env. variables
env:
CI: true
DEFAULT_PODMAN_DESKTOP_REPO_ARGS: 'REPO=podman-desktop,FORK=podman-desktop,BRANCH=main'
DEFAULT_NPM_TARGET: 'test:e2e'
DEFAULT_ENV_VARS: 'TEST_PODMAN_MACHINE=true,ELECTRON_ENABLE_INSPECT=true'
Expand Down
148 changes: 74 additions & 74 deletions tests/playwright/src/ai-lab-extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,80 +217,6 @@ test.describe.serial(`AI Lab extension installation and verification`, () => {
);
});

//The test is currently failing on ci, relates to https://github.com/redhat-developer/mapt/issues/583
test.describe.skip(`Start Llama Stack from sidebar and verify containers`, { tag: '@smoke' }, () => {
let llamaStackPage: AiLlamaStackPage;
const llamaStackContainerNames: string[] = [];

test.beforeAll(`Open Llama Stack`, async ({ runner, page, navigationBar }) => {
aiLabPage = await reopenAILabDashboard(runner, page, navigationBar);
await aiLabPage.navigationBar.waitForLoad();
llamaStackPage = await aiLabPage.navigationBar.openLlamaStack();
await llamaStackPage.waitForLoad();
});

test(`Start Llama Stack containers`, async () => {
test.setTimeout(300_000);
await llamaStackPage.waitForLoad();
await llamaStackPage.runLlamaStackContainer();
await playExpect(llamaStackPage.openLlamaStackContainerButton).toBeVisible({ timeout: 120_000 });
await playExpect(llamaStackPage.exploreLlamaStackEnvironmentButton).toBeVisible({ timeout: 120_000 });
await playExpect(llamaStackPage.openLlamaStackContainerButton).toBeEnabled({ timeout: 30_000 });
await playExpect(llamaStackPage.exploreLlamaStackEnvironmentButton).toBeEnabled({ timeout: 30_000 });
});

test(`Verify Llama Stack containers are running`, async ({ navigationBar }) => {
let containersPage = await navigationBar.openContainers();
await playExpect(containersPage.heading).toBeVisible();

await playExpect
.poll(
async () => {
const allRows = await containersPage.getAllTableRows();
llamaStackContainerNames.length = 0;
for (const row of allRows) {
const text = await row.textContent();
if (text?.includes('llama-stack')) {
const containerNameMatch = RegExp(/\b(llama-stack[^\s]*)/).exec(text);
if (containerNameMatch) {
llamaStackContainerNames.push(containerNameMatch[1]);
}
}
}
return llamaStackContainerNames.length;
},
{
timeout: 30_000,
intervals: [5_000],
},
)
.toBe(2);

console.log(`Found containers: ${llamaStackContainerNames.join(', ')}`);

for (const container of llamaStackContainerNames) {
containersPage = await navigationBar.openContainers();
await playExpect(containersPage.heading).toBeVisible();
const containersDetailsPage = await containersPage.openContainersDetails(container);
await playExpect(containersDetailsPage.heading).toBeVisible();
await playExpect
.poll(async () => containersDetailsPage.getState(), { timeout: 30_000 })
.toContain(ContainerState.Running);
}
});

test.afterAll(`Stop Llama Stack containers`, async ({ navigationBar }) => {
for (const container of llamaStackContainerNames) {
const containersPage = await navigationBar.openContainers();
await playExpect(containersPage.heading).toBeVisible();
await containersPage.deleteContainer(container);
await playExpect
.poll(async () => await containersPage.containerExists(container), { timeout: 30_000 })
.toBeFalsy();
}
});
});

test.describe.serial('AI Lab API endpoint e2e test', { tag: '@smoke' }, () => {
let localServerPort: string;
let extensionVersion: string | undefined;
Expand Down Expand Up @@ -693,6 +619,80 @@ test.describe.serial(`AI Lab extension installation and verification`, () => {
});
});

test.describe.serial(`Start Llama Stack from sidebar and verify containers`, { tag: '@smoke' }, () => {
test.skip(!!isCI && !!isWindows, 'Skipping Llama Stack tests on GitHub Actions with Windows platform');
let llamaStackPage: AiLlamaStackPage;
const llamaStackContainerNames: string[] = [];

test.beforeAll(`Open Llama Stack`, async ({ runner, page, navigationBar }) => {
aiLabPage = await reopenAILabDashboard(runner, page, navigationBar);
await aiLabPage.navigationBar.waitForLoad();
llamaStackPage = await aiLabPage.navigationBar.openLlamaStack();
await llamaStackPage.waitForLoad();
});

test(`Start Llama Stack containers`, async () => {
test.setTimeout(300_000);
await llamaStackPage.waitForLoad();
await llamaStackPage.runLlamaStackContainer();
await playExpect(llamaStackPage.openLlamaStackContainerButton).toBeVisible({ timeout: 120_000 });
await playExpect(llamaStackPage.exploreLlamaStackEnvironmentButton).toBeVisible({ timeout: 120_000 });
await playExpect(llamaStackPage.openLlamaStackContainerButton).toBeEnabled({ timeout: 30_000 });
await playExpect(llamaStackPage.exploreLlamaStackEnvironmentButton).toBeEnabled({ timeout: 30_000 });
});

test(`Verify Llama Stack containers are running`, async ({ navigationBar }) => {
let containersPage = await navigationBar.openContainers();
await playExpect(containersPage.heading).toBeVisible();

await playExpect
.poll(
async () => {
const allRows = await containersPage.getAllTableRows();
llamaStackContainerNames.length = 0;
for (const row of allRows) {
const text = await row.textContent();
if (text?.includes('llama-stack')) {
const containerNameMatch = RegExp(/\b(llama-stack[^\s]*)/).exec(text);
if (containerNameMatch) {
llamaStackContainerNames.push(containerNameMatch[1]);
}
}
}
return llamaStackContainerNames.length;
},
{
timeout: 30_000,
intervals: [5_000],
},
)
.toBe(2);

console.log(`Found containers: ${llamaStackContainerNames.join(', ')}`);

for (const container of llamaStackContainerNames) {
containersPage = await navigationBar.openContainers();
await playExpect(containersPage.heading).toBeVisible();
const containersDetailsPage = await containersPage.openContainersDetails(container);
await playExpect(containersDetailsPage.heading).toBeVisible();
await playExpect
.poll(async () => containersDetailsPage.getState(), { timeout: 30_000 })
.toContain(ContainerState.Running);
}
});

test.afterAll(`Stop Llama Stack containers`, async ({ navigationBar }) => {
for (const container of llamaStackContainerNames) {
const containersPage = await navigationBar.openContainers();
await playExpect(containersPage.heading).toBeVisible();
await containersPage.deleteContainer(container);
await playExpect
.poll(async () => await containersPage.containerExists(container), { timeout: 30_000 })
.toBeFalsy();
}
});
});

async function cleanupServices(): Promise<void> {
try {
const modelServicePage = await aiLabPage.navigationBar.openServices();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export class AiLlamaStackPage extends AILabBasePage {
constructor(page: Page, webview: Page) {
super(page, webview, 'Llama Stack');
this.startLlamaStackContainerButton = this.webview.getByRole('button', { name: 'Start Llama Stack container' });
this.openLlamaStackContainerButton = this.webview.getByRole('button', { name: 'Open Llama Stack container' });
this.openLlamaStackContainerButton = this.webview.getByRole('button', {
name: 'Open Llama Stack Server container',
});
this.exploreLlamaStackEnvironmentButton = this.webview.getByRole('button', {
name: 'Explore Llama-Stack environment',
});
Expand Down
Loading