@nice-digital/wdio-cucumber-steps
Version:
Shared step definitions for Cucumber JS BDD tests in WebdriverIO
20 lines • 893 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.acceptCookieBanner = void 0;
/**
* Accept all cookies using the NICE cookie banner.
* We use this as the cookie banner blocks clicks.
*/
async function acceptCookieBanner() {
// The cookie banner (and license key) load async from the CDN
// so we need to wait for it to load
const cookieBannerElement = await $("body #ccc");
await cookieBannerElement.waitForExist({ timeout: 2000 });
const acceptCookiesButtonElement = await cookieBannerElement.$("button.ccc-accept-button");
// If cookies have already been chosen then the accept button doesn't show
if (await acceptCookiesButtonElement.isDisplayed()) {
await acceptCookiesButtonElement.click();
}
}
exports.acceptCookieBanner = acceptCookieBanner;
//# sourceMappingURL=acceptCookieBanner.js.map