Files
40f625d2aa Update integration tests for v0.5 compatibility (#1369)
## Runtime change

- Fixes window state not saved on launch

## Test changes

- Updates integration test locators for frontend v1.27.x
- Removes obsolete migrate step from install flow

### Migration step changes

Migration is now combined with the install location step as an accordion
section.

### Test locators updated

- GPU selection: "Select GPU" → "Choose your hardware setup"
- Install location: Updated input selector to use placeholder
- Server status: "Finishing..." → "Loading Human Interface"
- CPU toggle: Updated to role-based selector

### Window state fix

Window bounds now captured on launch. Previously only saved on
resize/move events.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-1369-Update-integration-tests-for-v0-5-compatibility-2876d73d3650811c88f1c81e55994f6b)
by [Unito](https://www.unito.io)

---------

Co-authored-by: github-actions <[email protected]>
2025-10-09 05:29:25 -07:00

56 lines
1.9 KiB
TypeScript

import type { Page } from '@playwright/test';
import { expect } from './testExtensions';
import { TestTaskCard } from './testTaskCard';
export class TestTroubleshooting {
readonly refreshButton;
readonly basePathCard;
readonly vcRedistCard;
readonly installPythonPackagesCard;
readonly resetVenvCard;
readonly confirmRecreateVenvButton;
readonly confirmInstallPythonPackagesButton;
constructor(readonly window: Page) {
this.refreshButton = window.locator('button.relative.p-button-icon-only');
this.basePathCard = new TestTaskCard(window, /^Base path$/, 'Select');
this.vcRedistCard = new TestTaskCard(window, /^Download VC\+\+ Redist$/, 'Download');
this.installPythonPackagesCard = new TestTaskCard(window, /^Install python packages$/, 'Install');
this.resetVenvCard = new TestTaskCard(window, /^Reset virtual environment$/, 'Recreate');
this.confirmRecreateVenvButton = this.window.getByRole('alertdialog').getByRole('button', { name: 'Recreate' });
this.confirmInstallPythonPackagesButton = this.window
.getByRole('alertdialog')
.getByRole('button', { name: 'Install' });
}
async expectReady() {
await expect(this.refreshButton).toBeVisible();
await expect(this.refreshButton).not.toBeDisabled();
}
async refresh() {
await this.refreshButton.click();
}
getTaskCard(regex: RegExp) {
return this.window.locator('div.task-div').filter({ hasText: regex });
}
async expectInstallValid(timeout = 30 * 1000, interval = 2000) {
await expect(async () => {
const isBasePathOk = await this.window.evaluate(async () => {
const api = document.defaultView?.electronAPI;
if (!api) return false;
const validation = await api.Validation.getStatus();
return validation.basePath === 'OK';
});
expect(isBasePathOk).toBe(true);
}).toPass({ timeout, intervals: [interval] });
}
}