playwright-fluent
Version:
Fluent API around playwright
50 lines (49 loc) • 2.01 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const path = tslib_1.__importStar(require("path"));
const SUT = tslib_1.__importStar(require("../../playwright-fluent"));
const utils_1 = require("../../../utils");
describe('Playwright Fluent - expectThat isEnabled with default assert options', () => {
let p;
beforeEach(() => {
p = new SUT.PlaywrightFluent();
});
afterEach(async () => {
await p.close();
});
test('should wait until selector exists and is enabled - chromium', async () => {
// Given
const url = `file:${path.join(__dirname, 'with-default-assert-options.test.html')}`;
const selector = '#dynamically-added-input';
// When
await p
.withBrowser('chromium')
.withOptions({ headless: false })
.withCursor()
.withDefaultAssertOptions({ stabilityInMilliseconds: 0, timeoutInMilliseconds: 10000 })
.navigateTo(url)
.expectThatSelector(selector)
.isEnabled();
// Then
const isEnabled = await p.isEnabled(selector, utils_1.noWaitNoThrowOptions);
expect(isEnabled).toBe(true);
});
test('should wait until selector object exists and is enabled - chromium', async () => {
// Given
const url = `file:${path.join(__dirname, 'with-default-assert-options.test.html')}`;
const selector = p.selector('input').withValue('dynamically added');
// When
await p
.withBrowser('chromium')
.withOptions({ headless: false })
.withDefaultAssertOptions({ stabilityInMilliseconds: 0, timeoutInMilliseconds: 10000 })
.withCursor()
.navigateTo(url)
.expectThatSelector(selector)
.isEnabled();
// Then
const isEnabled = await p.isEnabled(selector, utils_1.noWaitNoThrowOptions);
expect(isEnabled).toBe(true);
});
});
;