Playwright basic utils (#7930)

Related to #6641
This commit is contained in:
BOHEUS
2024-11-07 14:34:53 +00:00
committed by GitHub
parent 4f2b055ee0
commit c3343d3600
4 changed files with 145 additions and 0 deletions

View File

@ -0,0 +1,14 @@
import { Locator, Page } from '@playwright/test';
import { selectAllByKeyboard } from './keyboardShortcuts';
// https://github.com/microsoft/playwright/issues/14126
// code must have \n at the end of lines otherwise everything will be in one line
export const pasteCodeToCodeEditor = async (
page: Page,
locator: Locator,
code: string,
) => {
await locator.click();
await selectAllByKeyboard(page);
await page.keyboard.type(code);
};