mirror of
https://github.com/hanzoai/studio-desktop.git
synced 2026-10-30 18:21:16 +00:00
* Add test: server start fail offers troubleshooting Update test expectation Increase timeout Doc * [Cleanup] Remove redundant test log
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
import { expect } from './testExtensions';
|
|
import { TestServerStatus } from './testServerStatus';
|
|
|
|
export class TestServerStart {
|
|
readonly openLogsButton;
|
|
readonly reportIssueButton;
|
|
readonly troubleshootButton;
|
|
readonly showTerminalButton;
|
|
readonly terminal;
|
|
readonly status;
|
|
|
|
constructor(readonly window: Page) {
|
|
this.reportIssueButton = this.getButton('Report Issue');
|
|
this.openLogsButton = this.getButton('Open Logs');
|
|
this.troubleshootButton = this.getButton('Troubleshoot');
|
|
this.showTerminalButton = this.getButton('Show Terminal');
|
|
|
|
this.terminal = this.window.locator('.terminal-host');
|
|
this.status = new TestServerStatus(this.window);
|
|
}
|
|
|
|
getButton(name: string) {
|
|
return this.window.getByRole('button', { name });
|
|
}
|
|
|
|
getInput(name: string, exact?: boolean) {
|
|
return this.window.getByRole('textbox', { name, exact });
|
|
}
|
|
|
|
encounteredError() {
|
|
return this.status.error.isVisible();
|
|
}
|
|
|
|
async expectServerStarts(timeout = 30 * 1000) {
|
|
const anyStatusVisible = async () => await expect(this.status.get()).resolves.not.toBe('unknown');
|
|
|
|
await expect(anyStatusVisible).toPass({ timeout, intervals: [500] });
|
|
}
|
|
}
|