Skip to content

Commit 4acb7a4

Browse files
Merge pull request continuedev#3479 from continuedev/tomasz/e2e-shortcuts-scenario
test: add another testing scenario
2 parents e00f2b0 + 878e211 commit 4acb7a4

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

extensions/vscode/e2e/tests/KeyboardShortcuts.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import {
77
Workbench,
88
WebView,
99
WebElement,
10+
until,
1011
} from "vscode-extension-tester";
1112
import { DEFAULT_TIMEOUT } from "../constants";
1213
import { GUISelectors } from "../selectors/GUI.selectors";
1314
import { GUIActions } from "../actions/GUI.actions";
1415
import { expect } from "chai";
1516
import { TestUtils } from "../TestUtils";
17+
import { Test } from "mocha";
18+
import { KeyboardShortcutsActions } from "../actions/KeyboardShortcuts.actions";
1619

1720
describe("Cmd+L Shortcut Test", () => {
1821
let driver: WebDriver;
@@ -77,6 +80,44 @@ describe("Cmd+L Shortcut Test", () => {
7780
expect(await textInput.isDisplayed()).to.equal(false);
7881
}).timeout(DEFAULT_TIMEOUT.XL);
7982

83+
it("Send a message → focus code editor (not sidebar) → cmd+L → should focus sidebar and start a new session", async () => {
84+
await GUIActions.executeFocusContinueInputShortcut(driver);
85+
({ view } = await GUIActions.switchToReactIframe());
86+
87+
const { userMessage: userMessage0 } = TestUtils.generateTestMessagePair(0);
88+
89+
await GUIActions.sendMessage({
90+
view,
91+
message: userMessage0,
92+
inputFieldIndex: 0,
93+
});
94+
95+
await view.switchBack();
96+
97+
KeyboardShortcutsActions.HACK__typeWithSelect(editor, "hello");
98+
99+
await TestUtils.waitForTimeout(DEFAULT_TIMEOUT.XS);
100+
101+
await GUIActions.executeFocusContinueInputShortcut(driver);
102+
103+
({ view } = await GUIActions.switchToReactIframe());
104+
105+
await TestUtils.waitForTimeout(DEFAULT_TIMEOUT.XS);
106+
107+
const textInput = await TestUtils.waitForSuccess(() =>
108+
GUISelectors.getMessageInputFieldAtIndex(view, 0),
109+
);
110+
const activeElement: WebElement = await driver.switchTo().activeElement();
111+
const textInputHtml = await textInput.getAttribute("outerHTML");
112+
const activeElementHtml = await activeElement.getAttribute("outerHTML");
113+
expect(textInputHtml).to.equal(activeElementHtml);
114+
115+
await GUIActions.executeFocusContinueInputShortcut(driver);
116+
117+
await driver.wait(until.elementIsNotVisible(textInput), DEFAULT_TIMEOUT.XS);
118+
expect(await textInput.isDisplayed()).to.equal(false);
119+
}).timeout(DEFAULT_TIMEOUT.XL * 1000);
120+
80121
it("Should create a code block when Cmd+L is pressed with text highlighted", async () => {
81122
const text = "Hello, world!";
82123

0 commit comments

Comments
 (0)