Skip to content

Commit 0698bdc

Browse files
test: fix breaking unit and screenshot tests
1 parent 7aea067 commit 0698bdc

File tree

239 files changed

+4821
-2449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+4821
-2449
lines changed

.github/workflows/test-on-pr-branch.yml

+36-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Test on PR branch
22
on: pull_request
33

44
jobs:
5-
test-on-pr-branch:
6-
runs-on: ubuntu-latest
5+
unit:
6+
runs-on: ubuntu-20.04
77
steps:
88
- name: Checkout
99
uses: actions/checkout@v3
@@ -19,5 +19,37 @@ jobs:
1919
- name: Install playwright browsers
2020
run: npx playwright install --with-deps
2121

22-
- name: Run tests
23-
run: npm run-script test
22+
- name: Run unit tests
23+
run: npm run-script test:unit
24+
visual:
25+
runs-on: ubuntu-20.04
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
30+
- name: Set up Node.js
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: '20'
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Install playwright browsers
39+
run: npx playwright install --with-deps
40+
41+
- name: Run visual test
42+
run: npm run-script test:visual
43+
44+
- name: Update screenshots
45+
if: failure()
46+
run: npm run test:update
47+
48+
- name: Upload failed screenshots as artifacts
49+
uses: actions/upload-artifact@v4
50+
if: failure()
51+
with:
52+
name: failed_screenshots
53+
path: |
54+
screenshots/*/failed/
55+
screenshots/*/baseline/

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: [push, workflow_dispatch]
33

44
jobs:
55
test:
6-
runs-on: ubuntu-latest
6+
runs-on: ubuntu-20.04
77
steps:
88
- name: Checkout
99
uses: actions/checkout@v3
@@ -20,4 +20,4 @@ jobs:
2020
run: npx playwright install --with-deps
2121

2222
- name: Run tests
23-
run: npm run-script test
23+
run: npm run test

.github/workflows/update-screenshots.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: workflow_dispatch
44

55
jobs:
66
test:
7-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-20.04
88
steps:
99
- name: Checkout
1010
uses: actions/checkout@v3

editors/dataset/data-set-element-editor.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ export class DataSetElementEditor extends LitElement {
101101

102102
@state()
103103
private get name(): string | null {
104-
return this.element!.getAttribute('name');
104+
return this.element?.getAttribute('name') ?? null;
105105
}
106106

107107
@state()
108108
private get desc(): string | null {
109-
return this.element!.getAttribute('desc');
109+
return this.element?.getAttribute('desc') ?? null;
110110
}
111111

112112
@state()
113113
private get fcdaCount(): number {
114-
return this.element!.querySelectorAll('FCDA').length;
114+
return this.element?.querySelectorAll('FCDA').length ?? 0;
115115
}
116116

117117
@state()

editors/gsecontrol/gse-control-element-editor.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('GSEControl element editor component', () => {
137137

138138
await timeout(400);
139139

140-
(editor.gSEControlInputs![4] as SclCheckbox).nullSwitch?.click();
140+
(editor.gSEControlInputs![5] as SclCheckbox).nullSwitch?.click();
141141

142142
await editor.updateComplete;
143143
await timeout(400);
@@ -153,7 +153,7 @@ describe('GSEControl element editor component', () => {
153153
beforeEach(async () => {
154154
const gseControl = new DOMParser()
155155
.parseFromString(gseControlDoc, 'application/xml')
156-
.querySelector('GSEControl[name="gse3"]')!;
156+
.querySelector('GSEControl[name="gse2"]')!;
157157

158158
editor = await fixture(
159159
html`<gse-control-element-editor

editors/report/report-control-element-editor.spec.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ describe('ReportControl element editor component', () => {
6565
expect(update.attributes).to.deep.equal({
6666
name: 'SomeNewName',
6767
desc: null,
68-
confRev: '40001',
68+
confRev: '10053',
6969
rptID: 'someOtherID',
7070
buffered: 'false',
71-
indexed: 'false',
72-
bufTime: null,
71+
indexed: null,
7372
intgPd: '43',
7473
});
7574

editors/report/report-control-element-editor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ export class ReportControlElementEditor extends LitElement {
401401
@input=${this.onReportControlInputChange}
402402
></scl-text-field>
403403
<scl-text-field
404-
class="input gsecontrol"
404+
class="report attributes"
405405
label="confRev"
406406
.value=${confRev}
407407
supportingText="Configuration Revision"

editors/sampledvalue/sampled-value-control-element-editor.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('SampledValueControl element editor component', () => {
137137

138138
await timeout(400);
139139

140-
(editor.sampledValueControlInputs![3] as SclCheckbox).nullSwitch?.click();
140+
(editor.sampledValueControlInputs![4] as SclCheckbox).nullSwitch?.click();
141141

142142
await editor.updateComplete;
143143
await timeout(400);
@@ -153,7 +153,7 @@ describe('SampledValueControl element editor component', () => {
153153
beforeEach(async () => {
154154
const smvControl = new DOMParser()
155155
.parseFromString(smvControlDoc, 'application/xml')
156-
.querySelector('SampledValueControl[name="smv3"]')!;
156+
.querySelector('SampledValueControl[name="smv2"]')!;
157157

158158
editor = await fixture(
159159
html`<sampled-value-control-element-editor

editors/sampledvalue/sampled-value-control-element-editor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export class SampledValueControlElementEditor extends LitElement {
406406
@input="${this.onSampledValueControlInputChange}"
407407
></scl-checkbox>`}
408408
<scl-text-field
409-
class="input gsecontrol"
409+
class="smvcontrol attribute"
410410
label="confRev"
411411
.value=${confRev}
412412
supportingText="Configuration Revision"

0 commit comments

Comments
 (0)