Skip to content

Commit 29aea0f

Browse files
committed
feat: add method to focusTerminal in CodeServer
1 parent 8124acd commit 29aea0f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

test/e2e/codeServer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test.describe("CodeServer", () => {
3636
expect(await page.isVisible("#terminal")).toBe(true)
3737
})
3838

39-
test.only("should open a file with quickOpen", options, async ({ page }) => {
39+
test("should open a file with quickOpen", options, async ({ page }) => {
4040
await codeServer.openFolder()
4141
await codeServer.quickOpen("extensions.json")
4242
// If the file is open, we will see an empty array

test/e2e/models/CodeServer.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,29 @@ export class CodeServer {
3333

3434
/**
3535
* Toggles the integrated terminal if not already in view
36+
* and focuses it
3637
*/
3738
async viewTerminal() {
3839
// Check if Terminal is already in view
3940
const isTerminalInView = await this.page.isVisible("#terminal")
4041

4142
if (!isTerminalInView) {
4243
// Open using default keyboard shortcut
43-
await this.page.keyboard.press("Control+Backquote")
44+
await this.focusTerminal()
4445
await this.page.waitForSelector("#terminal")
4546
}
4647
}
4748

49+
async focusTerminal() {
50+
await this.page.keyboard.press("Control+Backquote")
51+
}
52+
4853
async quickOpen(input: string) {
4954
await this.page.keyboard.press("Meta+P")
5055
await this.page.waitForSelector('[aria-describedby="quickInput_message"]')
5156
await this.page.keyboard.type(input)
57+
await this.page.waitForTimeout(2000)
5258
await this.page.keyboard.press("Enter")
59+
await this.page.waitForTimeout(2000)
5360
}
5461
}

0 commit comments

Comments
 (0)