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

This commit is contained in:
Dmitry Gozman 2020-01-13 16:30:51 -08:00
parent 8b09358a56
commit e321190dec

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!');