diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-30 16:24:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-09-01 15:06:46 +0200 |
commit | 3419e0e1fe8e48a08b63ca0ded31087f913eb2b6 (patch) | |
tree | 63ac7190b79194e93aec9bbfd3c336e60f469e9d /client/e2e/src/commands/upload.ts | |
parent | 2a4c9669d2d6ac6cd4ae43544698f826ae98080f (diff) | |
download | PeerTube-3419e0e1fe8e48a08b63ca0ded31087f913eb2b6.tar.gz PeerTube-3419e0e1fe8e48a08b63ca0ded31087f913eb2b6.tar.zst PeerTube-3419e0e1fe8e48a08b63ca0ded31087f913eb2b6.zip |
Migrate to webdriverio
Diffstat (limited to 'client/e2e/src/commands/upload.ts')
-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) | ||