@vibe/testkit
Version:
Vibe e2e testing toolkit
45 lines • 1.94 kB
JavaScript
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";
export class RadioButton extends BaseElement {
/**
* Create a RadioButton.
* @param {Page} page - The Playwright page object.
* @param {Locator} locator - The locator for the RadioButton element.
* @param {string} elementReportName - The name for reporting purposes.
*/
constructor(page, locator, elementReportName) {
super(page, locator, elementReportName);
}
/**
* Select the RadioButton element.
* @returns {Promise<void>}
*/
select() {
return __awaiter(this, void 0, void 0, function* () {
yield test.step(`Select ${this.elementReportName}`, () => __awaiter(this, void 0, void 0, function* () {
yield this.locator.check();
}));
});
}
/**
* Unselect the RadioButton element.
* @returns {Promise<void>}
*/
unselect() {
return __awaiter(this, void 0, void 0, function* () {
yield test.step(`Unselect ${this.elementReportName}`, () => __awaiter(this, void 0, void 0, function* () {
yield this.locator.uncheck();
}));
});
}
}
//# sourceMappingURL=RadioButton.js.map