UNPKG

@nice-digital/wdio-cucumber-steps

Version:

Shared step definitions for Cucumber JS BDD tests in WebdriverIO

68 lines 8.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const checkClass_1 = require("../support/check/checkClass"); 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 checkEqualsText_1 = require("../support/check/checkEqualsText"); const checkFocus_1 = require("../support/check/checkFocus"); const checkInURLPath_1 = require("../support/check/checkInURLPath"); const checkIsOpenedInNewWindow_1 = require("../support/check/checkIsOpenedInNewWindow"); const checkModal_1 = require("../support/check/checkModal"); const checkModalText_1 = require("../support/check/checkModalText"); const checkNewWindow_1 = require("../support/check/checkNewWindow"); 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 checkURLPath_1 = require("../support/check/checkURLPath"); const checkWithinViewport_1 = require("../support/check/checkWithinViewport"); const compareText_1 = require("../support/check/compareText"); const isEnabled_1 = require("../support/check/isEnabled"); const isExisting_1 = require("../support/check/isExisting"); const isDisplayed_1 = require("../support/check/isDisplayed"); const waitFor_1 = require("../support/action/waitFor"); const waitForDisplayed_1 = require("../support/action/waitForDisplayed"); const checkIfElementExists_1 = require("../support/lib/checkIfElementExists"); const checkForAccessibilityIssues_1 = require("../support/check/checkForAccessibilityIssues"); 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.Then)(/^I expect that the title is( not)* "([^"]*)?"$/, checkTitle_1.checkTitle).withDocs("Check the title of the current browser window/tab"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" does( not)* appear exactly "([^"]*)?" times$/, checkIfElementExists_1.checkIfElementExists).withDocs("Checks that the element is on the page a specific number of times"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" is( not)* visible$/, isDisplayed_1.isDisplayed).withDocs("Check if a certain element is (not) visible"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" becomes( not)* visible$/, waitForDisplayed_1.waitForDisplayed).withDocs("Check if a certain element becomes visible"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" is( not)* within the viewport$/, checkWithinViewport_1.checkWithinViewport).withDocs("Check if a certain element is within the current viewport"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" does( not)* exist$/, isExisting_1.isExisting).withDocs("Check if a certain element exists"); (0, utils_1.Then)(/^I expect that element "([^"]*)?"( not)* contains the same text as element "([^"]*)?"$/, compareText_1.compareText).withDocs("Compare the text of two elements"); (0, utils_1.Then)(/^I expect that (button|element) "([^"]*)?"( not)* matches the text "([^"]*)?"$/, checkEqualsText_1.checkEqualsText).withDocs("Check if a element or input field equals the given text"); (0, utils_1.Then)(/^I expect that (button|element) "([^"]*)?"( not)* contains the text "([^"]*)?"$/, checkContainsText_1.checkContainsText).withDocs("Check if a element or input field contains the given text"); (0, utils_1.Then)(/^I expect that (button|element) "([^"]*)?"( not)* contains any text$/, checkContainsAnyText_1.checkContainsAnyText).withDocs("Check if a element or input field contains any text"); (0, utils_1.Then)(/^I expect that (button|element) "([^"]*)?" is( not)* empty$/, checkIsEmpty_1.checkIsEmpty).withDocs("Check if a element or input field is (not) empty"); (0, utils_1.Then)(/^I expect that the url is( not)* "([^"]*)?"$/, checkURL_1.checkUrl).withDocs("Check if the the URL of the current browser window/tab is (not) a certain string"); (0, utils_1.Then)(/^I expect that the path is( not)* "([^"]*)?"$/, checkURLPath_1.checkUrlPath).withDocs("Check if the path of the URL of the current browser window/tab is (not) a certain string"); (0, utils_1.Then)(/^I expect the url to( not)* contain "([^"]*)?"$/, checkInURLPath_1.checkInURLPath).withDocs("Check if the URL of the current browser window/tab (doesn't) contain(s) a certain string"); (0, utils_1.Then)(/^I expect that the( css)* attribute "([^"]*)?" from element "([^"]*)?" is( not)* "([^"]*)?"$/, checkProperty_1.checkProperty).withDocs("Check the value of a element's (css) attribute"); (0, utils_1.Then)(/^I expect that checkbox "([^"]*)?" is( not)* checked$/, checkSelected_1.checkSelected).withDocs("Check if a check-box is (not) checked"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" is( not)* selected$/, checkSelected_1.checkSelected).withDocs("Check if a element is (not) selected"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" is( not)* enabled$/, isEnabled_1.isEnabled).withDocs("Check if a element is (not) enabled"); (0, utils_1.Then)(/^I expect that cookie "([^"]*)?"( not)* contains "([^"]*)?"$/, checkCookieContent_1.checkCookieContent).withDocs("Check if a cookie with a certain name contains a certain value"); (0, utils_1.Then)(/^I expect that cookie "([^"]*)?"( not)* exists$/, checkCookieExists_1.checkCookieExists).withDocs("Check if a cookie with a certain name exist"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" is( not)* ([\d]+)px (broad|tall)$/, checkDimension_1.checkDimension).withDocs("Check the width/height of an element"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" is( not)* positioned at ([\d]+)px on the (x|y) axis$/, checkOffset_1.checkOffset).withDocs("Check the position of an element"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" (has|does not have) the class "([^"]*)?"$/, checkClass_1.checkClass).withDocs("Check if a element has a certain class"); (0, utils_1.Then)(/^I expect a new (window|tab) has( not)* been opened$/, checkNewWindow_1.checkNewWindow).withDocs("Check if a new window/tab has been opened"); (0, utils_1.Then)(/^I expect the url "([^"]*)?" is opened in a new (tab|window)$/, checkIsOpenedInNewWindow_1.checkIsOpenedInNewWindow).withDocs("Check if a URL is opened in a new browser window/tab"); (0, utils_1.Then)(/^I expect that element "([^"]*)?" is( not)* focused$/, checkFocus_1.checkFocus).withDocs("Check if a element has the focus"); (0, utils_1.Then)(/^I wait on element "([^"]*)?"(?: for (\d+)ms)*(?: to( not)* (be checked|be enabled|be selected|be visible|contain a text|contain a value|exist))*$/, { wrapperOptions: { retry: 3, }, }, waitFor_1.waitFor).withDocs("Wait for a element to be checked, enabled, selected, visible, contain a certain value or text or to exist"); (0, utils_1.Then)(/^I expect that a (alertbox|confirmbox|prompt) is( not)* opened$/, checkModal_1.checkModal).withDocs("Check that a modal is (not) opened"); (0, utils_1.Then)(/^I expect that a (alertbox|confirmbox|prompt)( not)* contains the text "([^"]*)?"$/, checkModalText_1.checkModalText).withDocs('Check the text of a modal. E.g. `I expect that a alertbox contains the text "Continue?"` or `I expect that a confirmbox not contains the text "Continue?"`'); (0, utils_1.Then)(/^the page should have no(?: (A|AA))? accessibility issues$/, checkForAccessibilityIssues_1.checkForAccessibilityIssues).withDocs("Check each element on the page for accessibility issues. Please note this won't find all accessibility issues."); //# sourceMappingURL=definitions.js.map