playwright-fluent
Version:
Fluent API around playwright
56 lines (55 loc) • 1.77 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"));
describe('Playwright Fluent - pressKey', () => {
let p;
beforeEach(() => {
p = new SUT.PlaywrightFluent();
});
afterEach(async () => {
await p.close();
});
test('should press key Tab - chromium', async () => {
// Given
const url = `file:${path.join(__dirname, 'press-key.test.html')}`;
// When
await p
.withBrowser('chromium')
.withOptions({ headless: false })
.withCursor()
.navigateTo(url)
.click('#field1')
.expectThatSelector('#field1')
.hasFocus()
.pressKey('Tab')
.expectThatSelector('#field2')
.hasFocus()
.pressKey('Tab')
.expectThatSelector('#field3')
.hasFocus();
});
test('should enter a number with decimal digits - chromium', async () => {
// Given
const url = `file:${path.join(__dirname, 'press-key.test.html')}`;
// When
await p
.withBrowser('chromium')
.withOptions({ headless: false })
.withCursor()
.navigateTo(url)
.click('#fieldNumber')
.expectThatSelector('#fieldNumber')
.hasFocus()
.clearText()
.pressKey('1')
.pressKey('2')
.pressKey('3')
.pressKey('.')
.pressKey('4')
.pressKey('5')
.expectThatSelector('#fieldNumber')
.hasValue('123.45');
});
});
;