Skip to content

Commit

Permalink
E2E tests: remove dispatchKeyBinding (#5762)
Browse files Browse the repository at this point in the history
Remove dependency in positron tests and POMs on dispatchKeyBinding

### QA Notes

All smoke tests should pass.
  • Loading branch information
testlabauto authored Dec 17, 2024
1 parent ed9401a commit d9046d1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions test/automation/src/positron/positronConsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ export class PositronConsole {
await this.quickinput.waitForQuickInputOpened();
await this.quickinput.type(languageName);
await this.quickinput.waitForQuickInputElements(e => e.length === 1 && e[0] === languageName);
await this.code.dispatchKeybinding('enter');
await this.code.driver.page.keyboard.press('Enter');

await this.quickinput.waitForQuickInputOpened();
const unescapedCode = code
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r');
await this.quickinput.type(unescapedCode);
await this.code.dispatchKeybinding('enter');
await this.code.driver.page.keyboard.press('Enter');
await this.quickinput.waitForQuickInputClosed();

// The console will show the prompt after the code is done executing.
Expand Down
14 changes: 7 additions & 7 deletions test/automation/src/positron/positronDataExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,31 +152,31 @@ export class PositronDataExplorer {
}

async home(): Promise<void> {
await this.code.dispatchKeybinding('home');
await this.code.driver.page.keyboard.press('Home');
}

async cmdCtrlHome(): Promise<void> {
if (process.platform === 'darwin') {
await this.code.dispatchKeybinding('cmd+home');
await this.code.driver.page.keyboard.press('Meta+Home');
} else {
await this.code.dispatchKeybinding('ctrl+home');
await this.code.driver.page.keyboard.press('Control+Home');
}
}

async arrowDown(): Promise<void> {
await this.code.dispatchKeybinding('ArrowDown');
await this.code.driver.page.keyboard.press('ArrowDown');
}

async arrowRight(): Promise<void> {
await this.code.dispatchKeybinding('ArrowRight');
await this.code.driver.page.keyboard.press('ArrowRight');
}

async arrowUp(): Promise<void> {
await this.code.dispatchKeybinding('ArrowUp');
await this.code.driver.page.keyboard.press('ArrowUp');
}

async arrowLeft(): Promise<void> {
await this.code.dispatchKeybinding('ArrowLeft');
await this.code.driver.page.keyboard.press('ArrowLeft');
}

async getColumnMissingPercent(rowNumber: number): Promise<string> {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/areas/console/console-python.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,5 @@ test.describe('Console Pane: Python', { tag: [tags.WEB, tags.WIN, tags.CONSOLE]

await app.workbench.positronConsole.interruptExecution();

await app.workbench.positronConsole.waitForConsoleContents('KeyboardInterrupt');
});
});
2 changes: 1 addition & 1 deletion test/e2e/areas/r-markdown/r-markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test.describe('R Markdown', { tag: [tags.WEB, tags.R_MARKDOWN] }, () => {
// test depends on the previous test
test('Preview R Markdown [C709147]', async function ({ app, r }) {
// Preview
await app.code.dispatchKeybinding(process.platform === 'darwin' ? 'cmd+shift+k' : 'ctrl+shift+k');
await app.code.driver.page.keyboard.press(process.platform === 'darwin' ? 'Meta+Shift+K' : 'Control+Shift+K');

// inner most frame has no useful identifying features
// not factoring this locator because its not part of positron
Expand Down

0 comments on commit d9046d1

Please sign in to comment.