Skip to content

Commit b4e3a72

Browse files
committed
Tweak terminal test
The first pass seems to always fail because no input actually makes it to the the terminal; perhaps this will alleviate that. Also add a timeout so we can retry more quickly.
1 parent 00705fd commit b4e3a72

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

test/e2e/models/CodeServer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ export class CodeServerPage {
310310
/**
311311
* Wait for a tab to open for the specified file.
312312
*/
313-
async waitForTab(file: string): Promise<void> {
314-
await this.page.waitForSelector(`.tab :text("${path.basename(file)}")`)
313+
async waitForTab(file: string, timeout?: number): Promise<void> {
314+
await this.page.waitForSelector(`.tab :text("${path.basename(file)}")`, { timeout })
315315
}
316316

317317
/**

test/e2e/terminal.test.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ describe("Integrated Terminal", true, [], {}, () => {
4141
await codeServerPage.page.keyboard.type(`code-server ${tmpFile}`)
4242
await codeServerPage.page.keyboard.press("Enter")
4343

44-
await codeServerPage.waitForTab(path.basename(tmpFile))
44+
// If it is not showing yet try again; sometimes the terminal does not seem
45+
// to accept input right away.
46+
if (!(await codeServerPage.tabIsVisible(path.basename(tmpFile)))) {
47+
await codeServerPage.page.keyboard.type(`code-server ${tmpFile}`)
48+
await codeServerPage.page.keyboard.press("Enter")
49+
50+
// The tab should eventually show up so wait for it. It should not take
51+
// long so we want to fail somewhat fast.
52+
await codeServerPage.waitForTab(path.basename(tmpFile), 1000)
53+
}
4554
})
4655
})

0 commit comments

Comments
 (0)