fix(firefox): enable more firefox tests (#4007)

This commit is contained in:
Andrey Lushnikov 2019-02-13 23:59:38 -08:00 committed by GitHub
parent e8f044c3be
commit 247733b879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 11 deletions

View File

@ -59,11 +59,18 @@ class ExecutionContext {
return {unserializableValue: 'NaN'};
return {value: arg};
});
const payload = await this._session.send('Page.evaluate', {
functionText,
args,
executionContextId: this._executionContextId
});
let payload = null;
try {
payload = await this._session.send('Page.evaluate', {
functionText,
args,
executionContextId: this._executionContextId
});
} catch (err) {
if (err instanceof TypeError && err.message === 'Converting circular structure to JSON')
err.message += ' Are you passing a nested JSHandle?';
throw err;
}
return createHandle(this, payload.result, payload.exceptionDetails);
}

View File

@ -14,13 +14,13 @@
* limitations under the License.
*/
module.exports.addTests = function({testRunner, expect}) {
module.exports.addTests = function({testRunner, expect, CHROME}) {
const {describe, xdescribe, fdescribe} = testRunner;
const {it, fit, xit, it_fails_ffox} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.evaluateHandle', function() {
it_fails_ffox('should work', async({page, server}) => {
it('should work', async({page, server}) => {
const windowHandle = await page.evaluateHandle(() => window);
expect(windowHandle).toBeTruthy();
});
@ -34,7 +34,7 @@ module.exports.addTests = function({testRunner, expect}) {
const isFive = await page.evaluate(e => Object.is(e, 5), aHandle);
expect(isFive).toBeTruthy();
});
it_fails_ffox('should warn on nested object handles', async({page, server}) => {
it('should warn on nested object handles', async({page, server}) => {
const aHandle = await page.evaluateHandle(() => document.body);
let error = null;
await page.evaluateHandle(
@ -86,11 +86,14 @@ module.exports.addTests = function({testRunner, expect}) {
const json = await dateHandle.jsonValue();
expect(json).toEqual({});
});
it_fails_ffox('should throw for circular objects', async({page, server}) => {
it('should throw for circular objects', async({page, server}) => {
const windowHandle = await page.evaluateHandle('window');
let error = null;
await windowHandle.jsonValue().catch(e => error = e);
expect(error.message).toContain('Object reference chain is too long');
if (CHROME)
expect(error.message).toContain('Object reference chain is too long');
else
expect(error.message).toContain('Object is not serializable');
});
});

View File

@ -61,7 +61,7 @@ module.exports.addTests = function({testRunner, expect, Errors, CHROME}) {
else
expect(error.message).toContain('NS_BINDING_ABORTED');
});
it_fails_ffox('should navigate to empty page with domcontentloaded', async({page, server}) => {
it('should navigate to empty page with domcontentloaded', async({page, server}) => {
const response = await page.goto(server.EMPTY_PAGE, {waitUntil: 'domcontentloaded'});
expect(response.status()).toBe(200);
});