diff options
Diffstat (limited to 'client/e2e/src/commands')
-rw-r--r-- | client/e2e/src/commands/upload.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/client/e2e/src/commands/upload.ts b/client/e2e/src/commands/upload.ts new file mode 100644 index 000000000..05d3f8f31 --- /dev/null +++ b/client/e2e/src/commands/upload.ts | |||
@@ -0,0 +1,12 @@ | |||
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) | ||