mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: split out dialog tests (#3586)
This commit is contained in:
@@ -189,13 +189,6 @@ module.exports.addTests = function({testRunner, expect, headless}) {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Page.evaluateHandle', function() {
|
||||
it('should work', async({page, server}) => {
|
||||
const windowHandle = await page.evaluateHandle(() => window);
|
||||
expect(windowHandle).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('ExecutionContext.queryObjects', function() {
|
||||
it('should work', async({page, server}) => {
|
||||
// Instantiate an object
|
||||
@@ -498,35 +491,6 @@ module.exports.addTests = function({testRunner, expect, headless}) {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Page.Events.Dialog', function() {
|
||||
it('should fire', async({page, server}) => {
|
||||
page.on('dialog', dialog => {
|
||||
expect(dialog.type()).toBe('alert');
|
||||
expect(dialog.defaultValue()).toBe('');
|
||||
expect(dialog.message()).toBe('yo');
|
||||
dialog.accept();
|
||||
});
|
||||
await page.evaluate(() => alert('yo'));
|
||||
});
|
||||
it('should allow accepting prompts', async({page, server}) => {
|
||||
page.on('dialog', dialog => {
|
||||
expect(dialog.type()).toBe('prompt');
|
||||
expect(dialog.defaultValue()).toBe('yes.');
|
||||
expect(dialog.message()).toBe('question?');
|
||||
dialog.accept('answer!');
|
||||
});
|
||||
const result = await page.evaluate(() => prompt('question?', 'yes.'));
|
||||
expect(result).toBe('answer!');
|
||||
});
|
||||
it('should dismiss the prompt', async({page, server}) => {
|
||||
page.on('dialog', dialog => {
|
||||
dialog.dismiss();
|
||||
});
|
||||
const result = await page.evaluate(() => prompt('question?'));
|
||||
expect(result).toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Page.Events.PageError', function() {
|
||||
it('should fire', async({page, server}) => {
|
||||
let error = null;
|
||||
|
||||
Reference in New Issue
Block a user