test: move network emulation tests to the emulation spec file (#7293)
This commit is contained in:
parent
f863f4bfe0
commit
ad523c87fa
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user