oi-grease
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

puppeteer-helpers

Bunch of help methods for e2e automation testing via Puppeteer

Purpose

Several examples why library exists:

  • You always have some troubles with click? waitForSelector() does not help sometimes and you use $eval(selector, (node) => node.click()? Please, stop clicking using JS if you write e2e UI tests. Our user does not interact with browser in such maner!

Was:

    await page.waitForSelector(selector, { timeout:30000 });
    await page.$eval(selector, (e: any) => e.click());

with Grease:

await click(page, selector);

click() will wait when Puppeteer find element and also when element become visible.

Library has other useful methods in API.md (TBD)

  • You aware Puppeteer does not have getText() method, strange but truth

Was:

 await page.waitForSelector(selector);
 const text = await page.$eval(selector, (el: any) => el.innerText);

with Grease:

const text = await getText(page, selector);

getText() will wait when Puppeteer find element and also when element become visible. Only after that get text of element.

API

TBD

Contribution guide

TBD

Dependencies (2)

Dev Dependencies (4)

Package Sidebar

Install

npm i oi-grease

Weekly Downloads

2

Version

5.0.0

License

MIT

Unpacked Size

63.6 kB

Total Files

40

Last publish

Collaborators

  • crispusdh