]>
Commit | Line | Data |
---|---|---|
1 | browser.addCommand('chooseFile', async function (this: WebdriverIO.Element, localFilePath: string) { | |
2 | try { | |
3 | const remoteFile = await browser.uploadFile(localFilePath) | |
4 | ||
5 | return this.addValue(remoteFile) | |
6 | } catch { | |
7 | console.log('Cannot upload file, fallback to add value.') | |
8 | ||
9 | // Firefox does not support upload file, but if we're running the test in local we don't really need it | |
10 | return this.addValue(localFilePath) | |
11 | } | |
12 | }, true) |