puppeteer-tools

1.3.1 • Public • Published

Docs

API reference

Why use puppeteer-tools

  • You want to have your e2e tests less coupled to your code and acting more like a real user
  • You don't have a QA team and you want to have some e2e tests to make sure that main user flow will not break, so you need to write it as fast and easily as you can.

Installation

npm i puppeteer-tools

puppeteer-tools is like a plugin to puppeteer, so you need to install it too.

npm i puppeteer

Getting Started

import puppeteer from 'puppeteer';
import createPuppeteerTools from 'puppeteer-tools';

const browser = await puppeteer.launch();
const page = await browser.newPage();

const puppeteerTools = createPuppeteerTools(page);

await page.goto('http://myapp.com/login');
await puppeteerTools.form.fill([
  {
    data: 'mylogin',
    label: 'Login',
    type: 'text',
  },
  {
    data: 'mypass',
    label: 'Password',
    type: 'text',
  },
]);
await Promise.all([
  page.waitForNavigation(),
  page.click('button[type=submit]'),
]);

Coming soon

  • More input types (check, radio, textarea, ...)
  • Custom input types
  • Possibility to execute some action between inputs fill in form.fill

Contributing

Not organized yet, so for now reach me on twitter @lebreRafael or just open issues and PRs

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i puppeteer-tools

      Weekly Downloads

      0

      Version

      1.3.1

      License

      ISC

      Unpacked Size

      16.6 kB

      Total Files

      8

      Last publish

      Collaborators

      • lebrerafael