Files
studio-desktop/tests/integration/testTroubleshooting.ts
filteredandGitHub 992659ab3d [e2e] Add recreate virtual environment test (#914)
* nit - Rename

* [e2e] Add recreate virtual environment test

* Add test expectation

* Fix button name

* Replace manual test env cleanup with disposable

* [Dev] Fix vscode debug + playwright ext. conflict

Breaks on caught exceptions that are within another class member

* Fix venv creation - use confirm buttons & wait for server start

* Fix server start timeout too short

* Fix new disposable clean up never runs
2025-02-17 09:12:50 +11:00

44 lines
1.4 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 });
}
}