From da2dfc717c4d76b58989b0330af7335ed1b935bf Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Thu, 18 Jan 2024 11:26:35 +0100 Subject: [PATCH] chore: rename tests (#11699) --- test/TestExpectations.json | 18 ------------------ test/src/browser.spec.ts | 2 +- test/src/network.spec.ts | 17 ++++++++--------- tools/mocha-runner/src/test.ts | 2 +- tools/mocha-runner/src/utils.ts | 2 +- 5 files changed, 11 insertions(+), 30 deletions(-) diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 6c1545e5b9e..c3f3977aa8b 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -755,18 +755,6 @@ "parameters": ["webDriverBiDi"], "expectations": ["FAIL", "PASS"] }, - { - "testIdPattern": "[network.spec] network Request.headers should define Chrome as user agent header", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox"], - "expectations": ["SKIP"] - }, - { - "testIdPattern": "[network.spec] network Request.headers should define Firefox as user agent header", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["chrome"], - "expectations": ["SKIP"] - }, { "testIdPattern": "[network.spec] network Request.initiator should return the initiator", "platforms": ["darwin", "linux", "win32"], @@ -2629,12 +2617,6 @@ "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL", "PASS"] }, - { - "testIdPattern": "[network.spec] network Request.headers should define Firefox as user agent header", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["PASS"] - }, { "testIdPattern": "[network.spec] network Request.initiator should return the initiator", "platforms": ["darwin", "linux", "win32"], diff --git a/test/src/browser.spec.ts b/test/src/browser.spec.ts index c0826bafc8b..6f21af5d9ad 100644 --- a/test/src/browser.spec.ts +++ b/test/src/browser.spec.ts @@ -22,7 +22,7 @@ describe('Browser specs', function () { }); describe('Browser.userAgent', function () { - it('should include WebKit', async () => { + it('should include Browser engine', async () => { const {browser, isChrome} = await getTestState(); const userAgent = await browser.userAgent(); diff --git a/test/src/network.spec.ts b/test/src/network.spec.ts index b381aa3124a..c6f51a3412f 100644 --- a/test/src/network.spec.ts +++ b/test/src/network.spec.ts @@ -98,17 +98,16 @@ describe('network', function () { }); describe('Request.headers', function () { - it('should define Chrome as user agent header', async () => { - const {page, server} = await getTestState(); + it('should define Browser in user agent header', async () => { + const {page, server, isChrome} = await getTestState(); const response = (await page.goto(server.EMPTY_PAGE))!; - expect(response.request().headers()['user-agent']).toContain('Chrome'); - }); + const userAgent = response.request().headers()['user-agent']; - it('should define Firefox as user agent header', async () => { - const {page, server} = await getTestState(); - - const response = (await page.goto(server.EMPTY_PAGE))!; - expect(response.request().headers()['user-agent']).toContain('Firefox'); + if (isChrome) { + expect(userAgent).toContain('Chrome'); + } else { + expect(userAgent).toContain('Firefox'); + } }); }); diff --git a/tools/mocha-runner/src/test.ts b/tools/mocha-runner/src/test.ts index cf7b885d580..55109662354 100644 --- a/tools/mocha-runner/src/test.ts +++ b/tools/mocha-runner/src/test.ts @@ -110,7 +110,7 @@ describe('testIdMatchesExpectationPattern', () => { fullTitle() { return 'Page Page.setContent should work'; }, - } satisfies Pick as Mocha.Test; + }; for (const [pattern, expected] of expectations) { assert.equal( diff --git a/tools/mocha-runner/src/utils.ts b/tools/mocha-runner/src/utils.ts index e60dae3166c..066c5fbe57d 100644 --- a/tools/mocha-runner/src/utils.ts +++ b/tools/mocha-runner/src/utils.ts @@ -272,7 +272,7 @@ export function getTestId(file: string, fullTitle?: string): string { } export function testIdMatchesExpectationPattern( - test: MochaTestResult | Mocha.Test, + test: MochaTestResult | Pick, pattern: string ): boolean { const patternRegExString = pattern