e2ed
Version:
E2E testing framework over Playwright
15 lines (14 loc) • 693 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setFilesToUpload = void 0;
const step_1 = require("../step");
/**
* Populates the specified file upload input with file paths.
*/
const setFilesToUpload = async (selector, files, options = {}) => {
const hasManyFiles = Array.isArray(files) && files.length > 0;
await (0, step_1.step)(`Populate file upload input with file${hasManyFiles ? 's' : ''} "${String(files)}"`, async () => {
await selector.getPlaywrightLocator().setInputFiles(files, options);
}, { payload: { ...options, selector }, type: 5 /* LogEventType.InternalAction */ });
};
exports.setFilesToUpload = setFilesToUpload;