* {{> seeElement }}
(locator, context = null)
| 1190 | * {{> seeElement }} |
| 1191 | */ |
| 1192 | async seeElement(locator, context = null) { |
| 1193 | let els |
| 1194 | if (context) { |
| 1195 | const contextPage = await this.context |
| 1196 | const contextEls = await findElements.call(this, contextPage, context) |
| 1197 | assertElementExists(contextEls, context, 'Context element') |
| 1198 | els = await findElements.call(this, contextEls[0], locator) |
| 1199 | } else { |
| 1200 | els = await this._locate(locator) |
| 1201 | } |
| 1202 | els = (await Promise.all(els.map(el => el.boundingBox() && el))).filter(v => v) |
| 1203 | // Puppeteer visibility was ignored? | Remove when Puppeteer is fixed |
| 1204 | els = await Promise.all(els.map(async el => (await el.evaluate(node => window.getComputedStyle(node).visibility !== 'hidden' && window.getComputedStyle(node).display !== 'none')) && el)) |
| 1205 | try { |
| 1206 | return empty('visible elements').negate(els.filter(v => v).fill('ELEMENT')) |
| 1207 | } catch (e) { |
| 1208 | dontSeeElementError(locator) |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | /** |
| 1213 | * {{> dontSeeElement }} |
nothing calls this directly
no test coverage detected