Skip to content

Commit 0ec7ae4

Browse files
committed
feat: get terminal test to working state
1 parent b936d57 commit 0ec7ae4

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

test/e2e/models/CodeServer.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,17 @@ export class CodeServer {
9292
}
9393

9494
async focusTerminal() {
95-
// TODO@jsjoeio combine viewTerminal and focusTerminal
96-
// check if terminal is open before hitting keyboard shortcut
97-
// otherwise it will close it
98-
await this.page.keyboard.press("Control+Backquote")
99-
// Give the terminal a second to load, change shells, etc.
100-
await this.page.waitForTimeout(1500)
95+
// Open using the manu
96+
// Click [aria-label="Application Menu"] div[role="none"]
97+
await this.page.click('[aria-label="Application Menu"] div[role="none"]')
98+
99+
// Click text=View
100+
await this.page.hover("text=View")
101+
await this.page.click("text=View")
102+
103+
// Click text=Terminal
104+
await this.page.hover("text=Terminal")
105+
await this.page.click("text=Terminal")
101106
}
102107

103108
async quickOpen(input: string) {

test/e2e/terminal.test.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ test.describe("Integrated Terminal", () => {
4040
// await codeServer.viewTerminal()
4141
await codeServer.focusTerminal()
4242

43+
// give the terminal a second to load
44+
await page.waitForTimeout(3000)
4345
await page.keyboard.type(`echo '${testString}' > ${tmpFile}`)
4446
// Wait for the typing to finish before hitting enter
4547
await page.waitForTimeout(500)
@@ -51,8 +53,13 @@ test.describe("Integrated Terminal", () => {
5153
// resolve to undefined
5254
// If the promise rejects (i.e. the file doesn't exist)
5355
// then the assertion will fail
54-
expect(fs.promises.access(tmpFile)).resolves.toBeUndefined()
56+
await expect(fs.promises.access(tmpFile)).resolves.toBeUndefined()
5557

56-
// TODO delete tmpFolder
58+
await fs.promises.rmdir(tmpFolderPath, { recursive: true })
59+
// Make sure neither file nor folder exist
60+
// @ts-ignore
61+
expect(fs.promises.access(tmpFile)).rejects.toThrowError(/no such file or directory/)
62+
// @ts-ignore
63+
expect(fs.promises.access(tmpFolderPath)).rejects.toThrowError(/no such file or directory/)
5764
})
5865
})

0 commit comments

Comments
 (0)