From ad523c87fa4397e8a69ed306037737da8957a19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Kondratiuk?= Date: Thu, 27 May 2021 10:17:12 -0300 Subject: [PATCH] test: move network emulation tests to the emulation spec file (#7293) --- test/emulation.spec.ts | 22 ++++++++++++++++++++++ test/page.spec.ts | 22 ---------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/test/emulation.spec.ts b/test/emulation.spec.ts index 82d263baf12..eb6f1b957ca 100644 --- a/test/emulation.spec.ts +++ b/test/emulation.spec.ts @@ -386,4 +386,26 @@ describe('Emulation', () => { expect(error.message).toBe('Unsupported vision deficiency: invalid'); }); }); + + describeFailsFirefox('Page.emulateNetworkConditions', function () { + it('should change navigator.connection.effectiveType', async () => { + const { page, puppeteer } = getTestState(); + + const slow3G = puppeteer.networkConditions['Slow 3G']; + const fast3G = puppeteer.networkConditions['Fast 3G']; + + expect( + await page.evaluate('window.navigator.connection.effectiveType') + ).toBe('4g'); + await page.emulateNetworkConditions(fast3G); + expect( + await page.evaluate('window.navigator.connection.effectiveType') + ).toBe('3g'); + await page.emulateNetworkConditions(slow3G); + expect( + await page.evaluate('window.navigator.connection.effectiveType') + ).toBe('2g'); + await page.emulateNetworkConditions(null); + }); + }); }); diff --git a/test/page.spec.ts b/test/page.spec.ts index 4d3940d3e87..16c32766f50 100644 --- a/test/page.spec.ts +++ b/test/page.spec.ts @@ -400,28 +400,6 @@ describe('Page', function () { }); }); - describeFailsFirefox('Page.emulateNetworkConditions', function () { - it('should change navigator.connection.effectiveType', async () => { - const { page, puppeteer } = getTestState(); - - const slow3G = puppeteer.networkConditions['Slow 3G']; - const fast3G = puppeteer.networkConditions['Fast 3G']; - - expect( - await page.evaluate('window.navigator.connection.effectiveType') - ).toBe('4g'); - await page.emulateNetworkConditions(fast3G); - expect( - await page.evaluate('window.navigator.connection.effectiveType') - ).toBe('3g'); - await page.emulateNetworkConditions(slow3G); - expect( - await page.evaluate('window.navigator.connection.effectiveType') - ).toBe('2g'); - await page.emulateNetworkConditions(null); - }); - }); - describe('ExecutionContext.queryObjects', function () { itFailsFirefox('should work', async () => { const { page } = getTestState();