diff options
Diffstat (limited to 'vendor/blueimp/jquery-file-upload/wdio/test')
-rw-r--r-- | vendor/blueimp/jquery-file-upload/wdio/test/pages/file-upload.js | 45 | ||||
-rw-r--r-- | vendor/blueimp/jquery-file-upload/wdio/test/specs/01-file-upload.js | 14 |
2 files changed, 33 insertions, 26 deletions
diff --git a/vendor/blueimp/jquery-file-upload/wdio/test/pages/file-upload.js b/vendor/blueimp/jquery-file-upload/wdio/test/pages/file-upload.js index eccb6feb4..32ba5c39a 100644 --- a/vendor/blueimp/jquery-file-upload/wdio/test/pages/file-upload.js +++ b/vendor/blueimp/jquery-file-upload/wdio/test/pages/file-upload.js @@ -32,42 +32,47 @@ class FileUpload { * Opens the file upload form. * * @param {number} [timeout] Wait timeout - * @returns {FileUpload} FileUpload object */ - open(timeout) { - browser.url('/') - this.fileinput.waitForExist({ timeout }) - return this + async open(timeout) { + await browser.url('/') + await this.fileinput.waitForExist({ timeout }) } /** * Uploads files. * * @param {Array<string>} files Files to upload * @param {number} [timeout] Wait timeout - * @returns {FileUpload} FileUpload object */ - upload(files, timeout) { - this.fileinput.addValue(files.join('\n')) - browser.waitUntil(() => !this.processing.length, { timeout }) - this.start.click() - browser.waitUntil(() => !!this.downloads.length, { timeout }) - browser.waitUntil(() => !this.uploads.length, { timeout }) - return this + async upload(files, timeout) { + await this.fileinput.addValue(files.join('\n')) + await browser.waitUntil(async () => !(await this.processing.length), { + timeout + }) + await this.start.click() + await browser.waitUntil(async () => !!(await this.downloads.length), { + timeout + }) + await browser.waitUntil(async () => !(await this.uploads.length), { + timeout + }) } /** * Deletes uploaded files. * * @param {number} [timeout] Wait timeout - * @returns {FileUpload} FileUpload object */ - delete(timeout) { - this.toggle.click() - browser.waitUntil(() => this.downloads.length === this.checked.length, { + async delete(timeout) { + await this.toggle.click() + await browser.waitUntil( + async () => (await this.downloads.length) === (await this.checked.length), + { + timeout + } + ) + await this.remove.click() + await browser.waitUntil(async () => !(await this.downloads.length), { timeout }) - this.remove.click() - browser.waitUntil(() => !this.downloads.length, { timeout }) - return this } } diff --git a/vendor/blueimp/jquery-file-upload/wdio/test/specs/01-file-upload.js b/vendor/blueimp/jquery-file-upload/wdio/test/specs/01-file-upload.js index 95e77e7d8..0cc2782e9 100644 --- a/vendor/blueimp/jquery-file-upload/wdio/test/specs/01-file-upload.js +++ b/vendor/blueimp/jquery-file-upload/wdio/test/specs/01-file-upload.js @@ -8,16 +8,18 @@ const assetsDir = browser.config.assetsDir describe('File Upload', () => { if (!assetsDir) return - it('uploads files', () => { - FileUpload.open().upload([ + it('uploads files', async () => { + await FileUpload.open() + await FileUpload.upload([ assetsDir + 'black+white-60x40.gif', assetsDir + 'black+white-3x2.jpg' ]) - browser.saveAndDiffScreenshot('Files uploaded') + await browser.saveAndDiffScreenshot('Files uploaded') }) - it('deletes files', () => { - FileUpload.open().delete() - browser.saveAndDiffScreenshot('Files deleted') + it('deletes files', async () => { + await FileUpload.open() + await FileUpload.delete() + await browser.saveAndDiffScreenshot('Files deleted') }) }) |