import { Input } from '@contour/fet/lib/elements'; import { Element } from '@contour/fet/lib/elements/element'; import { getFileUploadScript } from './support/fileUpload'; export class ContourFileUpload extends Element { constructor(selector: string) { super(selector); } async uploadFile(filepath: string): Promise { await this.waitForVisible(); const elementId = `contour-upload-${new Date().getTime()}`; await browser.execute(getFileUploadScript(elementId), await this.getElement(), 0, 0); const el = new Input(`#${elementId}`); await el.addToInputField(filepath); } async uploadFiles(filepaths: any[]): Promise { filepaths.forEach(async (filePath) => await this.uploadFile(filePath)); } }