playwright-fluent
Version:
Fluent API around playwright
38 lines (37 loc) • 1.56 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const path = tslib_1.__importStar(require("path"));
const playwright_1 = require("playwright");
const SUT = tslib_1.__importStar(require("../index"));
const dom_actions_1 = require("../../../dom-actions");
const handle_actions_1 = require("../../../handle-actions");
describe('check selector', () => {
let browser = undefined;
// eslint-disable-next-line @typescript-eslint/no-empty-function
beforeEach(() => { });
afterEach(async () => {
if (browser) {
await browser.close();
}
});
test('should wait for the selector to be enabled before checking - chromium', async () => {
// Given
browser = await playwright_1.chromium.launch({ headless: true });
const browserContext = await browser.newContext({ viewport: null });
const page = await browserContext.newPage();
await (0, dom_actions_1.showMousePosition)(page);
const url = `file:${path.join(__dirname, 'check-selector.test.html')}`;
await page.goto(url);
const selector = '#dynamically-added-input';
const options = {
...handle_actions_1.defaultCheckOptions,
verbose: false,
};
// When
await SUT.checkSelector(selector, page, options);
const handle = await page.$(selector);
// Then
expect(await (0, handle_actions_1.isHandleChecked)(handle, { verbose: options.verbose })).toBe(true);
});
});
;