@nice-digital/wdio-cucumber-steps
Version:
Shared step definitions for Cucumber JS BDD tests in WebdriverIO
49 lines • 4.93 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const acceptCookieBanner_1 = require("../support/action/acceptCookieBanner");
const clearInputField_1 = require("../support/action/clearInputField");
const clickElement_1 = require("../support/action/clickElement");
const closeLastOpenedWindow_1 = require("../support/action/closeLastOpenedWindow");
const deleteCookie_1 = require("../support/action/deleteCookie");
const dragElement_1 = require("../support/action/dragElement");
const focusLastOpenedWindow_1 = require("../support/action/focusLastOpenedWindow");
const handleModal_1 = require("../support/action/handleModal");
const moveTo_1 = require("../support/action/moveTo");
const pause_1 = require("../support/action/pause");
const pressButton_1 = require("../support/action/pressButton");
const scroll_1 = require("../support/action/scroll");
const selectOption_1 = require("../support/action/selectOption");
const selectOptionByIndex_1 = require("../support/action/selectOptionByIndex");
const setCookie_1 = require("../support/action/setCookie");
const setInputField_1 = require("../support/action/setInputField");
const setPromptText_1 = require("../support/action/setPromptText");
const refresh_1 = require("../support/action/refresh");
const tophatLogIn_1 = require("../support/action/tophatLogIn");
const focusElement_1 = require("../support/action/focusElement");
const utils_1 = require("../support/utils");
// Initial steps taken from https://github.com/webdriverio/cucumber-boilerplate/blob/master/src/steps/given.js
(0, utils_1.When)(/^I (click|doubleclick) on the (link|button|element) "([^"]*)?"$/, clickElement_1.clickElement).withDocs("(Double)click a link, button or element");
(0, utils_1.When)(/^I (add|set) "([^"]*)?" to the inputfield "([^"]*)?"$/, setInputField_1.setInputField).withDocs("Add or set the content of an input field");
(0, utils_1.When)(/^I clear the inputfield "([^"]*)?"$/, clearInputField_1.clearInputField).withDocs("Clear an input field");
(0, utils_1.When)(/^I drag element "([^"]*)?" to element "([^"]*)?"$/, dragElement_1.dragElement).withDocs("Drag a element to another element");
(0, utils_1.When)(/^I pause for (\d+)ms$/, pause_1.pause).withDocs("Pause for a certain number of milliseconds");
(0, utils_1.When)(/^I set a cookie "([^"]*)?" with the content "([^"]*)?"$/, setCookie_1.setCookie).withDocs("Set the content of a cookie with the given name to the given string");
(0, utils_1.When)(/^I delete the cookie "([^"]*)?"$/, deleteCookie_1.deleteCookie).withDocs("Delete the cookie with the given name");
(0, utils_1.When)(/^I press "([^"]*)?"$/, pressButton_1.pressButton).withDocs("Press a given key. You’ll find all supported characters [here](https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions). To do that, the value has to correspond to a key from the table.");
(0, utils_1.When)(/^I (accept|dismiss) the (alertbox|confirmbox|prompt)$/, handleModal_1.handleModal).withDocs("Accept or dismiss a modal window");
(0, utils_1.When)(/^I enter "([^"]*)?" into the prompt$/, setPromptText_1.setPromptText).withDocs("Enter a given text into a modal prompt");
(0, utils_1.When)(/^I scroll to element "([^"]*)?"$/, scroll_1.scroll).withDocs("Scroll to a given element");
(0, utils_1.When)(/^I close the last opened (window|tab)$/, closeLastOpenedWindow_1.closeLastOpenedWindow).withDocs("Close the last opened browser window/tab");
(0, utils_1.When)(/^I focus the last opened (window|tab)$/, focusLastOpenedWindow_1.focusLastOpenedWindow).withDocs("Focus the last opened browser window/tab");
(0, utils_1.When)(/^I select the (\d+)(st|nd|rd|th) option for element "([^"]*)?"$/, selectOptionByIndex_1.selectOptionByIndex).withDocs("Select a option based on its index");
(0, utils_1.When)(/^I select the option with the (name|value|text) "([^"]*)?" for element "([^"]*)?"$/, selectOption_1.selectOption).withDocs("Select a option based on its name, value or visible text");
(0, utils_1.When)(/^I move to element "([^"]*)?"(?: with an offset of (\d+),(\d+))*$/, moveTo_1.moveTo).withDocs("Move the mouse by an (optional) offset of the specified element");
(0, utils_1.When)(/^I refresh$/, refresh_1.refresh).withDocs("Refresh the current page");
(0, utils_1.When)(/^I log in to Accounts via TopHat with username "([A-Z0-9_]+)" and password "([A-Z0-9_]+)"$/, {
wrapperOptions: {
retry: 3,
},
}, tophatLogIn_1.tophatLogin).withDocs("Use TopHat in your application to log into Nice accounts. Username and Password should be names of environment variables ");
(0, utils_1.When)(/^I focus on the element "([^"]+)"$/, focusElement_1.focusElement).withDocs("Move focus to the given element");
(0, utils_1.When)(/^I accept all cookies$/, acceptCookieBanner_1.acceptCookieBanner).withDocs("Accept all cookies using the NICE cookie banner");
//# sourceMappingURL=definitions.js.map