test: add test for multiline waittask (#3753)

References #3723
This commit is contained in:
Andrey Lushnikov 2019-01-10 21:41:09 -08:00 committed by GitHub
parent f73197385a
commit 0505c81b52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,6 +53,12 @@ module.exports.addTests = function({testRunner, expect, product}) {
await page.waitFor(timeout); await page.waitFor(timeout);
expect(Date.now() - startTime).not.toBeLessThan(timeout / 2); expect(Date.now() - startTime).not.toBeLessThan(timeout / 2);
}); });
it('should work with multiline body', async({page, server}) => {
const result = await page.waitForFunction(`
(() => true)()
`);
expect(await result.jsonValue()).toBe(true);
});
it('should wait for predicate', async({page, server}) => { it('should wait for predicate', async({page, server}) => {
const watchdog = page.waitFor(() => window.innerWidth < 100); const watchdog = page.waitFor(() => window.innerWidth < 100);
page.setViewport({width: 10, height: 10}); page.setViewport({width: 10, height: 10});