UNPKG

playwright-pom-materials

Version:

Playwright POM materials

43 lines (42 loc) 1.68 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.Displayable = void 0; class Displayable { constructor(locator) { this.locator = locator; } isVisible() { return this.locator.isVisible(); } isHidden() { return this.locator.isHidden(); } shouldBeVisible(options) { return this.locator.waitFor(Object.assign({ state: 'visible' }, options)); } shouldNotBeVisible(options) { return __awaiter(this, void 0, void 0, function* () { if (yield this.locator.isHidden()) { return; // 見えていないのであればOK } else { return this.locator.waitFor(Object.assign({ state: 'hidden' }, options)); } }); } textContent() { return __awaiter(this, void 0, void 0, function* () { return (yield this.locator.textContent()) || ''; }); } } exports.Displayable = Displayable;