diff --git a/extensions/vscode/e2e/tests/KeyboardShortcuts.test.ts b/extensions/vscode/e2e/tests/KeyboardShortcuts.test.ts index 837372bab..f88b865cf 100644 --- a/extensions/vscode/e2e/tests/KeyboardShortcuts.test.ts +++ b/extensions/vscode/e2e/tests/KeyboardShortcuts.test.ts @@ -13,6 +13,8 @@ import { GUISelectors } from "../selectors/GUI.selectors"; import { GUIActions } from "../actions/GUI.actions"; import { expect } from "chai"; import { TestUtils } from "../TestUtils"; +import { Test } from "mocha"; +import { KeyboardShortcutsActions } from "../actions/KeyboardShortcuts.actions"; describe("Cmd+L Shortcut Test", () => { let driver: WebDriver; @@ -77,6 +79,42 @@ describe("Cmd+L Shortcut Test", () => { expect(await textInput.isDisplayed()).to.equal(false); }).timeout(DEFAULT_TIMEOUT.XL); + it("Send a message → focus code editor (not sidebar) → cmd+L → should focus sidebar and start a new session", async () => { + await GUIActions.executeFocusContinueInputShortcut(driver); + ({ view } = await GUIActions.switchToReactIframe()); + + const { userMessage: userMessage0 } = TestUtils.generateTestMessagePair(0); + + await GUIActions.sendMessage({ + view, + message: userMessage0, + inputFieldIndex: 0, + }); + + await view.switchBack(); + + KeyboardShortcutsActions.HACK__typeWithSelect(editor, "hello"); + + await TestUtils.waitForTimeout(DEFAULT_TIMEOUT.XS); + + await GUIActions.executeFocusContinueInputShortcut(driver); + + ({ view } = await GUIActions.switchToReactIframe()); + + await TestUtils.waitForTimeout(DEFAULT_TIMEOUT.XS); + + const textInput = await TestUtils.waitForSuccess(() => + GUISelectors.getMessageInputFieldAtIndex(view, 0), + ); + const activeElement: WebElement = await driver.switchTo().activeElement(); + const textInputHtml = await textInput.getAttribute("outerHTML"); + const activeElementHtml = await activeElement.getAttribute("outerHTML"); + expect(textInputHtml).to.equal(activeElementHtml); + + await GUIActions.executeFocusContinueInputShortcut(driver); + expect(await textInput.isDisplayed()).to.equal(false); + }).timeout(DEFAULT_TIMEOUT.XL * 1000); + it("Should create a code block when Cmd+L is pressed with text highlighted", async () => { const text = "Hello, world!";