selenium: Update wdio-mediawiki and fix window resizing

wdio-mediawiki v1.1.1:
- Includes wdio-defaults.conf.js file that vastly simplifies wdio.conf.js.
- Replaces @wdio/spec-reporter with @wdio/dot-reporter.
- Introduces video recording.

Some part of the new setup seems to influnce they way how resize is applied
to the window. The fix makes sure it works as expected.

Bug: T283597
Change-Id: I20697815591243367b5a8bdd1cd1cc173a1ddc77
This commit is contained in:
Adam Wight 2021-05-21 13:53:05 +02:00 committed by WMDE-Fisch
parent 322570c567
commit 40de993f4c
4 changed files with 152 additions and 181 deletions

226
package-lock.json generated
View file

@ -466,6 +466,12 @@
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
"dev": true "dev": true
}, },
"@types/cucumber": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@types/cucumber/-/cucumber-6.0.1.tgz",
"integrity": "sha512-+GZV6xfN0MeN9shDCdny8GbC8N0+U6uca8cjyaJndcwmrUhwS6qOU2vmYn0d71EOwJF568/v3SxJ8VKxuZNYRw==",
"dev": true
},
"@types/http-cache-semantics": { "@types/http-cache-semantics": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz", "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz",
@ -636,6 +642,52 @@
"glob": "^7.1.2" "glob": "^7.1.2"
} }
}, },
"@wdio/dot-reporter": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/@wdio/dot-reporter/-/dot-reporter-6.11.0.tgz",
"integrity": "sha512-0EmRTVazuNXrn4YVhhJ39brSUlsRg+WE22MSU1cNO1xif011C6MKE7ZS5HbS528uSY0dEFYxApyQJ/4TM4bhqQ==",
"dev": true,
"requires": {
"@wdio/reporter": "6.11.0",
"chalk": "^4.0.0"
},
"dependencies": {
"@wdio/reporter": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/@wdio/reporter/-/reporter-6.11.0.tgz",
"integrity": "sha512-SStNZZUI0bXI+omyIU6ql4Rh+Dews1dz1GlowHDrBxwKMPyAwytgYokXLn3zr+E3tkHDiRyJjQxfDetBWBGmtg==",
"dev": true,
"requires": {
"@types/cucumber": "^6.0.1",
"fs-extra": "^9.0.0"
}
}
}
},
"@wdio/junit-reporter": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/@wdio/junit-reporter/-/junit-reporter-6.11.0.tgz",
"integrity": "sha512-wOc1SYEHdGaLdO3zdcJ0U55p/LxMZL4erHSeqHMSJZLtuNPJYvj3RgRrhnVYMcnR6OjzIMC/acQ/hU2QwrzXNQ==",
"dev": true,
"requires": {
"@wdio/reporter": "6.11.0",
"json-stringify-safe": "^5.0.1",
"junit-report-builder": "^2.1.0",
"validator": "^13.0.0"
},
"dependencies": {
"@wdio/reporter": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/@wdio/reporter/-/reporter-6.11.0.tgz",
"integrity": "sha512-SStNZZUI0bXI+omyIU6ql4Rh+Dews1dz1GlowHDrBxwKMPyAwytgYokXLn3zr+E3tkHDiRyJjQxfDetBWBGmtg==",
"dev": true,
"requires": {
"@types/cucumber": "^6.0.1",
"fs-extra": "^9.0.0"
}
}
}
},
"@wdio/local-runner": { "@wdio/local-runner": {
"version": "6.3.6", "version": "6.3.6",
"resolved": "https://registry.npmjs.org/@wdio/local-runner/-/local-runner-6.3.6.tgz", "resolved": "https://registry.npmjs.org/@wdio/local-runner/-/local-runner-6.3.6.tgz",
@ -688,15 +740,6 @@
"@wdio/utils": "6.3.6" "@wdio/utils": "6.3.6"
} }
}, },
"@wdio/reporter": {
"version": "6.3.6",
"resolved": "https://registry.npmjs.org/@wdio/reporter/-/reporter-6.3.6.tgz",
"integrity": "sha512-u+iaIZS1oAyHUyXxzyr+pySi2gaFe7u1v6HD1vW6C0sNvICK+wFco4fOSpatizPnVSjuEamgI7ErngBdzUiUag==",
"dev": true,
"requires": {
"fs-extra": "^9.0.0"
}
},
"@wdio/runner": { "@wdio/runner": {
"version": "6.3.6", "version": "6.3.6",
"resolved": "https://registry.npmjs.org/@wdio/runner/-/runner-6.3.6.tgz", "resolved": "https://registry.npmjs.org/@wdio/runner/-/runner-6.3.6.tgz",
@ -712,18 +755,6 @@
"webdriverio": "6.3.6" "webdriverio": "6.3.6"
} }
}, },
"@wdio/spec-reporter": {
"version": "6.3.6",
"resolved": "https://registry.npmjs.org/@wdio/spec-reporter/-/spec-reporter-6.3.6.tgz",
"integrity": "sha512-RO/Bc8NIGE8VScrmJz8VNFtIAFoW02xOgFGD8J4LgObQ/cKyn/v6vxCCRgGv27DHYW4j0/rtrem/+z/hgU/C9w==",
"dev": true,
"requires": {
"@wdio/reporter": "6.3.6",
"chalk": "^4.0.0",
"easy-table": "^1.1.1",
"pretty-ms": "^7.0.0"
}
},
"@wdio/sync": { "@wdio/sync": {
"version": "6.3.6", "version": "6.3.6",
"resolved": "https://registry.npmjs.org/@wdio/sync/-/sync-6.3.6.tgz", "resolved": "https://registry.npmjs.org/@wdio/sync/-/sync-6.3.6.tgz",
@ -1375,13 +1406,6 @@
"wrap-ansi": "^6.2.0" "wrap-ansi": "^6.2.0"
} }
}, },
"clone": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
"dev": true,
"optional": true
},
"clone-regexp": { "clone-regexp": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz", "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz",
@ -1739,6 +1763,12 @@
"assert-plus": "^1.0.0" "assert-plus": "^1.0.0"
} }
}, },
"date-format": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/date-format/-/date-format-0.0.2.tgz",
"integrity": "sha1-+v1Ej3IRXvHitzkVWukvK+bCjdE=",
"dev": true
},
"dateformat": { "dateformat": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz",
@ -1799,16 +1829,6 @@
"integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==",
"dev": true "dev": true
}, },
"defaults": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
"dev": true,
"optional": true,
"requires": {
"clone": "^1.0.2"
}
},
"defer-to-connect": { "defer-to-connect": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.0.tgz", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.0.tgz",
@ -2093,24 +2113,6 @@
} }
} }
}, },
"easy-table": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/easy-table/-/easy-table-1.1.1.tgz",
"integrity": "sha512-C9Lvm0WFcn2RgxbMnTbXZenMIWcBtkzMr+dWqq/JsVoGFSVUVlPqeOa5LP5kM0I3zoOazFpckOEb2/0LDFfToQ==",
"dev": true,
"requires": {
"ansi-regex": "^3.0.0",
"wcwidth": ">=1.0.1"
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"dev": true
}
}
},
"ecc-jsbn": { "ecc-jsbn": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
@ -4364,6 +4366,18 @@
"verror": "1.10.0" "verror": "1.10.0"
} }
}, },
"junit-report-builder": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/junit-report-builder/-/junit-report-builder-2.1.0.tgz",
"integrity": "sha512-Ioj5I4w18ZcHFaaisqCKdh1z+ipzN7sA2JB+h+WOlGcOMWm0FFN1dfxkgc2I4EXfhSP/mOfM3W43uFzEdz4sTw==",
"dev": true,
"requires": {
"date-format": "0.0.2",
"lodash": "^4.17.15",
"make-dir": "^1.3.0",
"xmlbuilder": "^10.0.0"
}
},
"keyv": { "keyv": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.1.tgz", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.1.tgz",
@ -4666,6 +4680,23 @@
"yallist": "^2.1.2" "yallist": "^2.1.2"
} }
}, },
"make-dir": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
"integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==",
"dev": true,
"requires": {
"pify": "^3.0.0"
},
"dependencies": {
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
}
}
},
"make-iterator": { "make-iterator": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz",
@ -5602,12 +5633,6 @@
"error-ex": "^1.2.0" "error-ex": "^1.2.0"
} }
}, },
"parse-ms": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz",
"integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==",
"dev": true
},
"parse-passwd": { "parse-passwd": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz",
@ -5892,15 +5917,6 @@
"react-is": "^16.12.0" "react-is": "^16.12.0"
} }
}, },
"pretty-ms": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.0.tgz",
"integrity": "sha512-J3aPWiC5e9ZeZFuSeBraGxSkGMOvulSWsxDByOcbD1Pr75YL3LSNIKIb52WXbCLE1sS5s4inBBbryjF4Y05Ceg==",
"dev": true,
"requires": {
"parse-ms": "^2.1.0"
}
},
"prettyjson": { "prettyjson": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/prettyjson/-/prettyjson-1.2.1.tgz", "resolved": "https://registry.npmjs.org/prettyjson/-/prettyjson-1.2.1.tgz",
@ -7312,6 +7328,12 @@
"spdx-expression-parse": "^3.0.0" "spdx-expression-parse": "^3.0.0"
} }
}, },
"validator": {
"version": "13.6.0",
"resolved": "https://registry.npmjs.org/validator/-/validator-13.6.0.tgz",
"integrity": "sha512-gVgKbdbHgtxpRyR8K0O6oFZPhhB5tT1jeEHZR0Znr9Svg03U0+r9DXWMrnRAB+HtCStDQKlaIZm42tVsVjqtjg==",
"dev": true
},
"verror": { "verror": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
@ -7388,23 +7410,51 @@
} }
} }
}, },
"wcwidth": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
"dev": true,
"optional": true,
"requires": {
"defaults": "^1.0.3"
}
},
"wdio-mediawiki": { "wdio-mediawiki": {
"version": "1.0.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/wdio-mediawiki/-/wdio-mediawiki-1.0.0.tgz", "resolved": "https://registry.npmjs.org/wdio-mediawiki/-/wdio-mediawiki-1.1.1.tgz",
"integrity": "sha512-eKrPx3MHTQvWaI+YUi6pLmebOdsdBegnx5MJx8m9ejh6US7TIKKzLmsh9p9gfj6PW7HzHNN/e8EkDwKo3M0kJg==", "integrity": "sha512-bbOnxzxuCJXG5KaccoeUyc525f9rxfaTqjWm26AWRPoKx2i4+jp9qlXQ+WywqwL4CvMen9by396s2DA/is1pmA==",
"dev": true, "dev": true,
"requires": { "requires": {
"mwbot": "1.0.10" "mwbot": "2.0.0"
},
"dependencies": {
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"requires": {
"yallist": "^4.0.0"
}
},
"mwbot": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/mwbot/-/mwbot-2.0.0.tgz",
"integrity": "sha512-9iTx8oFMntC60yyaPJjN4GEgiQlal7i03jATu7kq5b9BGW5aNz7YbrpjaciLNr0Z33PTdQe0hRTJ0JdUJi2WQg==",
"dev": true,
"requires": {
"bluebird": "^3.7.2",
"request": "^2.88.2",
"semlog": "^0.6.10",
"semver": "7.3.4"
}
},
"semver": {
"version": "7.3.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz",
"integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
}
} }
}, },
"webdriver": { "webdriver": {
@ -7554,6 +7604,12 @@
"integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==", "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==",
"dev": true "dev": true
}, },
"xmlbuilder": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-10.1.1.tgz",
"integrity": "sha512-OyzrcFLL/nb6fMGHbiRDuPup9ljBycsdCypwuyg5AAHvyWzGfChJpCXMG88AGTIMFhGZ9RccFN1e6lhg3hkwKg==",
"dev": true
},
"xtend": { "xtend": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",

View file

@ -8,9 +8,10 @@
}, },
"devDependencies": { "devDependencies": {
"@wdio/cli": "6.3.6", "@wdio/cli": "6.3.6",
"@wdio/dot-reporter": "6.11.0",
"@wdio/junit-reporter": "6.11.0",
"@wdio/local-runner": "6.3.6", "@wdio/local-runner": "6.3.6",
"@wdio/mocha-framework": "6.3.6", "@wdio/mocha-framework": "6.3.6",
"@wdio/spec-reporter": "6.3.6",
"@wdio/sync": "6.3.6", "@wdio/sync": "6.3.6",
"eslint-config-wikimedia": "0.20.0", "eslint-config-wikimedia": "0.20.0",
"grunt": "1.4.0", "grunt": "1.4.0",
@ -20,7 +21,7 @@
"mwbot": "1.0.10", "mwbot": "1.0.10",
"stylelint-config-wikimedia": "0.10.3", "stylelint-config-wikimedia": "0.10.3",
"svgo": "2.3.0", "svgo": "2.3.0",
"wdio-mediawiki": "1.0.0", "wdio-mediawiki": "1.1.1",
"webdriverio": "6.3.6" "webdriverio": "6.3.6"
} }
} }

