@brightspace-ui/testing 1.21.0 → 1.22.0
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.22.0",
|
|
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,7 +125,8 @@ class App extends LitElement {
|
|
|
121
125
|
constructor() {
|
|
122
126
|
super();
|
|
123
127
|
this._filterBrowsers = data.browsers.map(b => b.name);
|
|
124
|
-
this.
|
|
128
|
+
this._filterHideByteDiff = false;
|
|
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;
|
|
127
132
|
this._overlay = true;
|
|
@@ -146,8 +151,7 @@ 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
|
|
150
|
-
filterStatus === FILTER_STATUS.BYTEDIFF && data.numByteDiff === 0) {
|
|
154
|
+
if (filterStatus === FILTER_STATUS.FAILED && data.numFailed === 0) {
|
|
151
155
|
filterStatus = FILTER_STATUS.ALL;
|
|
152
156
|
}
|
|
153
157
|
this._filterStatus = filterStatus;
|
|
@@ -155,6 +159,7 @@ class App extends LitElement {
|
|
|
155
159
|
if (searchParams.has('browsers')) {
|
|
156
160
|
this._filterBrowsers = searchParams.get('browsers').split(',');
|
|
157
161
|
}
|
|
162
|
+
this._filterHideByteDiff = searchParams.has('bytediff');
|
|
158
163
|
this._updateFiles();
|
|
159
164
|
});
|
|
160
165
|
page();
|
|
@@ -180,6 +185,9 @@ class App extends LitElement {
|
|
|
180
185
|
});
|
|
181
186
|
this._updateSearchParams({ browsers: browsers.join(',') });
|
|
182
187
|
}
|
|
188
|
+
_handleFilterByteDiffChange(e) {
|
|
189
|
+
this._updateSearchParams({ bytediff: !e.target.checked ? undefined : '1' });
|
|
190
|
+
}
|
|
183
191
|
_handleFilterStatusChange(e) {
|
|
184
192
|
this._updateSearchParams({ status: e.target.value });
|
|
185
193
|
}
|
|
@@ -201,8 +209,7 @@ class App extends LitElement {
|
|
|
201
209
|
|
|
202
210
|
const statusFilters = [
|
|
203
211
|
{ name: FILTER_STATUS.FAILED, count: data.numFailed },
|
|
204
|
-
{ name: FILTER_STATUS.
|
|
205
|
-
{ name: FILTER_STATUS.PASSED, count: data.numTests - data.numFailed - data.numByteDiff },
|
|
212
|
+
{ name: FILTER_STATUS.PASSED, count: data.numTests - data.numFailed },
|
|
206
213
|
{ name: FILTER_STATUS.ALL, count: data.numTests }
|
|
207
214
|
];
|
|
208
215
|
|
|
@@ -246,12 +253,22 @@ class App extends LitElement {
|
|
|
246
253
|
<ul>${browserDiffs}</ul>
|
|
247
254
|
</div>
|
|
248
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;
|
|
249
265
|
|
|
250
266
|
return html`
|
|
251
267
|
<fieldset>
|
|
252
268
|
<legend>Test Status</legend>
|
|
253
269
|
${statusFilters.map(f => renderStatusFilter(f))}
|
|
254
270
|
</fieldset>
|
|
271
|
+
${byteDiffFilter}
|
|
255
272
|
${browserFilter}
|
|
256
273
|
${browserDiffInfo}
|
|
257
274
|
`;
|
|
@@ -289,7 +306,7 @@ class App extends LitElement {
|
|
|
289
306
|
if (!this._filterBrowsers.includes(b.name)) return nothing;
|
|
290
307
|
const result = test.results.find(r => r.name === b.name);
|
|
291
308
|
const passed = (result !== undefined) ? result.passed : true;
|
|
292
|
-
const text = passed ? 'passed' : 'failed';
|
|
309
|
+
const text = passed ? 'passed' : (result.bytediff ? 'byte-diff' : 'failed');
|
|
293
310
|
return html`<td class="${text}">${text}</td>`;
|
|
294
311
|
});
|
|
295
312
|
const searchParams = new URLSearchParams(window.location.search);
|
|
@@ -381,7 +398,7 @@ class App extends LitElement {
|
|
|
381
398
|
const tabs = browsers.map((b) => {
|
|
382
399
|
const numPassed = browserResults.get(b.name);
|
|
383
400
|
return {
|
|
384
|
-
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 }),
|
|
385
402
|
label: b.name,
|
|
386
403
|
id: b.name.toLowerCase(),
|
|
387
404
|
selected: b.name === selectedBrowser.name,
|
|
@@ -436,10 +453,10 @@ class App extends LitElement {
|
|
|
436
453
|
let numStatusMatch = 0;
|
|
437
454
|
t.results.forEach(r => {
|
|
438
455
|
if (this._filterBrowsers.includes(r.name) &&
|
|
456
|
+
((!r.bytediff || !this._filterHideByteDiff) &&
|
|
439
457
|
(this._filterStatus === FILTER_STATUS.ALL ||
|
|
440
458
|
r.passed && this._filterStatus === FILTER_STATUS.PASSED ||
|
|
441
|
-
r.
|
|
442
|
-
!r.bytediff && !r.passed && this._filterStatus === FILTER_STATUS.FAILED)) numStatusMatch++;
|
|
459
|
+
!r.passed && this._filterStatus === FILTER_STATUS.FAILED))) numStatusMatch++;
|
|
443
460
|
});
|
|
444
461
|
if (numStatusMatch > 0) {
|
|
445
462
|
if (lookingForNextTest) {
|
|
@@ -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
|
|
|
@@ -95,10 +95,9 @@ function flattenResults(session, browserData, fileData) {
|
|
|
95
95
|
if (bytediff) {
|
|
96
96
|
browserData.numByteDiff++;
|
|
97
97
|
testData.numByteDiff++;
|
|
98
|
-
} else {
|
|
99
|
-
browserData.numFailed++;
|
|
100
|
-
testData.numFailed++;
|
|
101
98
|
}
|
|
99
|
+
browserData.numFailed++;
|
|
100
|
+
testData.numFailed++;
|
|
102
101
|
}
|
|
103
102
|
testData.results.push({
|
|
104
103
|
name: browserData.name,
|
package/src/server/wtr-config.js
CHANGED
|
@@ -19,6 +19,7 @@ const ALLOWED_BROWSERS = Object.keys(BROWSER_MAP);
|
|
|
19
19
|
const DEFAULT_BROWSERS = [...new Set(Object.values(BROWSER_MAP))];
|
|
20
20
|
const TIMEZONE = '{"name":"Canada - Toronto","identifier":"America/Toronto"}';
|
|
21
21
|
const FONT_ASSETS = 'https://s.brightspace.com/lib/fonts/0.6.1/assets/';
|
|
22
|
+
const TEST_PAGE = '<script>window.isD2LTestPage = true;</script>';
|
|
22
23
|
const SUPPRESS_RESIZE_OBSERVER_ERRORS = `
|
|
23
24
|
<script>
|
|
24
25
|
window.addEventListener('error', (err) => {
|
|
@@ -53,6 +54,7 @@ export class WTRConfig {
|
|
|
53
54
|
`<!DOCTYPE html>
|
|
54
55
|
<html lang="en" data-timezone='${TIMEZONE}'>
|
|
55
56
|
<body>
|
|
57
|
+
${TEST_PAGE}
|
|
56
58
|
${SUPPRESS_RESIZE_OBSERVER_ERRORS}
|
|
57
59
|
<script type="module" src="${testFramework}"></script>
|
|
58
60
|
</body>
|
|
@@ -124,6 +126,7 @@ export class WTRConfig {
|
|
|
124
126
|
</style>
|
|
125
127
|
</head>
|
|
126
128
|
<body>
|
|
129
|
+
${TEST_PAGE}
|
|
127
130
|
${SUPPRESS_RESIZE_OBSERVER_ERRORS}
|
|
128
131
|
<script type="module" src="${testFramework}"></script>
|
|
129
132
|
</body>
|