Skip to content

Commit

Permalink
test(sbb-checkbox, sbb-toggle-check): stabilize tests with retries
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB committed Mar 25, 2024
1 parent 3fae552 commit 08f0b78
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
17 changes: 13 additions & 4 deletions src/components/checkbox/checkbox/checkbox.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { assert, expect } from '@open-wc/testing';
import { a11ySnapshot, sendKeys } from '@web/test-runner-commands';
import { html } from 'lit/static-html.js';
import type { Context } from 'mocha';

import { isChromium, isFirefox } from '../../core/dom';
import { EventSpy, waitForCondition, waitForLitRender } from '../../core/testing';
Expand Down Expand Up @@ -92,7 +93,9 @@ describe(`sbb-checkbox with ${fixture.name}`, () => {
expect(snapshot.required).to.be.undefined;
});

it('should reflect accessibility tree setting required attribute to true', async () => {
it('should reflect accessibility tree setting required attribute to true', async function (this: Context) {
this.retries(3);

element.toggleAttribute('required', true);
await waitForLitRender(element);

Expand All @@ -106,7 +109,9 @@ describe(`sbb-checkbox with ${fixture.name}`, () => {
}
});

it('should reflect accessibility tree setting required attribute to false', async () => {
it('should reflect accessibility tree setting required attribute to false', async function (this: Context) {
this.retries(3);

element.toggleAttribute('required', true);
await waitForLitRender(element);

Expand All @@ -120,7 +125,9 @@ describe(`sbb-checkbox with ${fixture.name}`, () => {
expect(snapshot.required).not.to.be.ok;
});

it('should reflect accessibility tree setting required property to true', async () => {
it('should reflect accessibility tree setting required property to true', async function (this: Context) {
this.retries(3);

element.required = true;
await waitForLitRender(element);

Expand All @@ -134,7 +141,9 @@ describe(`sbb-checkbox with ${fixture.name}`, () => {
}
});

it('should reflect accessibility tree setting required property to false', async () => {
it('should reflect accessibility tree setting required property to false', async function (this: Context) {
this.retries(3);

element.required = true;
await waitForLitRender(element);

Expand Down
17 changes: 13 additions & 4 deletions src/components/toggle-check/toggle-check.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { assert, expect } from '@open-wc/testing';
import { a11ySnapshot, sendKeys } from '@web/test-runner-commands';
import { html } from 'lit/static-html.js';
import type { Context } from 'mocha';

import { isChromium, isFirefox } from '../core/dom';
import { EventSpy, waitForCondition, waitForLitRender } from '../core/testing';
Expand Down Expand Up @@ -87,7 +88,9 @@ describe(`sbb-toggle-check with ${fixture.name}`, () => {
expect(snapshot.required).to.be.undefined;
});

it('should reflect accessibility tree setting required attribute to true', async () => {
it('should reflect accessibility tree setting required attribute to true', async function (this: Context) {
this.retries(3);

element.toggleAttribute('required', true);
await waitForLitRender(element);

Expand All @@ -101,7 +104,9 @@ describe(`sbb-toggle-check with ${fixture.name}`, () => {
}
});

it('should reflect accessibility tree setting required attribute to false', async () => {
it('should reflect accessibility tree setting required attribute to false', async function (this: Context) {
this.retries(3);

element.toggleAttribute('required', true);
await waitForLitRender(element);

Expand All @@ -114,7 +119,9 @@ describe(`sbb-toggle-check with ${fixture.name}`, () => {
expect(snapshot.required).not.to.be.ok;
});

it('should reflect accessibility tree setting required property to true', async () => {
it('should reflect accessibility tree setting required property to true', async function (this: Context) {
this.retries(3);

element.required = true;
await waitForLitRender(element);

Expand All @@ -128,7 +135,9 @@ describe(`sbb-toggle-check with ${fixture.name}`, () => {
}
});

it('should reflect accessibility tree setting required property to false', async () => {
it('should reflect accessibility tree setting required property to false', async function (this: Context) {
this.retries(3);

element.required = true;
await waitForLitRender(element);

Expand Down

0 comments on commit 08f0b78

Please sign in to comment.