UNPKG

@nice-digital/wdio-cucumber-steps

Version:

Shared step definitions for Cucumber JS BDD tests in WebdriverIO

20 lines 921 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkIsOpenedInNewWindow = void 0; /** * Check if the given URL was opened in a new window * @param {String} expectedUrl The URL to check for * @param {String} obsolete Indicator for the type (window or tab) unused */ /* eslint @typescript-eslint/no-unused-vars: "off" */ async function checkIsOpenedInNewWindow(expectedUrl) { const windowHandles = await browser.getWindowHandles(); expect(windowHandles).not.toHaveLength(1); const lastWindowHandle = windowHandles.slice(-1); // Make sure we focus on the last opened window handle await browser.switchToWindow(lastWindowHandle[0]); expect(browser).toHaveUrlContaining(expectedUrl); await browser.closeWindow(); } exports.checkIsOpenedInNewWindow = checkIsOpenedInNewWindow; //# sourceMappingURL=checkIsOpenedInNewWindow.js.map