From 75a29aee7146c09550e9d4c7a62ad7bf9f6234b0 Mon Sep 17 00:00:00 2001 From: Philip Langer Date: Thu, 14 Mar 2024 10:40:43 +0100 Subject: [PATCH] Replace deprecated use of `type` Change-Id: I660f7830a97df462174251ce2417a69b3b568d93 --- examples/playwright/src/theia-quick-command-palette.ts | 4 ++-- examples/playwright/src/theia-rename-dialog.ts | 5 ++--- examples/playwright/src/theia-terminal.ts | 2 +- examples/playwright/src/util.ts | 2 -- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/examples/playwright/src/theia-quick-command-palette.ts b/examples/playwright/src/theia-quick-command-palette.ts index 2728bb0b00d21..ecd7a558b06bd 100644 --- a/examples/playwright/src/theia-quick-command-palette.ts +++ b/examples/playwright/src/theia-quick-command-palette.ts @@ -16,7 +16,7 @@ import { ElementHandle } from '@playwright/test'; import { TheiaPageObject } from './theia-page-object'; -import { OSUtil, USER_KEY_TYPING_DELAY } from './util'; +import { OSUtil } from './util'; export class TheiaQuickCommandPalette extends TheiaPageObject { @@ -66,7 +66,7 @@ export class TheiaQuickCommandPalette extends TheiaPageObject { const input = await this.page.waitForSelector(`${this.selector} .monaco-inputbox .input`); if (input != null) { await input.focus(); - await input.type(value, { delay: USER_KEY_TYPING_DELAY }); + await input.fill(value); if (confirm) { await this.page.keyboard.press('Enter'); } diff --git a/examples/playwright/src/theia-rename-dialog.ts b/examples/playwright/src/theia-rename-dialog.ts index 22114444342b5..b90a82368cdcc 100644 --- a/examples/playwright/src/theia-rename-dialog.ts +++ b/examples/playwright/src/theia-rename-dialog.ts @@ -15,15 +15,14 @@ // ***************************************************************************** import { TheiaDialog } from './theia-dialog'; -import { OSUtil, USER_KEY_TYPING_DELAY } from './util'; +import { OSUtil } from './util'; export class TheiaRenameDialog extends TheiaDialog { async enterNewName(newName: string): Promise { const inputField = await this.page.waitForSelector(`${this.blockSelector} .theia-input`); await inputField.press(OSUtil.isMacOS ? 'Meta+a' : 'Control+a'); - await inputField.type(newName, { delay: USER_KEY_TYPING_DELAY }); - await this.page.waitForTimeout(USER_KEY_TYPING_DELAY); + await inputField.fill(newName); } async confirm(): Promise { diff --git a/examples/playwright/src/theia-terminal.ts b/examples/playwright/src/theia-terminal.ts index 053cc63a46524..72fd695e06fe9 100644 --- a/examples/playwright/src/theia-terminal.ts +++ b/examples/playwright/src/theia-terminal.ts @@ -38,7 +38,7 @@ export class TheiaTerminal extends TheiaView { async write(text: string): Promise { await this.activate(); const input = await this.waitForInputArea(); - await input.type(text); + await input.fill(text); } async contents(): Promise { diff --git a/examples/playwright/src/util.ts b/examples/playwright/src/util.ts index 36678a45da60e..249deea95fc22 100644 --- a/examples/playwright/src/util.ts +++ b/examples/playwright/src/util.ts @@ -18,8 +18,6 @@ import { ElementHandle } from '@playwright/test'; import { tmpdir, platform } from 'os'; import { sep } from 'path'; -export const USER_KEY_TYPING_DELAY = 80; - export function normalizeId(nodeId: string): string { // Special characters (i.e. in our case '.',':','/','%', and '\\') in CSS IDs have to be escaped return nodeId.replace(/[.:,%/\\]/g, matchedChar => '\\' + matchedChar);