UNPKG

@vibe/testkit

Version:
54 lines 2.44 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.Search = void 0; const test_1 = require("@playwright/test"); const TextField_1 = require("./TextField"); const Button_1 = require("./Button"); const MenuButton_1 = require("./MenuButton"); /** * Class representing Search field element. * Extends the BaseElement class. */ class Search extends TextField_1.TextField { constructor(page, locator, elementReportName, filterMenuType) { super(page, locator, elementReportName); this.input = new TextField_1.TextField(this.page, this.locator.locator("[type='search']"), `${this.elementReportName} - Input`); this.cleanSearchButton = new Button_1.Button(this.page, this.locator.locator("[aria-label='Clear']"), "Clean Button"); if (filterMenuType) { this.filterButton = new MenuButton_1.MenuButton(this.page, this.locator.locator("[aria-label='Filters']").nth(1), "Filter Button", filterMenuType); } } /** * Set the search field text. * @param text */ setText(text) { return __awaiter(this, void 0, void 0, function* () { yield test_1.test.step("Set text in search field", () => __awaiter(this, void 0, void 0, function* () { yield this.input.setText(text); })); }); } /** * Clear the search field. * @returns {Promise<void>} */ clear() { return __awaiter(this, void 0, void 0, function* () { yield test_1.test.step("Clear search field", () => __awaiter(this, void 0, void 0, function* () { yield this.cleanSearchButton.click(); })); }); } } exports.Search = Search; //# sourceMappingURL=Search.js.map