Do not use until verion 1.x.x released
Helpers for protractor and augmentations for protractor ElementFinder. Work in progress so not yet documented well.
Requires Node.js >= v6 Requires TypeScript >= v3 Requires TypeScript >= v5 (tested only with v5.4.2)
$ npm i -S protractor-extra
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();
}
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();
}
TODO when v 1.0.0 released