protractor-extradeprecated

Agumentations for objects exported from protractor (TypeScript v.3+ only)

Usage no npm install needed!

<script type="module">
  import protractorExtra from 'https://cdn.skypack.dev/protractor-extra';
</script>

README

Experimental

Do not use until verion 1.x.x released

About

Helpers for protractor and augmentations for protractor ElementFinder. Work in progress so not yet documented well.

Installation and requirements

Requires Node.js >= v6 Requires TypeScript >= v3 Requires TypeScript >= v5 (tested only with v5.4.2)

$ npm i -S protractor-extra

Examples

Classic protractor

  import { element, by, ExpectedConditions, browser } from "protractor";

  const userBtn = element( by.css('#user-btn') );

  async function doSomething() {
    let timeoutMs = config.clickbaleTimeout;
    let failMessage = `Element  "${userBtn.locator()}"  not clickable in ${timeoutMs/1000}s.`;
    await browser.wait(ExpectedConditions.elementToBeClickable(userBtn), timeoutMs, failMessage);
    await userBtn.click();
  }

With protractor-extra

  const { elementByCss } = require("protractor-extra"); // to guarantee sync import
  import { element, by } from "protractor";

  // `default` or any other milliseconds number value may be used
  const userBtn = elementByCss( '#user-btn',  {waitClickableBeforeClick: 'default'}  );

  async function doSomething() {
    await userBtn.click();
  }

Documentation

TODO when v 1.0.0 released

module

  • Class description

    • Class:method description

  • Function description