UNPKG

@sap_oss/wdio-qmate-service

Version:

[![REUSE status](https://api.reuse.software/badge/github.com/SAP/wdio-qmate-service)](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[![Node.js CI](https://github.com/SAP/wdio-qmate-service/actions/workflows/node.js.yml/badge.svg)](http

57 lines (46 loc) 2.06 kB
"use strict"; const { BASE_URL } = require("../../../../src/reuse/constants.ts"); const { handleCookiesConsent } = require("../../../helper/utils"); describe("userInteraction - scrollToElement - default alignment options", function () { let elem; it("Preparation", async function () { await common.navigation.navigateToUrl(`${BASE_URL}/#/api`); await handleCookiesConsent(); }); it("Execution", async function () { elem = await $("*=Legal Disclosure"); const isDisplayedInViewport = await elem.isDisplayedInViewport(); await common.assertion.expectFalse(isDisplayedInViewport); await nonUi5.userInteraction.scrollToElement(elem); }); it("Verification", async function () { await nonUi5.assertion.expectToBeVisible(elem, 10000); }); }); describe("userInteraction - scrollToElement - alignment is center", function () { let elem, alignment; it("Preparation", async function () { await common.navigation.navigateToUrl(`${BASE_URL}/#/api`); await handleCookiesConsent(); await browser.setWindowSize(1200, 800); }); it("Execution", async function () { elem = await $("*=Legal Disclosure"); alignment = "center"; const isDisplayedInViewport = await elem.isDisplayedInViewport(); await common.assertion.expectFalse(isDisplayedInViewport); await nonUi5.userInteraction.scrollToElement(elem, alignment); }); it("Verification", async function () { await nonUi5.assertion.expectToBeVisible(elem, 10000); }); }); describe("locator - scrollToElement - wrong element (error case)", function () { it("Preparation", async function () { await common.navigation.navigateToUrl(`${BASE_URL}/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3#/categories`); await handleCookiesConsent(); }); it("Execution & Verification", async function () { await expect(nonUi5.userInteraction.scrollToElement("*=Legal Disclosure")).rejects.toThrow("Function 'scrollToElement' failed with: Element with CSS '*=Legal Disclosure' not found."); }); });