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,15 @@
import { Page } from '@playwright/test';
import path from 'path';
export const fileUploader = async (
page: Page,
trigger: () => Promise<void>,
filename: string,
) => {
const fileChooserPromise = page.waitForEvent('filechooser');
await trigger();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(
path.join(__dirname, '..', 'test_files', filename),
);
};