UNPKG

@redhat-developer/page-objects

Version:

Page Object API implementation for a VS Code editor used by ExTester framework.

75 lines 3.1 kB
"use strict"; /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License", destination); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.TitleActionButton = exports.ViewTitlePart = void 0; const ElementWithContextMenu_1 = require("../ElementWithContextMenu"); const AbstractElement_1 = require("../AbstractElement"); const __1 = require("../.."); /** * Page object representing the top (title) part of a side bar view */ class ViewTitlePart extends ElementWithContextMenu_1.ElementWithContextMenu { constructor(view = new __1.SideBarView()) { super(ViewTitlePart.locators.ViewTitlePart.constructor, view); } /** * Returns the displayed title of the view * @returns Promise resolving to displayed title */ async getTitle() { return await this.findElement(ViewTitlePart.locators.ViewTitlePart.title).getText(); } /** * Finds action buttons inside the view title part * @returns Promise resolving to array of TitleActionButton objects */ async getActions() { const actions = []; const elements = await this.findElements(ViewTitlePart.locators.ViewTitlePart.action); for (const element of elements) { const title = await element.getAttribute(ViewTitlePart.locators.ViewTitlePart.actionLabel); actions.push(await new TitleActionButton(TitleActionButton.locators.ViewTitlePart.actionConstructor(title), this).wait()); } return actions; } /** * Finds an action button by title * @param title title of the button to search for * @returns Promise resolving to TitleActionButton object */ async getAction(title) { return new TitleActionButton(TitleActionButton.locators.ViewTitlePart.actionConstructor(title), this); } } exports.ViewTitlePart = ViewTitlePart; /** * Page object representing a button inside the view title part */ class TitleActionButton extends AbstractElement_1.AbstractElement { constructor(actionConstructor, viewTitle) { super(actionConstructor, viewTitle); } /** * Get title of the button */ async getTitle() { return await this.getAttribute(TitleActionButton.locators.ViewTitlePart.actionLabel); } } exports.TitleActionButton = TitleActionButton; //# sourceMappingURL=ViewTitlePart.js.map