@brightspace-ui/testing 1.20.0 → 1.21.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/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@brightspace-ui/testing",
|
|
3
3
|
"description": "Utilities for testing front-end components and applications",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.21.1",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/testing.git",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "npm run lint:eslint && npm run lint:style",
|
package/src/server/report/app.js
CHANGED
|
@@ -11,6 +11,7 @@ import page from 'page';
|
|
|
11
11
|
class App extends LitElement {
|
|
12
12
|
static properties = {
|
|
13
13
|
_files: { state: true },
|
|
14
|
+
_filterHideByteDiff: { state: true },
|
|
14
15
|
_filterFile: { state: true },
|
|
15
16
|
_filterTest: { state: true },
|
|
16
17
|
_fullMode: { state: true },
|
|
@@ -60,6 +61,9 @@ class App extends LitElement {
|
|
|
60
61
|
white-space: normal;
|
|
61
62
|
width: 100%;
|
|
62
63
|
}
|
|
64
|
+
td.byte-diff {
|
|
65
|
+
background-color: #fbf9c6;
|
|
66
|
+
}
|
|
63
67
|
td.passed {
|
|
64
68
|
background-color: #efffd9;
|
|
65
69
|
}
|
|
@@ -121,6 +125,7 @@ class App extends LitElement {
|
|
|
121
125
|
constructor() {
|
|
122
126
|
super();
|
|
123
127
|
this._filterBrowsers = data.browsers.map(b => b.name);
|
|
128
|
+
this._filterHideByteDiff = false;
|
|
124
129
|
this._filterStatus = data.numFailed > 0 ? FILTER_STATUS.FAILED : FILTER_STATUS.ALL;
|
|
125
130
|
this._fullMode = FULL_MODE.GOLDEN.value;
|
|
126
131
|
this._layout = LAYOUTS.SPLIT.value;
|
|
@@ -146,12 +151,15 @@ class App extends LitElement {
|
|
|
146
151
|
}
|
|
147
152
|
if (searchParams.has('status')) {
|
|
148
153
|
let filterStatus = searchParams.get('status');
|
|
149
|
-
if (filterStatus === FILTER_STATUS.FAILED && data.numFailed === 0)
|
|
154
|
+
if (filterStatus === FILTER_STATUS.FAILED && data.numFailed === 0) {
|
|
155
|
+
filterStatus = FILTER_STATUS.ALL;
|
|
156
|
+
}
|
|
150
157
|
this._filterStatus = filterStatus;
|
|
151
158
|
}
|
|
152
159
|
if (searchParams.has('browsers')) {
|
|
153
160
|
this._filterBrowsers = searchParams.get('browsers').split(',');
|
|
154
161
|
}
|
|
162
|
+
this._filterHideByteDiff = searchParams.has('bytediff');
|
|
155
163
|
this._updateFiles();
|
|
156
164
|
});
|
|
157
165
|
page();
|
|
@@ -177,6 +185,9 @@ class App extends LitElement {
|
|
|
177
185
|
});
|
|
178
186
|
this._updateSearchParams({ browsers: browsers.join(',') });
|
|
179
187
|
}
|
|
188
|
+
_handleFilterByteDiffChange(e) {
|
|
189
|
+
this._updateSearchParams({ bytediff: !e.target.checked ? undefined : '1' });
|
|
190
|
+
}
|
|
180
191
|
_handleFilterStatusChange(e) {
|
|
181
192
|
this._updateSearchParams({ status: e.target.value });
|
|
182
193
|
}
|
|
@@ -242,12 +253,22 @@ class App extends LitElement {
|
|
|
242
253
|
<ul>${browserDiffs}</ul>
|
|
243
254
|
</div>
|
|
244
255
|
` : nothing;
|
|
256
|
+
const byteDiffFilter = (data.numByteDiff > 0) ? html`
|
|
257
|
+
<fieldset>
|
|
258
|
+
<legend>Byte Diffs</legend>
|
|
259
|
+
<label>
|
|
260
|
+
<input type="checkbox" ?checked="${this._filterHideByteDiff}" @change="${this._handleFilterByteDiffChange}">
|
|
261
|
+
Hide tests with only file size differences (${data.numByteDiff})
|
|
262
|
+
</label>
|
|
263
|
+
</fieldset>
|
|
264
|
+
` : nothing;
|
|
245
265
|
|
|
246
266
|
return html`
|
|
247
267
|
<fieldset>
|
|
248
268
|
<legend>Test Status</legend>
|
|
249
269
|
${statusFilters.map(f => renderStatusFilter(f))}
|
|
250
270
|
</fieldset>
|
|
271
|
+
${byteDiffFilter}
|
|
251
272
|
${browserFilter}
|
|
252
273
|
${browserDiffInfo}
|
|
253
274
|
`;
|
|
@@ -285,7 +306,7 @@ class App extends LitElement {
|
|
|
285
306
|
if (!this._filterBrowsers.includes(b.name)) return nothing;
|
|
286
307
|
const result = test.results.find(r => r.name === b.name);
|
|
287
308
|
const passed = (result !== undefined) ? result.passed : true;
|
|
288
|
-
const text = passed ? 'passed' : 'failed';
|
|
309
|
+
const text = passed ? 'passed' : (result.bytediff ? 'byte-diff' : 'failed');
|
|
289
310
|
return html`<td class="${text}">${text}</td>`;
|
|
290
311
|
});
|
|
291
312
|
const searchParams = new URLSearchParams(window.location.search);
|
|
@@ -377,7 +398,7 @@ class App extends LitElement {
|
|
|
377
398
|
const tabs = browsers.map((b) => {
|
|
378
399
|
const numPassed = browserResults.get(b.name);
|
|
379
400
|
return {
|
|
380
|
-
content: renderBrowserResults(b, tests, { filterStatus: this._filterStatus, fullMode: this._fullMode, layout: this._layout, showOverlay: this._overlay }),
|
|
401
|
+
content: renderBrowserResults(b, tests, { filterHideByteDiff: this._filterHideByteDiff, filterStatus: this._filterStatus, fullMode: this._fullMode, layout: this._layout, showOverlay: this._overlay }),
|
|
381
402
|
label: b.name,
|
|
382
403
|
id: b.name.toLowerCase(),
|
|
383
404
|
selected: b.name === selectedBrowser.name,
|
|
@@ -432,9 +453,10 @@ class App extends LitElement {
|
|
|
432
453
|
let numStatusMatch = 0;
|
|
433
454
|
t.results.forEach(r => {
|
|
434
455
|
if (this._filterBrowsers.includes(r.name) &&
|
|
456
|
+
((!r.bytediff || !this._filterHideByteDiff) &&
|
|
435
457
|
(this._filterStatus === FILTER_STATUS.ALL ||
|
|
436
458
|
r.passed && this._filterStatus === FILTER_STATUS.PASSED ||
|
|
437
|
-
!r.passed && this._filterStatus === FILTER_STATUS.FAILED)) numStatusMatch++;
|
|
459
|
+
!r.passed && this._filterStatus === FILTER_STATUS.FAILED))) numStatusMatch++;
|
|
438
460
|
});
|
|
439
461
|
if (numStatusMatch > 0) {
|
|
440
462
|
if (lookingForNextTest) {
|
|
@@ -175,7 +175,7 @@ function renderResult(resultData, options) {
|
|
|
175
175
|
let newPart;
|
|
176
176
|
if (resultData.passed) {
|
|
177
177
|
newPart = html`<div class="result-graphic padding">${ICON_TADA}<p>Hooray! No changes here.</p></div>`;
|
|
178
|
-
} else if (
|
|
178
|
+
} else if (resultData.bytediff) {
|
|
179
179
|
newPart = html`<div class="result-graphic padding">${ICON_BYTES}
|
|
180
180
|
<p>No pixels have changed, but the bytes are different.</p>
|
|
181
181
|
<p class="details">
|
|
@@ -207,7 +207,8 @@ export function renderBrowserResults(browser, tests, options) {
|
|
|
207
207
|
|
|
208
208
|
const resultData = t.results.find(r => r.name === browser.name);
|
|
209
209
|
if (resultData.passed && options.filterStatus === FILTER_STATUS.FAILED ||
|
|
210
|
-
!resultData.passed && options.filterStatus === FILTER_STATUS.PASSED
|
|
210
|
+
!resultData.passed && options.filterStatus === FILTER_STATUS.PASSED ||
|
|
211
|
+
resultData.bytediff && options.filterHideByteDiff) {
|
|
211
212
|
return acc;
|
|
212
213
|
}
|
|
213
214
|
|
|
@@ -27,6 +27,7 @@ function createData(rootDir, updateGoldens, sessions) {
|
|
|
27
27
|
const prevBrowser = metadata.browsers?.find(b => b.name === browserName);
|
|
28
28
|
browsers.set(browserName, {
|
|
29
29
|
name: browserName,
|
|
30
|
+
numByteDiff: 0,
|
|
30
31
|
numFailed: 0,
|
|
31
32
|
version: parseInt(s.browser.browser.version()),
|
|
32
33
|
previousVersion: prevBrowser?.version
|
|
@@ -36,14 +37,14 @@ function createData(rootDir, updateGoldens, sessions) {
|
|
|
36
37
|
|
|
37
38
|
const fileName = s.testFile.substring(rootDir.length + 1);
|
|
38
39
|
if (!files.has(fileName)) {
|
|
39
|
-
files.set(fileName, { name: fileName, numFailed: 0, tests: new Map() });
|
|
40
|
+
files.set(fileName, { name: fileName, numByteDiff: 0, numFailed: 0, tests: new Map() });
|
|
40
41
|
}
|
|
41
42
|
const fileData = files.get(fileName);
|
|
42
43
|
flattenResults(s, browserData, fileData);
|
|
43
44
|
|
|
44
45
|
});
|
|
45
46
|
|
|
46
|
-
let numTests = 0, numFailed = 0;
|
|
47
|
+
let numTests = 0, numFailed = 0, numByteDiff = 0;
|
|
47
48
|
files.forEach(f => {
|
|
48
49
|
numTests += f.tests.size;
|
|
49
50
|
f.tests.forEach(t => {
|
|
@@ -51,6 +52,10 @@ function createData(rootDir, updateGoldens, sessions) {
|
|
|
51
52
|
f.numFailed++;
|
|
52
53
|
numFailed++;
|
|
53
54
|
}
|
|
55
|
+
if (t.numByteDiff > 0) {
|
|
56
|
+
f.numByteDiff++;
|
|
57
|
+
numByteDiff++;
|
|
58
|
+
}
|
|
54
59
|
});
|
|
55
60
|
});
|
|
56
61
|
|
|
@@ -61,7 +66,7 @@ function createData(rootDir, updateGoldens, sessions) {
|
|
|
61
66
|
writeFileSync(metadataPath, `${JSON.stringify(metadata, undefined, '\t')}\n`);
|
|
62
67
|
}
|
|
63
68
|
|
|
64
|
-
return { browsers, files, numFailed, numTests };
|
|
69
|
+
return { browsers, files, numByteDiff, numFailed, numTests };
|
|
65
70
|
|
|
66
71
|
}
|
|
67
72
|
|
|
@@ -79,12 +84,18 @@ function flattenResults(session, browserData, fileData) {
|
|
|
79
84
|
if (!fileData.tests.has(testName)) {
|
|
80
85
|
fileData.tests.set(testName, {
|
|
81
86
|
name: testName,
|
|
87
|
+
numByteDiff: 0,
|
|
82
88
|
numFailed: 0,
|
|
83
89
|
results: []
|
|
84
90
|
});
|
|
85
91
|
}
|
|
86
92
|
const testData = fileData.tests.get(testName);
|
|
93
|
+
const bytediff = !t.passed && !info.diff && info.pixelsDiff === 0;
|
|
87
94
|
if (!t.passed) {
|
|
95
|
+
if (bytediff) {
|
|
96
|
+
browserData.numByteDiff++;
|
|
97
|
+
testData.numByteDiff++;
|
|
98
|
+
}
|
|
88
99
|
browserData.numFailed++;
|
|
89
100
|
testData.numFailed++;
|
|
90
101
|
}
|
|
@@ -93,6 +104,7 @@ function flattenResults(session, browserData, fileData) {
|
|
|
93
104
|
duration: t.duration,
|
|
94
105
|
error: t.error?.message,
|
|
95
106
|
passed: t.passed,
|
|
107
|
+
bytediff,
|
|
96
108
|
info: info
|
|
97
109
|
});
|
|
98
110
|
});
|