test: move network emulation tests to the emulation spec file (#7293)

This commit is contained in:
Darío Kondratiuk 2021-05-27 10:17:12 -03:00 committed by GitHub
parent f863f4bfe0
commit ad523c87fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 22 deletions

View File

@ -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);
});
});
});

View File

@ -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();