Skip to content

punkpeye/playwright-utilities

Repository files navigation

Playwright Utilities

Utilities for working with @playwright/test.

Utilities

createDataTransfer

Used to create a DataTransfer. Useful when you want to perform drag and drop operations.

createDataTransfer = (args: {
  page: Page;
  filePath: string;
  fileName: string;
  fileType: string;
}): Promise<DataTransfer>;

Usage:

import { createDataTransfer } from "playwright-utilities";
import { resolve } from "node:path";

await createDataTransfer({
  filePath: resolve(__dirname, "foo.png"),
  fileName: "foo.png",
  fileType: "image/png",
});