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

121 lines (106 loc) 3.75 kB
const { BASE_URL } = require("../../../../src/reuse/constants.ts"); const { handleCookiesConsent } = require("../../../helper/utils"); describe("userInteraction - click", function () { it("Preparation", async function () { await browser.navigateTo(`${BASE_URL}/`); await handleCookiesConsent(); }); it("Execution", async function () { const selector = { elementProperties: { viewName: "sap.ui.documentation.sdk.view.App", metadata: "sap.m.IconTabFilter", id: "*apiMasterTab" } }; await ui5.userInteraction.click(selector, 0, 60000); }); it("Verification", async function () { await common.assertion.expectUrlToBe(`${BASE_URL}/#/api`); }); }); describe("userInteraction - click on not displayed element", function () { it("Preparation", async function () { await browser.navigateTo(`${BASE_URL}/`); await handleCookiesConsent(); }); it("Execution & Verification", async function () { const selector = { elementProperties: { viewName: "sap.ui.documentation.sdk.view.ApiDetailInitial", metadata: "sap.ui.documentation.TitleLink", text: "Main Controls" } }; const index = 0; const timeout = 30000; await expect(ui5.userInteraction.click(selector, index, timeout)).rejects.toThrow(/No visible elements found/); }); }); describe("userInteraction - click on invisible element", 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#/category/AC/product/HT-2000`); await handleCookiesConsent(); }); it("Execution & Verification", async function () { const selector = { elementProperties: { viewName: "sap.ui.demo.cart.view.Product", metadata: "sap.m.Button", text: [ { path: "i18n>addToCartShort" } ] } }; const index = 0; const timeout = 30000; await ui5.userInteraction.click(selector, index, timeout); await browser.pause(1000); await expect(ui5.userInteraction.click(selector, index, timeout)).rejects.toThrow(/No clickable elements found/); }); }); describe("userInteraction - click with selector having wildcard character(*) for metadata", function () { it("Preparation", async function () { await browser.navigateTo(`${BASE_URL}/`); await handleCookiesConsent(); }); it("Execution", async function () { const selector = { elementProperties: { viewName: "sap.ui.documentation.sdk.view.App", metadata: "sap.m.*", id: "*apiMasterTab" } }; await ui5.userInteraction.click(selector, 0, 60000); }); it("Verification", async function () { await common.assertion.expectUrlToBe(`${BASE_URL}/#/api`); }); }); describe("userInteraction - click unblocked button and ignore blocked one", function () { const selector = { elementProperties: { metadata: "sap.m.Button", text: "Create" } }; it("Preparation", async function () { await browser.navigateTo(`${BASE_URL}/test-resources/sap/suite/ui/generic/template/demokit/demokit.html?responderOn=true&demoApp=sttasalesordertt#/?sap-iapp-state=3&sap-iapp-state--history=1`); await ui5.userInteraction.click(selector); }); it("Execution", async function () { await ui5.userInteraction.click(selector, 0, 30000); }); it("Verification", async function () { const assertSelector = { elementProperties: { metadata: "sap.m.Input", valueStateText: "ISO Currency Code is a required field." } }; await ui5.assertion.expectToBeVisible(assertSelector); }); });