test: cleanup tests (#4078)

- move Connection test into CDPSession.spec.js
- remove a nasty test that was reaching into implementation details
This commit is contained in:
Andrey Lushnikov 2019-02-26 20:36:55 -08:00 committed by GitHub
parent dae998ec06
commit e8a49633d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 22 deletions

View File

@ -69,5 +69,15 @@ module.exports.addTests = function({testRunner, expect}) {
} }
expect(error.message).toContain('Session closed.'); expect(error.message).toContain('Session closed.');
}); });
it('should throw nice errors', async function({page}) {
const client = await page.target().createCDPSession();
const error = await theSourceOfTheProblems().catch(error => error);
expect(error.stack).toContain('theSourceOfTheProblems');
expect(error.message).toContain('ThisCommand.DoesNotExist');
async function theSourceOfTheProblems() {
await client.send('ThisCommand.DoesNotExist');
}
});
}); });
}; };

View File

@ -34,16 +34,5 @@ module.exports.addTests = function({testRunner, expect}) {
return promise.then(() => reader.result); return promise.then(() => reader.result);
}, input)).toBe('contents of the file'); }, input)).toBe('contents of the file');
}); });
it_fails_ffox('keyboard.modifiers()', async({page, server}) => {
const keyboard = page.keyboard;
expect(keyboard._modifiers).toBe(0);
await keyboard.down('Shift');
expect(keyboard._modifiers).toBe(8);
await keyboard.down('Alt');
expect(keyboard._modifiers).toBe(9);
await keyboard.up('Shift');
await keyboard.up('Alt');
expect(keyboard._modifiers).toBe(0);
});
}); });
}; };

View File

@ -1078,17 +1078,6 @@ module.exports.addTests = function({testRunner, expect, headless, Errors, Device
}); });
}); });
describe_fails_ffox('Connection', function() {
it('should throw nice errors', async function({page}) {
const error = await theSourceOfTheProblems().catch(error => error);
expect(error.stack).toContain('theSourceOfTheProblems');
expect(error.message).toContain('ThisCommand.DoesNotExist');
async function theSourceOfTheProblems() {
await page._client.send('ThisCommand.DoesNotExist');
}
});
});
describe('Page.Events.Close', function() { describe('Page.Events.Close', function() {
it('should work with window.close', async function({ page, context, server }) { it('should work with window.close', async function({ page, context, server }) {
const newPagePromise = new Promise(fulfill => context.once('targetcreated', target => fulfill(target.page()))); const newPagePromise = new Promise(fulfill => context.once('targetcreated', target => fulfill(target.page())));