@enact/ui-test-utils 2.0.0-alpha.1 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/config/wdio.conf.js +17 -23
- package/npm-shrinkwrap.json +7276 -8828
- package/package.json +16 -15
- package/screenshot/TestChooser.js +0 -1
- package/screenshot/utils/confHelpers.js +8 -0
- package/screenshot/wdio.conf.js +3 -2
- package/screenshot/wdio.tv.conf.js +8 -3
- package/ui/wdio.conf.js +2 -2
- package/ui/wdio.tv.conf.js +12 -4
- package/utils/runTest.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/ui-test-utils",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"description": "UI Testing for the Enact framework",
|
|
5
5
|
"repository": "https://github.com/enactjs/ui-test-utils",
|
|
6
6
|
"main": "index.js",
|
|
@@ -20,32 +20,33 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@wdio/cli": "^
|
|
24
|
-
"@wdio/dot-reporter": "^
|
|
25
|
-
"@wdio/local-runner": "
|
|
26
|
-
"@wdio/mocha-framework": "^
|
|
27
|
-
"@wdio/
|
|
28
|
-
"@wdio/
|
|
29
|
-
"@wdio/
|
|
30
|
-
"chalk": "^5.
|
|
23
|
+
"@wdio/cli": "^9.10.0",
|
|
24
|
+
"@wdio/dot-reporter": "^9.9.0",
|
|
25
|
+
"@wdio/local-runner": "9.2.1",
|
|
26
|
+
"@wdio/mocha-framework": "^9.9.0",
|
|
27
|
+
"@wdio/spec-reporter": "^9.9.0",
|
|
28
|
+
"@wdio/static-server-service": "^9.9.0",
|
|
29
|
+
"@wdio/visual-service": "^6.3.2",
|
|
30
|
+
"chalk": "^5.4.1",
|
|
31
31
|
"cross-spawn": "^7.0.6",
|
|
32
|
-
"expect-webdriverio": "^
|
|
33
|
-
"fs-extra": "^11.
|
|
32
|
+
"expect-webdriverio": "^5.1.0",
|
|
33
|
+
"fs-extra": "^11.3.0",
|
|
34
34
|
"minimist": "^1.2.8",
|
|
35
35
|
"query-string": "^7.1.3",
|
|
36
36
|
"ramda": "^0.30.1",
|
|
37
37
|
"readdirp": "^3.6.0",
|
|
38
38
|
"wdio-docker-service": "^3.2.1",
|
|
39
|
-
"wdio-
|
|
40
|
-
"webdriverio": "^
|
|
39
|
+
"wdio-selenium-standalone-service": "^0.0.12",
|
|
40
|
+
"webdriverio": "^9.10.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"eslint": "^9.
|
|
44
|
-
"eslint-config-enact": "^5.0.0-
|
|
43
|
+
"eslint": "^9.21.0",
|
|
44
|
+
"eslint-config-enact": "^5.0.0-rc.1",
|
|
45
45
|
"globals": "^15.14.0"
|
|
46
46
|
},
|
|
47
47
|
"overrides": {
|
|
48
48
|
"cross-spawn": "$cross-spawn",
|
|
49
|
+
"express": "^4.21.2",
|
|
49
50
|
"ws": "^8.18.0"
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -67,6 +67,14 @@ function beforeTest (testData) {
|
|
|
67
67
|
if (testData && testData.title && testData.title.indexOf('/') > 0) {
|
|
68
68
|
const filename = generateReferenceName({test: testData});
|
|
69
69
|
testData.ctx.isNewScreenshot = !fs.existsSync(filename);
|
|
70
|
+
|
|
71
|
+
// if there are no reference screenshots, we must create the folder before running the tests.
|
|
72
|
+
const specsPath = testData.title.split('~/');
|
|
73
|
+
specsPath.pop();
|
|
74
|
+
const referenceSpecsPath = path.join('tests/screenshot/dist/screenshots/reference', ...specsPath).replace(/ /g, '_');
|
|
75
|
+
if (testData.ctx.isNewScreenshot) {
|
|
76
|
+
fs.mkdirSync(referenceSpecsPath, {recursive: true});
|
|
77
|
+
}
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
80
|
|
package/screenshot/wdio.conf.js
CHANGED
|
@@ -4,12 +4,13 @@ const {afterTest, baselineFolder, beforeTest, onComplete, onPrepare, screenshotF
|
|
|
4
4
|
exports.config = configure({
|
|
5
5
|
base: 'screenshot',
|
|
6
6
|
services: [[
|
|
7
|
-
'
|
|
7
|
+
'visual',
|
|
8
8
|
{
|
|
9
9
|
baselineFolder: baselineFolder,
|
|
10
10
|
formatImageName: '{tag}',
|
|
11
11
|
screenshotPath: screenshotFolder,
|
|
12
|
-
autoSaveBaseline: true
|
|
12
|
+
autoSaveBaseline: true,
|
|
13
|
+
waitForFontsLoaded: true
|
|
13
14
|
}
|
|
14
15
|
]],
|
|
15
16
|
//
|
|
@@ -30,13 +30,18 @@ exports.config = Object.assign(
|
|
|
30
30
|
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
|
31
31
|
// grid with only 5 firefox instances available you can make sure that not more than
|
|
32
32
|
// 5 instances get started at a time.
|
|
33
|
-
maxInstances: 1,
|
|
33
|
+
'wdio:maxInstances': 1,
|
|
34
34
|
//
|
|
35
35
|
browserName: 'chrome',
|
|
36
|
+
/* WebdriverIO v8.14 and above downloads and uses the latest Chrome version when running tests.
|
|
37
|
+
We need to specify a browser version that match chromedriver version running in CI/CD environment to
|
|
38
|
+
ensure testing accuracy.
|
|
39
|
+
TODO: Update this version when chromedriver version in CI/CD is updated */
|
|
40
|
+
browserVersion: '120.0.6099.109',
|
|
36
41
|
'goog:chromeOptions': {
|
|
37
|
-
w3c: false,
|
|
38
42
|
debuggerAddress: `${process.env.TV_IP}:9998`
|
|
39
|
-
}
|
|
43
|
+
},
|
|
44
|
+
'wdio:enforceWebDriverClassic': true
|
|
40
45
|
}],
|
|
41
46
|
|
|
42
47
|
//
|
package/ui/wdio.conf.js
CHANGED
|
@@ -31,7 +31,7 @@ exports.config = configure({
|
|
|
31
31
|
* @param {Number} result.duration duration of test
|
|
32
32
|
* @param {Boolean} result.passed true if test has passed, otherwise false
|
|
33
33
|
*/
|
|
34
|
-
afterTest: function (testCase, _context, {duration, passed}) {
|
|
34
|
+
afterTest: async function (testCase, _context, {duration, passed}) {
|
|
35
35
|
if (duration > 2000) {
|
|
36
36
|
console.log(chalk.yellow(`Long running test case: ${testCase.title}: ${duration}ms`));
|
|
37
37
|
}
|
|
@@ -48,7 +48,7 @@ exports.config = configure({
|
|
|
48
48
|
fs.mkdirSync(this.screenshotPath, {recursive: true}); // May only work recursively on Node 10.12+
|
|
49
49
|
}
|
|
50
50
|
// save screenshot
|
|
51
|
-
browser.saveScreenshot(filePath);
|
|
51
|
+
await browser.saveScreenshot(filePath);
|
|
52
52
|
console.log('\n\tScreenshot location:', filePath, '\n');
|
|
53
53
|
},
|
|
54
54
|
afterSuite: function (_suite) {
|
package/ui/wdio.tv.conf.js
CHANGED
|
@@ -6,13 +6,21 @@ exports.config = Object.assign(
|
|
|
6
6
|
config,
|
|
7
7
|
{
|
|
8
8
|
capabilities: [{
|
|
9
|
-
maxInstances
|
|
10
|
-
|
|
9
|
+
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
|
10
|
+
// grid with only 5 firefox instances available you can make sure that not more than
|
|
11
|
+
// 5 instances get started at a time.
|
|
12
|
+
'wdio:maxInstances': 1,
|
|
13
|
+
//
|
|
11
14
|
browserName: 'chrome',
|
|
15
|
+
/* WebdriverIO v8.14 and above downloads and uses the latest Chrome version when running tests.
|
|
16
|
+
We need to specify a browser version that match chromedriver version running in CI/CD environment to
|
|
17
|
+
ensure testing accuracy.
|
|
18
|
+
TODO: Update this version when chromedriver version in CI/CD is updated */
|
|
19
|
+
browserVersion: '120.0.6099.109',
|
|
12
20
|
'goog:chromeOptions': {
|
|
13
|
-
w3c: false,
|
|
14
21
|
debuggerAddress: `${process.env.TV_IP}:9998`
|
|
15
|
-
}
|
|
22
|
+
},
|
|
23
|
+
'wdio:enforceWebDriverClassic': true
|
|
16
24
|
}],
|
|
17
25
|
|
|
18
26
|
baseUrl: `http://${ipAddress()}:4567`,
|
package/utils/runTest.js
CHANGED
|
@@ -66,7 +66,8 @@ const runTest = ({concurrency, filter, Page, testName, ...rest}) => {
|
|
|
66
66
|
expect(await browser.checkScreen(screenshotFileName, {
|
|
67
67
|
disableCSSAnimation: true,
|
|
68
68
|
ignoreNothing: true,
|
|
69
|
-
rawMisMatchPercentage: true
|
|
69
|
+
rawMisMatchPercentage: true,
|
|
70
|
+
waitForFontsLoaded: true
|
|
70
71
|
})).toBe(0);
|
|
71
72
|
});
|
|
72
73
|
});
|