@brightspace-ui/testing 1.21.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.21.0",
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",
@@ -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._filterStatus = data.numFailed > 0 ? FILTER_STATUS.FAILED : (data.numByteDiff > 0 ? FILTER_STATUS.BYTEDIFF : FILTER_STATUS.ALL);
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.BYTEDIFF, count: data.numByteDiff },
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.bytediff && this._filterStatus === FILTER_STATUS.BYTEDIFF ||
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) {
@@ -77,8 +77,7 @@ export const COMMON_STYLE = css`
77
77
  export const FILTER_STATUS = {
78
78
  ALL: 'All',
79
79
  PASSED: 'Passed',
80
- FAILED: 'Failed',
81
- BYTEDIFF: 'Byte Diff'
80
+ FAILED: 'Failed'
82
81
  };
83
82
 
84
83
  export const FULL_MODE = {
@@ -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,