Skip to content

Commit

Permalink
test: cleanup tests (puppeteer#4078)
Browse files Browse the repository at this point in the history
- move Connection test into CDPSession.spec.js
- remove a nasty test that was reaching into implementation details
  • Loading branch information
aslushnikov authored and kiku-jw committed Apr 6, 2019
1 parent 4d4e6eb commit f879365
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
10 changes: 10 additions & 0 deletions test/CDPSession.spec.js
Expand Up @@ -69,5 +69,15 @@ module.exports.addTests = function({testRunner, expect}) {
}
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');
}
});
});
};
11 changes: 0 additions & 11 deletions test/input.spec.js
Expand Up @@ -34,16 +34,5 @@ module.exports.addTests = function({testRunner, expect}) {
return promise.then(() => reader.result);
}, 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);
});
});
};
11 changes: 0 additions & 11 deletions test/page.spec.js
Expand Up @@ -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() {
it('should work with window.close', async function({ page, context, server }) {
const newPagePromise = new Promise(fulfill => context.once('targetcreated', target => fulfill(target.page())));
Expand Down

0 comments on commit f879365

Please sign in to comment.