View file

@ -25,7 +25,7 @@ describe( 'RevisionSlider timeline arrows', function () {
} ); } );
it( ' should be enabled with adequate revisions', function () { it( ' should be enabled with adequate revisions', function () {
browser.setWindowSize( 80, 600 ); browser.setWindowSize( 400, 600 );
DiffPage.prepareSimpleTests( 9 ); DiffPage.prepareSimpleTests( 9 );
DiffPage.ready(); DiffPage.ready();
DiffPage.openSlider(); DiffPage.openSlider();

View file

@ -1,97 +1,11 @@
/**
* See also: http://webdriver.io/guide/testrunner/configurationfile.html
*/
'use strict'; 'use strict';
const fs = require( 'fs' ), const { config } = require( 'wdio-mediawiki/wdio-defaults.conf.js' );
saveScreenshot = require( 'wdio-mediawiki' ).saveScreenshot;
exports.config = { exports.config = { ...config
// ====== // Override, or add to, the setting from wdio-mediawiki.
// Custom WDIO config specific to MediaWiki // Learn more at https://webdriver.io/docs/configurationfile/
// ====== //
// Use in a test as `browser.options.<key>`. // Example:
// Defaults are for convenience with MediaWiki-Vagrant // logLevel: 'info',
// ==================
// Runner Configuration
// ==================
runner: 'local',
// The standalone chromedriver uses "/wd/hub".
path: '/wd/hub',
// Wiki admin
mwUser: process.env.MEDIAWIKI_USER || 'Admin',
mwPwd: process.env.MEDIAWIKI_PASSWORD || 'vagrant',
// Base for browser.url() and Page#openTitle()
baseUrl: ( process.env.MW_SERVER || 'http://127.0.0.1:8080' ) + (
process.env.MW_SCRIPT_PATH || '/w'
),
// ==================
// Test Files
// ==================
specs: [
__dirname + '/specs/*.js'
],
// ============
// Capabilities
// ============
capabilities: [ {
// https://sites.google.com/a/chromium.org/chromedriver/capabilities
browserName: 'chrome',
maxInstances: 1,
'goog:chromeOptions': {
// If DISPLAY is set, assume developer asked non-headless or CI with Xvfb.
// Otherwise, use --headless (added in Chrome 59)
// https://chromium.googlesource.com/chromium/src/+/59.0.3030.0/headless/README.md
args: [
...( process.env.DISPLAY ? [] : [ '--headless' ] ),
// Chrome sandbox does not work in Docker
...( fs.existsSync( '/.dockerenv' ) ? [ '--no-sandbox' ] : [] )
]
}
} ],
// ===================
// Test Configurations
// ===================
// Level of verbosity: silent | verbose | command | data | result | error
logLevel: 'error',
// Setting this enables automatic screenshots for when a browser command fails
// It is also used by afterTest for capturig failed assertions.
screenshotPath: process.env.LOG_DIR || __dirname + '/log',
// Default timeout for each waitFor* command.
waitforTimeout: 10 * 1000,
// See also: http://webdriver.io/guide/testrunner/reporters.html
reporters: [ 'spec' ],
// See also: http://mochajs.org
mochaOpts: {
ui: 'bdd',
timeout: 60 * 1000
},
// =====
// Hooks
// =====
/**
* Save a screenshot when test fails.
*
* @param {Object} test Mocha Test object
*/
afterTest: function ( test ) {
if ( !test.passed ) {
const filePath = saveScreenshot( test.title );
console.log( '\n\tScreenshot: ' + filePath + '\n' );
}
}
}; };