Files
filteredandGitHub 760c1805be [e2e] Troubleshoot on server start fail (#969)
* Add test: server start fail offers troubleshooting

Update test expectation

Increase timeout

Doc

* [Cleanup] Remove redundant test log
2025-02-21 18:07:16 +11:00

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] });
}
}