0.1.1 • Published 5 years ago

@laziness/lazy-cypress-api v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Lazy Cypress API

An API to generate Cypress code

Using yarn:

$ yarn add @laziness/lazy-cypress-api

Using npm:

$ npm install @laziness/lazy-cypress-api

Usage

An example in a React component:

export const LazyCypress = () => {
  addFormSubmitListener();

  return (
    <React.Fragment>
      <button id="cypress-start" onClick={start}>
        <span role="img" aria-label="start recording">
          ⏺
        </span>
      </button>

      <button id="cypress-clean" onClick={clean}>
        <span role="img" aria-label="clean recording">
          ⏹
        </span>
      </button>

      <button id="cypress-copy" onClick={copy}>
        <span role="img" aria-label="copy recording">
          📋
        </span>
      </button>
    </React.Fragment>
  );
};

Call addFormSubmitListener() in your page or tool to start listening to the form.

start() will start "recording". It writes the beginning of the generated code in the session storage node called lazyCypress.

clean() always clean up the session storage node called lazyCypress.

copy() will copy the generated Cypress code in the session storage to the clipboard.

0.1.1

5 years ago

0.1.0

5 years ago