aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/blueimp/jquery-file-upload/wdio
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/blueimp/jquery-file-upload/wdio')
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/.eslintrc.js10
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/.prettierrc.js7
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/LICENSE.txt20
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/assets/black-80x60.gifbin0 -> 108 bytes
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/assets/white-1x2.jpgbin0 -> 713 bytes
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/bin/forward-ports.sh85
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/bin/safaridriver.sh31
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/chrome.js36
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/firefox.js21
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/hooks/index.js21
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/ie.js20
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/reports/.gitignore2
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/safari.js20
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/test/pages/file-upload.js75
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/test/specs/01-file-upload.js23
-rw-r--r--vendor/blueimp/jquery-file-upload/wdio/wdio.conf.js1
16 files changed, 372 insertions, 0 deletions
diff --git a/vendor/blueimp/jquery-file-upload/wdio/.eslintrc.js b/vendor/blueimp/jquery-file-upload/wdio/.eslintrc.js
new file mode 100644
index 000000000..4826e0aeb
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/.eslintrc.js
@@ -0,0 +1,10 @@
+'use strict'
+
+module.exports = {
+ env: {
+ node: true
+ },
+ parserOptions: {
+ ecmaVersion: 2019
+ }
+}
diff --git a/vendor/blueimp/jquery-file-upload/wdio/.prettierrc.js b/vendor/blueimp/jquery-file-upload/wdio/.prettierrc.js
new file mode 100644
index 000000000..24237736e
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/.prettierrc.js
@@ -0,0 +1,7 @@
+'use strict'
+
+module.exports = {
+ proseWrap: 'always',
+ semi: false,
+ singleQuote: true
+}
diff --git a/vendor/blueimp/jquery-file-upload/wdio/LICENSE.txt b/vendor/blueimp/jquery-file-upload/wdio/LICENSE.txt
new file mode 100644
index 000000000..24161b3ef
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/LICENSE.txt
@@ -0,0 +1,20 @@
+MIT License
+
+Copyright © 2019 Sebastian Tschan, https://blueimp.net
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/blueimp/jquery-file-upload/wdio/assets/black-80x60.gif b/vendor/blueimp/jquery-file-upload/wdio/assets/black-80x60.gif
new file mode 100644
index 000000000..5814bdaa5
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/assets/black-80x60.gif
Binary files differ
diff --git a/vendor/blueimp/jquery-file-upload/wdio/assets/white-1x2.jpg b/vendor/blueimp/jquery-file-upload/wdio/assets/white-1x2.jpg
new file mode 100644
index 000000000..10a3d5492
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/assets/white-1x2.jpg
Binary files differ
diff --git a/vendor/blueimp/jquery-file-upload/wdio/bin/forward-ports.sh b/vendor/blueimp/jquery-file-upload/wdio/bin/forward-ports.sh
new file mode 100644
index 000000000..20bd43282
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/bin/forward-ports.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+#
+# Adds TCP/UDP port forwarding rules to the pf firewall (MacOS/BSD).
+#
+# Adds rules for both TCP and UDP in addition to those from /etc/pf.conf.
+# Requires an existing rdr-anchor entry in /etc/pf.conf.
+# Only adds rules temporarily, without changing any files.
+#
+# Usage: ./forward-ports.sh [[nic:]port=[ip:]port [...]]
+#
+# If no network interface is given, forwards from all interfaces.
+# If no IP is given, forwards to 127.0.0.1.
+# If no port forwarding rule is given, resets to the rules from /etc/pf.conf.
+#
+# e.g. forwarding ports 80 and 443 on network interface en0 to ports 8080 and
+# 8443 on localhost respectively:
+# ./forward-ports.sh en0:80=8080 en0:443=8443
+#
+# Copyright 2019, Sebastian Tschan
+# https://blueimp.net
+#
+# Licensed under the MIT license:
+# https://opensource.org/licenses/MIT
+#
+
+set -e
+
+RULES=
+NEWLINE='
+'
+
+print_usage_exit() {
+ if [ -n "$RULES" ]; then
+ printf '\nError in custom rules:\n%s\n' "$RULES" >&2
+ fi
+ echo "Usage: $0 [[nic:]port=[ip:]port [...]]" >&2
+ exit 1
+}
+
+print_nat_rules() {
+ echo
+ echo 'Loaded NAT rules:'
+ sudo pfctl -s nat 2>/dev/null
+ echo
+}
+
+# Print usage and exit if option arguments like "-h" are used:
+if [ "${1#-}" != "$1" ]; then print_usage_exit; fi
+
+while test $# -gt 0; do
+ # Separate the from=to parts:
+ from=${1%=*}
+ to=${1#*=}
+ # If from part has a nic defined, extract it, else forward from all:
+ case "$from" in
+ *:*) nic="on ${from%:*}";;
+ *) nic=;;
+ esac
+ # Extract the port to forward from:
+ from_port=${from##*:}
+ # If to part has an IP defined, extract it, else forward to 127.0.0.1:
+ case "$to" in
+ *:*) to_ip=${to%:*};;
+ *) to_ip=127.0.0.1;;
+ esac
+ # Extract the port to forward to:
+ to_port=${to##*:}
+ # Create the packet filter (pf) forwarding rule for both TCP and UDP:
+ rule=$(
+ printf \
+ 'rdr pass %s inet proto %s from any to any port %s -> %s port %s' \
+ "$nic" '{tcp udp}' "$from_port" "$to_ip" "$to_port"
+ )
+ # Add it to the list of rules:
+ RULES="$RULES$rule$NEWLINE"
+ shift
+done
+
+# Add the rules after the line matching "rdr-anchor" in /etc/pf.conf, print the
+# combined rules to STDOUT and load the rules into pf from STDIN.
+# Finally, display the loaded NAT rules or print the script usage on failure:
+# shellcheck disable=SC2015
+printf %s "$RULES" | sed -e '/rdr-anchor/r /dev/stdin' /etc/pf.conf |
+sudo pfctl -Ef - 2>/dev/null && print_nat_rules || print_usage_exit
diff --git a/vendor/blueimp/jquery-file-upload/wdio/bin/safaridriver.sh b/vendor/blueimp/jquery-file-upload/wdio/bin/safaridriver.sh
new file mode 100644
index 000000000..829ce9b3b
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/bin/safaridriver.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+if [ -z "$1" ]; then
+ echo 'Please select the input device by entering its [index] number:' >&2
+ ffmpeg -f avfoundation -list_devices true -i - 2>&1 | grep screen >&2
+ read -r INDEX
+else
+ INDEX=$1
+fi
+
+echo 'Starting safaridriver on 127.0.0.1:4444 ...' >&2
+safaridriver -p 4444 & pid=$!
+
+# shellcheck disable=SC2064
+trap "kill $pid; exit" INT TERM
+
+echo 'Starting mjpeg-server on 127.0.0.1:9000 ...' >&2
+mjpeg-server -a 127.0.0.1:9000 -- ffmpeg \
+ -loglevel error \
+ -probesize 32 \
+ -fpsprobesize 0 \
+ -analyzeduration 0 \
+ -fflags nobuffer \
+ -f avfoundation \
+ -capture_cursor 1 \
+ -r "${FPS:-15}" \
+ -pixel_format yuyv422 \
+ -i "$INDEX" \
+ -f mpjpeg \
+ -q "${QUALITY:-2}" \
+ -
diff --git a/vendor/blueimp/jquery-file-upload/wdio/chrome.js b/vendor/blueimp/jquery-file-upload/wdio/chrome.js
new file mode 100644
index 000000000..6d1650e66
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/chrome.js
@@ -0,0 +1,36 @@
+'use strict'
+
+exports.config = Object.assign({}, require('./hooks'), {
+ hostname: 'chromedriver',
+ path: '/',
+ capabilities: [
+ {
+ // Set maxInstances to 1 if screen recordings are enabled:
+ // maxInstances: 1,
+ browserName: 'chrome',
+ 'goog:chromeOptions': {
+ // Disable headless mode if screen recordings are enabled:
+ args: ['--headless', '--window-size=1440,900']
+ }
+ }
+ ],
+ logLevel: 'warn',
+ reporters: ['spec'],
+ framework: 'mocha',
+ mochaOpts: {
+ timeout: 60000
+ },
+ specs: ['test/specs/**/*.js'],
+ maximizeWindow: true,
+ screenshots: {
+ saveOnFail: true
+ },
+ videos: {
+ enabled: false,
+ resolution: '1440x900',
+ startDelay: 500,
+ stopDelay: 500
+ },
+ assetsDir: '/home/webdriver/assets/',
+ baseUrl: 'http://example'
+})
diff --git a/vendor/blueimp/jquery-file-upload/wdio/firefox.js b/vendor/blueimp/jquery-file-upload/wdio/firefox.js
new file mode 100644
index 000000000..ab91dcb79
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/firefox.js
@@ -0,0 +1,21 @@
+'use strict'
+
+exports.config = Object.assign({}, require('./chrome').config, {
+ hostname: 'geckodriver',
+ capabilities: [
+ {
+ // geckodriver supports no parallel sessions:
+ maxInstances: 1,
+ browserName: 'firefox',
+ 'moz:firefoxOptions': {
+ //args: ['-headless', '--window-size=1440,900']
+ }
+ }
+ ],
+ videos: {
+ enabled: true,
+ resolution: '1440x900',
+ startDelay: 500,
+ stopDelay: 500
+ }
+})
diff --git a/vendor/blueimp/jquery-file-upload/wdio/hooks/index.js b/vendor/blueimp/jquery-file-upload/wdio/hooks/index.js
new file mode 100644
index 000000000..9ce5c52fd
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/hooks/index.js
@@ -0,0 +1,21 @@
+'use strict'
+
+/* global browser */
+
+const cmds = require('wdio-screen-commands')
+
+module.exports = {
+ before: () => {
+ global.should = require('chai').should()
+ browser.addCommand('saveScreenshotByName', cmds.saveScreenshotByName)
+ browser.addCommand('saveAndDiffScreenshot', cmds.saveAndDiffScreenshot)
+ if (browser.config.maximizeWindow) browser.maximizeWindow()
+ },
+ beforeTest: test => {
+ cmds.startScreenRecording(test)
+ },
+ afterTest: async test => {
+ await cmds.stopScreenRecording(test)
+ cmds.saveScreenshotByTest(test)
+ }
+}
diff --git a/vendor/blueimp/jquery-file-upload/wdio/ie.js b/vendor/blueimp/jquery-file-upload/wdio/ie.js
new file mode 100644
index 000000000..8fff1161e
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/ie.js
@@ -0,0 +1,20 @@
+'use strict'
+
+exports.config = Object.assign({}, require('./chrome').config, {
+ hostname: process.env.WINDOWS_HOST || 'host.docker.internal',
+ port: 4445,
+ capabilities: [
+ {
+ // IEDriverServer supports no parallel sessions:
+ maxInstances: 1,
+ browserName: 'internet explorer'
+ }
+ ],
+ videos: {
+ enabled: true,
+ inputFormat: 'mjpeg',
+ startDelay: 500,
+ stopDelay: 500
+ },
+ assetsDir: process.env.WINDOWS_ASSETS_DIR
+})
diff --git a/vendor/blueimp/jquery-file-upload/wdio/reports/.gitignore b/vendor/blueimp/jquery-file-upload/wdio/reports/.gitignore
new file mode 100644
index 000000000..120f485d7
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/reports/.gitignore
@@ -0,0 +1,2 @@
+*
+!/.gitignore
diff --git a/vendor/blueimp/jquery-file-upload/wdio/safari.js b/vendor/blueimp/jquery-file-upload/wdio/safari.js
new file mode 100644
index 000000000..360909b33
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/safari.js
@@ -0,0 +1,20 @@
+'use strict'
+
+exports.config = Object.assign({}, require('./chrome').config, {
+ // Docker for Mac host address:
+ hostname: 'host.docker.internal',
+ capabilities: [
+ {
+ // safaridriver supports no parallel sessions:
+ maxInstances: 1,
+ browserName: 'safari'
+ }
+ ],
+ videos: {
+ enabled: true,
+ inputFormat: 'mjpeg',
+ startDelay: 500,
+ stopDelay: 500
+ },
+ assetsDir: process.env.MACOS_ASSETS_DIR
+})
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
new file mode 100644
index 000000000..dfef36394
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/test/pages/file-upload.js
@@ -0,0 +1,75 @@
+'use strict'
+
+/* global browser, $, $$ */
+/* eslint-disable class-methods-use-this */
+
+class FileUpload {
+ get fileinput() {
+ return $('.fileinput-button input')
+ }
+ get start() {
+ return $('.fileupload-buttonbar .start')
+ }
+ get toggle() {
+ return $('.fileupload-buttonbar .toggle')
+ }
+ get remove() {
+ return $('.fileupload-buttonbar .delete')
+ }
+ get processing() {
+ return $$('.files .processing')
+ }
+ get uploads() {
+ return $$('.files .template-upload')
+ }
+ get downloads() {
+ return $$('.files .template-download')
+ }
+ get checked() {
+ return $$('.files .toggle:checked')
+ }
+ /**
+ * Opens the file upload form.
+ *
+ * @param {number} [timeout] Wait timeout
+ * @returns {FileUpload} FileUpload object
+ */
+ open(timeout) {
+ browser.url('/')
+ this.fileinput.waitForExist(timeout)
+ return this
+ }
+ /**
+ * 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
+ }
+ /**
+ * 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,
+ timeout
+ )
+ this.remove.click()
+ browser.waitUntil(() => !this.downloads.length, timeout)
+ return this
+ }
+}
+
+module.exports = new FileUpload()
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
new file mode 100644
index 000000000..156dcc718
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/test/specs/01-file-upload.js
@@ -0,0 +1,23 @@
+'use strict'
+
+/* global browser, describe, it */
+
+const FileUpload = require('../pages/file-upload')
+const assetsDir = browser.config.assetsDir
+
+describe('File Upload', () => {
+ if (!assetsDir) return
+
+ it('uploads files', () => {
+ FileUpload.open().upload([
+ assetsDir + 'black-80x60.gif',
+ assetsDir + 'white-1x2.jpg'
+ ])
+ browser.saveAndDiffScreenshot('Files uploaded')
+ })
+
+ it('deletes files', () => {
+ FileUpload.open().delete()
+ browser.saveAndDiffScreenshot('Files deleted')
+ })
+})
diff --git a/vendor/blueimp/jquery-file-upload/wdio/wdio.conf.js b/vendor/blueimp/jquery-file-upload/wdio/wdio.conf.js
new file mode 100644
index 000000000..eb078d844
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/wdio/wdio.conf.js
@@ -0,0 +1 @@
+chrome.js \ No newline at end of file