@vibe/testkit
Version:
Vibe e2e testing toolkit
48 lines • 1.98 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 { BaseElement } from "./BaseElement";
/**
* Class representing a Checkbox element.
* Extends the BaseElement class.
*/
export class Checkbox extends BaseElement {
/**
* Create a Checkbox.
* @param {Page} page - The Playwright page object.
* @param {Locator} locator - The locator for the Checkbox element.
* @param {string} elementReportName - The name for reporting purposes.
*/
constructor(page, locator, elementReportName) {
super(page, locator, elementReportName);
this.page = page;
this.locator = locator;
this.elementReportName = elementReportName;
}
/**
* Set the checked state of the checkbox.
* @param {boolean} isToCheck - True to check the checkbox, false to uncheck.
* @returns {Promise<void>}
*/
setChecked(isToCheck) {
return __awaiter(this, void 0, void 0, function* () {
yield this.locator.setChecked(isToCheck);
});
}
/**
* Check if the checkbox is checked.
* @returns {Promise<boolean>} True if the checkbox is checked, false otherwise.
*/
isChecked() {
return __awaiter(this, void 0, void 0, function* () {
return this.locator.isChecked();
});
}
}
//# sourceMappingURL=Checkbox.js.map