UNPKG

playwright-fluent

Version:
34 lines (33 loc) 1.3 kB
"use strict"; 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 - clickAtPosition', () => { let p; beforeEach(() => { p = new SUT.PlaywrightFluent(); }); afterEach(async () => { await p.close(); }); test('should click at given position - chromium', async () => { var _a; // Given const url = `file:${path.join(__dirname, 'click-at-position.test.html')}`; const switchContainer = p.selector('#switch-container'); // When await p .withBrowser('chromium') .withOptions({ headless: false }) .withCursor() .navigateTo(url) .hover(switchContainer) .expectThat(switchContainer.find('input')) .isUnchecked(); const leftPointOfContainer = (_a = (await switchContainer.leftPosition())) !== null && _a !== void 0 ? _a : { x: -100, y: -100 }; await p.clickAtPosition({ x: leftPointOfContainer.x + 10, y: leftPointOfContainer.y }); // Then await p.expectThat(switchContainer.find('input')).isChecked(); }); });