@nice-digital/wdio-cucumber-steps
Version:
Shared step definitions for Cucumber JS BDD tests in WebdriverIO
52 lines • 6.13 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const checkContainsAnyText_1 = require("../support/check/checkContainsAnyText");
const checkIsEmpty_1 = require("../support/check/checkIsEmpty");
const checkContainsText_1 = require("../support/check/checkContainsText");
const checkCookieContent_1 = require("../support/check/checkCookieContent");
const checkCookieExists_1 = require("../support/check/checkCookieExists");
const checkDimension_1 = require("../support/check/checkDimension");
const checkElementExists_1 = require("../support/check/checkElementExists");
const checkEqualsText_1 = require("../support/check/checkEqualsText");
const checkModal_1 = require("../support/check/checkModal");
const checkOffset_1 = require("../support/check/checkOffset");
const checkProperty_1 = require("../support/check/checkProperty");
const checkSelected_1 = require("../support/check/checkSelected");
const checkTitle_1 = require("../support/check/checkTitle");
const checkURL_1 = require("../support/check/checkURL");
const closeAllButFirstTab_1 = require("../support/action/closeAllButFirstTab");
const compareText_1 = require("../support/check/compareText");
const isEnabled_1 = require("../support/check/isEnabled");
const isDisplayed_1 = require("../support/check/isDisplayed");
const openWebsite_1 = require("../support/action/openWebsite");
const setWindowSize_1 = require("../support/action/setWindowSize");
const debug_1 = require("../support/action/debug");
const accountsLogin_1 = require("../support/action/accountsLogin");
const accountsLogOut_1 = require("../support/action/accountsLogOut");
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.Given)(/^I open the (url|site) "([^"]*)?"$/, openWebsite_1.openWebsite).withDocs("Open a site in the current browser window/tab");
(0, utils_1.Given)(/^the element "([^"]*)?" is( not)* visible$/, isDisplayed_1.isDisplayed).withDocs("Check the (in)visibility of a element");
(0, utils_1.Given)(/^the element "([^"]*)?" is( not)* enabled$/, isEnabled_1.isEnabled).withDocs("Check if a element is (not) enabled");
(0, utils_1.Given)(/^the element "([^"]*)?" is( not)* selected$/, checkSelected_1.checkSelected).withDocs("Check if a element is (not) selected");
(0, utils_1.Given)(/^the checkbox "([^"]*)?" is( not)* checked$/, checkSelected_1.checkSelected).withDocs("Check if a checkbox is (not) checked");
(0, utils_1.Given)(/^there is (an|no) element "([^"]*)?" on the page$/, checkElementExists_1.checkElementExists).withDocs("Check if a element (does not) exist");
(0, utils_1.Given)(/^the title is( not)* "([^"]*)?"$/, checkTitle_1.checkTitle).withDocs("Check the title of the current browser window/tab");
(0, utils_1.Given)(/^the element "([^"]*)?" contains( not)* the same text as element "([^"]*)?"$/, compareText_1.compareText).withDocs("Compare the text of two elements");
(0, utils_1.Given)(/^the (button|element) "([^"]*)?"( not)* matches the text "([^"]*)?"$/, checkEqualsText_1.checkEqualsText).withDocs("Check if a element equals the given text");
(0, utils_1.Given)(/^the (button|element) "([^"]*)?"( not)* contains the text "([^"]*)?"$/, checkContainsText_1.checkContainsText).withDocs("Check if a element contains the given text");
(0, utils_1.Given)(/^the (button|element) "([^"]*)?"( not)* contains any text$/, checkContainsAnyText_1.checkContainsAnyText).withDocs("Check if a element does not contain any text");
(0, utils_1.Given)(/^the (button|element) "([^"]*)?" is( not)* empty$/, checkIsEmpty_1.checkIsEmpty).withDocs("Check if a element is empty");
(0, utils_1.Given)(/^the page url is( not)* "([^"]*)?"$/, checkURL_1.checkUrl).withDocs("Check the url of the current browser window/tab");
(0, utils_1.Given)(/^the( css)* attribute "([^"]*)?" from element "([^"]*)?" is( not)* "([^"]*)?"$/, checkProperty_1.checkProperty).withDocs("Check the value of a element's (css) attribute");
(0, utils_1.Given)(/^the cookie "([^"]*)?" contains( not)* the value "([^"]*)?"$/, checkCookieContent_1.checkCookieContent).withDocs("Check the value of a cookie");
(0, utils_1.Given)(/^the cookie "([^"]*)?" does( not)* exist$/, checkCookieExists_1.checkCookieExists).withDocs("Check the existence of a cookie");
(0, utils_1.Given)(/^the element "([^"]*)?" is( not)* ([\d]+)px (broad|tall)$/, checkDimension_1.checkDimension).withDocs("Check the width/height of a element");
(0, utils_1.Given)(/^the element "([^"]*)?" is( not)* positioned at ([\d]+)px on the (x|y) axis$/, checkOffset_1.checkOffset).withDocs("Check the position of a element");
(0, utils_1.Given)(/^I have a screen that is ([\d]+) by ([\d]+) pixels$/, setWindowSize_1.setWindowSize).withDocs("Set the browser size to a given size");
(0, utils_1.Given)(/^I have closed all but the first (window|tab)$/, closeAllButFirstTab_1.closeAllButFirstTab).withDocs("Close all but the first browser window/tab");
(0, utils_1.Given)(/^a (alertbox|confirmbox|prompt) is( not)* opened$/, checkModal_1.checkModal).withDocs("Check if a modal is opened");
(0, utils_1.Given)("I debug", debug_1.debug).withDocs("Add a breakpoint to stop the running browser and give you time to jump into it and check the state of your application ([WDIO Help on Debug](http://webdriver.io/api/utility/debug.html)).");
(0, utils_1.Given)(/^I am logged in to (beta|live|test) Accounts with username "([A-z0-9_@.]+)" and password "([A-z0-9_]+)"$/, accountsLogin_1.accountsLogin).withDocs("Log into a specific version of Nice accounts independently of using TopHat. Username and Password should be names of environment variables (eg, Given I am logged in to beta Accounts with username 'ACCOUNTS_EMAIL' and password 'ACCOUNTS_PASSWORD'). If this is used remember to redirect back to where you expect to be");
(0, utils_1.Given)(/^I am logged out of NICE accounts$/, accountsLogOut_1.accountsLogOut).withDocs("Log out of NICE accounts. If this is used remember to redirect back to where you expect to be");
//# sourceMappingURL=definitions.js.map