Skip to content

Commit 6ce56dd

Browse files
test(accessibility): remove and update tests for new chromium (#6372)
1 parent 5e8d9d2 commit 6ce56dd

9 files changed

+17
-46
lines changed

tests/config/android.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class AndroidPageEnv extends AndroidEnv {
5151
async beforeEach(args: any, testInfo: folio.TestInfo) {
5252
const result = await super.beforeEach(args, testInfo);
5353
const page = await this._context!.newPage();
54-
return { ...result, browserVersion: this._browserVersion, page };
54+
return { ...result, browserVersion: this._browserVersion, browserMajorVersion: this._browserMajorVersion, page };
5555
}
5656

5757
async afterEach({}, testInfo: folio.TestInfo) {

tests/config/androidTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type AndroidTestArgs = {
2626
export class AndroidEnv {
2727
protected _device?: AndroidDevice;
2828
protected _browserVersion: string;
29+
protected _browserMajorVersion: number;
2930

3031
async beforeAll(args: CommonWorkerArgs, workerInfo: folio.WorkerInfo) {
3132
this._device = (await args.playwright._android.devices())[0];
@@ -37,6 +38,7 @@ export class AndroidEnv {
3738
.find(line => line.includes('versionName='))
3839
.trim()
3940
.split('=')[1];
41+
this._browserMajorVersion = Number(this._browserVersion.split('.')[0]);
4042
this._device.setDefaultTimeout(90000);
4143
}
4244

tests/config/default.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type AllOptions = WorkerOptionsFor<typeof contextTest>;
5656
class PageEnv {
5757
private _browser: Browser
5858
private _browserVersion: string;
59+
private _browserMajorVersion: number;
5960
private _context: BrowserContext | undefined;
6061

6162
async beforeAll(args: AllOptions & CommonWorkerArgs, workerInfo: folio.WorkerInfo) {
@@ -67,6 +68,7 @@ class PageEnv {
6768
handleSIGINT: false,
6869
} as any);
6970
this._browserVersion = this._browser.version();
71+
this._browserMajorVersion = Number(this._browserVersion.split('.')[0]);
7072
return {};
7173
}
7274

@@ -77,7 +79,7 @@ class PageEnv {
7779
...args.contextOptions,
7880
});
7981
const page = await this._context.newPage();
80-
return { context: this._context, page, browserVersion: this._browserVersion };
82+
return { context: this._context, page, browserVersion: this._browserVersion, browserMajorVersion: this._browserMajorVersion };
8183
}
8284

8385
async afterEach({}) {

tests/config/electron.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class ElectronPageEnv extends ElectronEnv {
4646
return {
4747
...result,
4848
browserVersion: this._browserVersion,
49+
browserMajorVersion: this._browserMajorVersion,
4950
page,
5051
};
5152
}

tests/config/electronTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class ElectronEnv {
2929
private _electronApp: ElectronApplication | undefined;
3030
private _windows: Page[] = [];
3131
protected _browserVersion: string;
32+
protected _browserMajorVersion: number;
3233

3334
private async _newWindow() {
3435
const [ window ] = await Promise.all([
@@ -52,6 +53,7 @@ export class ElectronEnv {
5253
// This env prevents 'Electron Security Policy' console message.
5354
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
5455
this._browserVersion = require('electron/package.json').version;
56+
this._browserMajorVersion = Number(this._browserVersion.split('.')[0]);
5557
return {};
5658
}
5759

tests/config/pageTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export { expect } from 'folio';
2121
// Page test does not guarantee an isolated context, just a new page (because Android).
2222
export type PageTestArgs = {
2323
browserVersion: string;
24+
browserMajorVersion: number;
2425
page: Page;
2526
};
2627

tests/interception.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ it('should work with regular expression passed from a different context', async
156156
expect(intercepted).toBe(true);
157157
});
158158

159-
it('should not break remote worker importScripts', async ({ page, server, isChromium, browserVersion }) => {
160-
it.fixme(isChromium && +browserVersion.split('.')[0] < 91);
159+
it('should not break remote worker importScripts', async ({ page, server, isChromium, browserMajorVersion }) => {
160+
it.fixme(isChromium && browserMajorVersion < 91);
161161

162162
await page.route('**', async route => {
163163
await route.continue();

tests/page-accessibility.spec.ts

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ it('rich text editable fields should have children', async function({page, isFir
172172
expect(snapshot.children[0]).toEqual(golden);
173173
});
174174

175-
it('rich text editable fields with role should have children', async function({page, isFirefox, browserName}) {
176-
it.skip(browserName === 'webkit', 'WebKit rich text accessibility is iffy');
175+
it('rich text editable fields with role should have children', async function({page, isFirefox, isWebKit, isChromium, browserMajorVersion}) {
176+
it.skip(isWebKit, 'WebKit rich text accessibility is iffy');
177177

178178
await page.setContent(`
179179
<div contenteditable="true" role='textbox'>
@@ -190,6 +190,7 @@ it('rich text editable fields with role should have children', async function({p
190190
} : {
191191
role: 'textbox',
192192
name: '',
193+
multiline: (isChromium && browserMajorVersion >= 92) ? true : undefined,
193194
value: 'Edit this image: ',
194195
children: [{
195196
role: 'text',
@@ -203,44 +204,6 @@ it('rich text editable fields with role should have children', async function({p
203204
expect(snapshot.children[0]).toEqual(golden);
204205
});
205206

206-
it.describe('contenteditable', () => {
207-
it.beforeEach(async ({browserName}) => {
208-
it.skip(browserName === 'firefox', 'Firefox does not support contenteditable="plaintext-only"');
209-
it.skip(browserName === 'webkit', 'WebKit rich text accessibility is iffy');
210-
});
211-
212-
it('plain text field with role should not have children', async function({page}) {
213-
await page.setContent(`
214-
<div contenteditable="plaintext-only" role='textbox'>Edit this image:<img src="fakeimage.png" alt="my fake image"></div>`);
215-
const snapshot = await page.accessibility.snapshot();
216-
expect(snapshot.children[0]).toEqual({
217-
role: 'textbox',
218-
name: '',
219-
value: 'Edit this image:'
220-
});
221-
});
222-
223-
it('plain text field without role should not have content', async function({page}) {
224-
await page.setContent(`
225-
<div contenteditable="plaintext-only">Edit this image:<img src="fakeimage.png" alt="my fake image"></div>`);
226-
const snapshot = await page.accessibility.snapshot();
227-
expect(snapshot.children[0]).toEqual({
228-
role: 'generic',
229-
name: ''
230-
});
231-
});
232-
233-
it('plain text field with tabindex and without role should not have content', async function({page}) {
234-
await page.setContent(`
235-
<div contenteditable="plaintext-only" tabIndex=0>Edit this image:<img src="fakeimage.png" alt="my fake image"></div>`);
236-
const snapshot = await page.accessibility.snapshot();
237-
expect(snapshot.children[0]).toEqual({
238-
role: 'generic',
239-
name: ''
240-
});
241-
});
242-
});
243-
244207
it('non editable textbox with role and tabIndex and label should not have children', async function({page, isChromium, isFirefox}) {
245208
await page.setContent(`
246209
<div role="textbox" tabIndex=0 aria-checked="true" aria-label="my favorite textbox">

tests/selectors-misc.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ it('should work for open shadow roots', async ({page, server}) => {
2727
expect(await page.$$(`data-testid:light=foo`)).toEqual([]);
2828
});
2929

30-
it('should click on links in shadow dom', async ({page, server, browserName, browserVersion, isElectron, isAndroid}) => {
31-
it.fixme(browserName === 'chromium' && Number(browserVersion.split('.')[0]) < 91, 'Remove when crrev.com/864024 gets to the stable channel');
30+
it('should click on links in shadow dom', async ({page, server, browserName, browserMajorVersion, isElectron, isAndroid}) => {
31+
it.fixme(browserName === 'chromium' && browserMajorVersion < 91, 'Remove when crrev.com/864024 gets to the stable channel');
3232
it.fixme(isAndroid);
3333
it.fixme(isElectron);
3434

0 commit comments

Comments
 (0)