test(selectors): should auto-detect css selector with attributes (#477)

This commit is contained in:
Dmitry Gozman 2020-01-13 17:13:36 -08:00 committed by GitHub
parent d529ef95d2
commit 929b7d979b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,6 +61,11 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,
const idAttribute = await page.$eval('section', e => e.id);
expect(idAttribute).toBe('testAttribute');
});
it('should auto-detect css selector with attributes', async({page, server}) => {
await page.setContent('<section id="testAttribute">43543</section>');
const idAttribute = await page.$eval('section[id="testAttribute"]', e => e.id);
expect(idAttribute).toBe('testAttribute');
});
it('should accept arguments', async({page, server}) => {
await page.setContent('<section>hello</section>');
const text = await page.$eval('section', (e, suffix) => e.textContent + suffix, ' world!');