Skip to content

Commit

Permalink
test: make start-up more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
rjaegers committed Jul 31, 2024
1 parent ddd4555 commit f39b8af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/cpp/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default defineConfig({
retries: process.env.CI ? 2 : 0,
workers: 1,
reporter: 'list',
timeout: 3 * 60 * 1000,
timeout: 2 * 60 * 1000,
expect: {
timeout: 30 * 1000
timeout: 1 * 60 * 1000
},
use: {
trace: 'on-first-retry'
Expand Down
9 changes: 7 additions & 2 deletions .devcontainer/cpp/e2e/tests/codespace.pom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,25 @@ export class CodespacePage {
await this.page.goto('https://' + process.env.CODESPACE_NAME + '.github.dev');
}

async arePluginsActive(plugins: string[]) {
async areExtensionsActive(plugins: string[]) {
for (const plugin of plugins) {
await expect(this.page.getByRole('tab', { name: plugin })).toBeVisible();
await expect(this.page.getByRole('tab', { name: plugin }).locator('a')).toBeVisible();
}
}

async executeInTerminal(commands: string | string[]) {
let commandsWithExit = Array.isArray(commands) ? [...commands + 'exit'] : [commands, 'exit'];

await this.page.keyboard.press('Control+Shift+`');
expect(this.page.locator('.terminal-widget-container')).toBeVisible();

for (const command of commandsWithExit) {
await this.page.keyboard.type(command);
await this.page.keyboard.press('Enter');
}
}

async openTabByName(name: string) {
await this.page.getByRole('tab', { name: name }).locator('a').click();
}
}
2 changes: 1 addition & 1 deletion .devcontainer/cpp/e2e/tests/smoke.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test.beforeEach(async ({ page }) => {
test.slow();
const codespace = new CodespacePage(page);
await codespace.goto();
await codespace.arePluginsActive(['Testing', 'SonarLint', 'CMake', 'Live Share', 'GitHub Pull Requests']);
await codespace.areExtensionsActive(['Testing', 'SonarLint', 'CMake', 'Live Share', 'GitHub Pull Requests']);
await codespace.executeInTerminal('git clean -fdx');
});

Expand Down

0 comments on commit f39b8af

Please sign in to comment.