UNPKG

cucumber-html-report-generator

Version:

Generate beautiful cucumberjs html reports for multiple instances (browsers / devices)

55 lines 2.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CustomCommands = void 0; class CustomCommands { createCutomCommands() { browser.addCommand('getCheckBox', async function (checkboxLabel) { return this.$(`.//*[.='${checkboxLabel}']/../..//input`); }, true); browser.addCommand('getCheckBoxStatus', async function (checkboxLabel) { await this.getCheckBox(checkboxLabel).click(); }, true); browser.addCommand('waitForClickable', async function (ms = 5) { return await this.waitForDisplayed({ timeout: ms }) && this.waitForEnabled({ timeout: ms }); }, true); browser.addCommand('waitForNotVisible', async function (ms = 0) { return this.waitForDisplayed({ reverse: true, timeout: ms }); }, true); browser.addCommand('waitUntilIsEnabled', async function (ms = 0) { return this.waitForDisplayed({ reverse: false, timeout: ms }); }, true); browser.addCommand('waitForNotExist', async function (ms = 0) { return this.waitForExist({ reverse: false, timeout: ms }); }, true); browser.addCommand('getRandomInt', (min, max) => Math.floor(Math.random() * (max - min + 1)) + min); browser.addCommand('hoverAndClick', async function () { const location = await this.getLocation(); await browser.performActions([ { actions: [ { duration: 0, type: 'pointerMove', x: parseInt(location.x.toString(), 10), y: location.y }, { button: 0, type: 'pointerDown' }, { duration: 500, type: 'pause' }, { button: 0, type: 'pointerUp' }, ], id: 'pointer1', parameters: { pointerType: 'mouse', }, type: 'pointer', }, ]); }, true); browser.addCommand('isElementDisplayed', async function () { return await this?.isDisplayed() ?? false; }, true); browser.addCommand('getRow', async function (rowNumber) { return this?.$(`./tbody/tr[${rowNumber}]`); }, true); browser.addCommand('getCell', async function (cellNumber) { return this?.$(`.//td[${cellNumber}]`); }, true); } } exports.CustomCommands = CustomCommands; //# sourceMappingURL=custom-commands.js.map