diff --git a/test/emulation.spec.ts b/test/emulation.spec.ts index 82d263ba..eb6f1b95 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 4d3940d3..16c32766 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();