UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

94 lines 4.08 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ColorPicker = void 0; const ui_component_1 = require("./ui-component"); const selenium_1 = require("../selenium"); class ColorPicker extends ui_component_1.UIComponent { constructor(browser, locator = ColorPicker.SELECTOR, parentElement) { super(browser, locator, parentElement); this.parentElement = parentElement; } popupLocator() { return __awaiter(this, void 0, void 0, function* () { yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return (yield (yield this.root()).getAttribute("aria-controls")) !== null; }), { timeout: 5000, message: "Failed to detect popup id." }); const rootId = yield (yield this.root()).getAttribute("aria-controls"); const xpathSelector = `//*[contains(@id, "${rootId}")]`; return selenium_1.By.xpath(xpathSelector); }); } popup() { return __awaiter(this, void 0, void 0, function* () { const popup = yield this.popupLocator(); return yield this.browser.find(popup); }); } value() { return __awaiter(this, void 0, void 0, function* () { const element = yield this.findChild(".k-input-inner .k-color-preview-mask"); return this.browser.getBackgroundColor(element); }); } input() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(".k-input input"); }); } hvsRectangle() { return __awaiter(this, void 0, void 0, function* () { return yield this.browser.findChild(yield this.popupLocator(), ".k-hsv-rectangle"); }); } cancelButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.browser.findChild(yield this.popupLocator(), ".k-coloreditor-cancel"); }); } applyButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.browser.findChild(yield this.popupLocator(), ".k-coloreditor-apply"); }); } open() { return __awaiter(this, void 0, void 0, function* () { yield (yield this.root()).click(); yield this.browser.wait(selenium_1.EC.isVisible(yield this.popupLocator()), { timeout: 5000, message: "Failed to expand color picker popup.", }); }); } apply() { return __awaiter(this, void 0, void 0, function* () { yield (yield this.applyButton()).click(); yield this.browser.wait(selenium_1.EC.notVisible(yield this.popupLocator()), { timeout: 5000, message: "Failed to close color picker popup when apply changes.", }); }); } isOpen() { return __awaiter(this, void 0, void 0, function* () { const popupLocator = yield this.popupLocator(); if ((yield this.browser.findAll(popupLocator)).length === 0) { return false; } else { return (yield this.browser.find(popupLocator)).isDisplayed(); } }); } } exports.ColorPicker = ColorPicker; ColorPicker.SELECTOR = ".k-colorpicker"; //# sourceMappingURL=colorpicker.js.map