mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Enable dialog tests (#193)
* Enable dialog tests closes #13 * dismiss dialog test
This commit is contained in:
parent
e6d8fca7cd
commit
315c388f4d
16
test/test.js
16
test/test.js
@ -770,8 +770,7 @@ describe('Page', function() {
|
|||||||
});
|
});
|
||||||
await page.evaluate(() => alert('yo'));
|
await page.evaluate(() => alert('yo'));
|
||||||
}));
|
}));
|
||||||
// TODO Enable this when crbug.com/718235 is fixed.
|
it('should allow accepting prompts', SX(async function() {
|
||||||
(headless ? xit : it)('should allow accepting prompts', SX(async function(done) {
|
|
||||||
page.on('dialog', dialog => {
|
page.on('dialog', dialog => {
|
||||||
expect(dialog.type).toBe('prompt');
|
expect(dialog.type).toBe('prompt');
|
||||||
expect(dialog.message()).toBe('question?');
|
expect(dialog.message()).toBe('question?');
|
||||||
@ -780,6 +779,13 @@ describe('Page', function() {
|
|||||||
let result = await page.evaluate(() => prompt('question?'));
|
let result = await page.evaluate(() => prompt('question?'));
|
||||||
expect(result).toBe('answer!');
|
expect(result).toBe('answer!');
|
||||||
}));
|
}));
|
||||||
|
it('should dismiss the prompt', SX(async function() {
|
||||||
|
page.on('dialog', dialog => {
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
let result = await page.evaluate(() => prompt('question?'));
|
||||||
|
expect(result).toBe(null);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.Events.PageError', function() {
|
describe('Page.Events.PageError', function() {
|
||||||
@ -1522,12 +1528,8 @@ if (process.env.COVERAGE) {
|
|||||||
describe('COVERAGE', function(){
|
describe('COVERAGE', function(){
|
||||||
let coverage = helper.publicAPICoverage();
|
let coverage = helper.publicAPICoverage();
|
||||||
let disabled = new Set();
|
let disabled = new Set();
|
||||||
if (headless) {
|
if (!headless)
|
||||||
disabled.add('dialog.accept');
|
|
||||||
disabled.add('dialog.dismiss');
|
|
||||||
} else {
|
|
||||||
disabled.add('page.pdf');
|
disabled.add('page.pdf');
|
||||||
}
|
|
||||||
|
|
||||||
for (let method of coverage.keys()) {
|
for (let method of coverage.keys()) {
|
||||||
(disabled.has(method) ? xit : it)(`public api '${method}' should be called`, SX(async function(){
|
(disabled.has(method) ? xit : it)(`public api '${method}' should be called`, SX(async function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user