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

65 lines (52 loc) 2.06 kB
"use strict"; const { BASE_URL } = require("../../../../src/reuse/constants.ts"); const { handleCookiesConsent } = require("../../../helper/utils"); const selectorForYesButton = { elementProperties: { metadata: "sap.m.Button", text: "Yes" } }; const selectorForDialog = { elementProperties: { metadata: "sap.m.Dialog" } }; describe("confirmationDialog - clickYes", function () { it("Preparation", async function () { await browser.navigateTo(`${BASE_URL}/#/entity/sap.m.MessageBox/sample/sap.m.sample.MessageBoxInitialFocus`); await handleCookiesConsent(); await util.browser.switchToIframe("[id='sampleFrame']"); const openDialogButton = { elementProperties: { viewName: "sap.m.sample.MessageBoxInitialFocus.V", metadata: "sap.m.Button", text: "Custom action" } }; await ui5.userInteraction.click(openDialogButton); }); it("Execution", async function () { // Check Dialog window opened await expect(ui5.element.getDisplayed(selectorForDialog)).resolves.toBeTruthy(); // Check we have "Yes" button to click await expect(ui5.element.getDisplayed(selectorForYesButton)).resolves.toBeTruthy(); await ui5.confirmationDialog.clickYes(); }); it("Verification", async function () { // Check Dialog closed await expect(ui5.element.getDisplayed(selectorForDialog)).rejects.toThrow(/No visible elements found/); }); }); describe("confirmationDialog - clickYes without confirmation dialog (unhappy case)", function () { it("Preparation", async function () { await browser.url("#/categories"); }); it("Execution", async function () { // Check No Dialog available await expect(ui5.element.getDisplayed(selectorForDialog)).rejects.toThrow(/No visible elements found/); // Check No "Yes" button available await expect(ui5.element.getDisplayed(selectorForYesButton)).rejects.toThrow(/No visible elements found/); await expect(ui5.confirmationDialog.clickYes()).rejects.toThrow(/No visible elements found/); }); });