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

90 lines (80 loc) 2.84 kB
"use strict"; const { BASE_URL } = require("../../../../src/reuse/constants.ts"); describe("element - getPropertyValue", function () { let value; it("Preparation", async function () { await browser.url("#/categories"); }); it("Execution", async function () { const selector = { elementProperties: { viewName: "sap.ui.demo.cart.view.Home", metadata: "sap.m.StandardListItem", bindingContextPath: "/ProductCategories*'LT')" } }; const index = 0; const timeout = 30000; const property = "title"; value = await ui5.element.getPropertyValue(selector, property, index, timeout); }); it("Verification", async function () { await common.assertion.expectEqual(value, "Laptops"); }); }); describe("element - getPropertyValue - wrong property", function () { it("Preparation", async function () { await browser.url("#/categories"); }); it("Execution & Verification", async function () { const selector = { elementProperties: { viewName: "sap.ui.demo.cart.view.Home", metadata: "sap.m.StandardListItem", bindingContextPath: "/ProductCategories*'LT')" } }; const index = 0; const timeout = 30000; const property = "vbcza"; expect(ui5.element.getPropertyValue(selector, property, index, timeout)).rejects.toThrow("Function 'getPropertyValue' failed: Not existing property"); }); }); describe("element - getPropertyValue - wrong selector", function () { it("Preparation", async function () { await browser.url("#/categories"); }); it("Execution & Verification", async function () { const selector = { elementProperties: { viewName: "fdsadgmo.cart.view.Home", metadata: "sadsagdsgStandardListItem", bindingContextPath: "/*'LT')" } }; const index = 0; const timeout = 30000; const property = "title"; await expect(ui5.element.getPropertyValue(selector, property, index, timeout)).rejects.toThrow(/No visible elements found/); }); }); describe("element - getPropertyValue - boolean property", function () { it("Preparation", async function () { await browser.navigateTo(`${BASE_URL}/#/entity/sap.m.CheckBox/sample/sap.m.sample.CheckBox`); await util.browser.switchToIframe("[id='sampleFrame']"); }); it("Execution & Verification", async function () { const selector = { elementProperties: { viewName: "sap.m.sample.CheckBox.CheckBoxGroup", metadata: "sap.m.CheckBox", text: "Option b" } }; const index = 0; const timeout = 30000; const property = "selected"; // need to make sure that getPropertyValue returns a stringified boolean await expect(await ui5.element.getPropertyValue(selector, property, index, timeout)).toStrictEqual(false); }); });