UNPKG

@vibe/testkit

Version:
43 lines 1.91 kB
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()); }); }; import { test } from "@playwright/test"; import { BaseElement } from "./BaseElement"; /** * Class representing an IconButton element. * Extends the BaseElement class. */ export class IconButton extends BaseElement { /** * Create an IconButton element. * @param {Page} page - The Playwright page object. * @param {Locator} locator - The locator for the IconButton element. * @param {string} elementReportName - The name for reporting purposes. */ constructor(page, locator, elementReportName, menu) { super(page, locator, elementReportName); this.menu = menu; } /** * Select an item from the menu. * @param {string} itemName - The name of the item to select. * @returns {Promise<void>} */ selectItem(itemName) { return __awaiter(this, void 0, void 0, function* () { yield test.step(`Click menu item by name ${itemName} for ${this.getElementReportName()}`, () => __awaiter(this, void 0, void 0, function* () { yield this.click(); if (this.menu) { yield this.menu.selectItem(itemName); } })); }); } } //# sourceMappingURL=IconButton.js.map