UNPKG

playwright-fluent

Version:
49 lines (48 loc) 1.92 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 - click', () => { let p; beforeEach(() => { p = new SUT.PlaywrightFluent(); }); afterEach(async () => { await p.close(); }); test('should continue test execution on new opened tab - chromium', async () => { // Given const url = `file:${path.join(__dirname, 'auto-switch-to-opened-tab.test.html')}`; const checkMeOut = p.selector('label').withText('Check me out').parent().find('input'); const storyBookIframe = 'iframe#storybook-preview-iframe'; // When await p .withBrowser('chromium') .withOptions({ headless: false }) .withCursor() .emulateDevice('iPhone 6 landscape') .navigateTo(url) .click(p.selector('a[target="_blank"]').withText('open reactstrap form')) .switchToIframe(storyBookIframe) .click(checkMeOut) .expectThatSelector(checkMeOut) .hasFocus(); // Then expect(await p.getCurrentUrl()).toContain('https://reactstrap.github.io'); }); test('should detect redirection to another tab - chromium', async () => { // Given const url = `file:${path.join(__dirname, 'auto-switch-to-opened-tab.test.html')}`; // When await p .withBrowser('chromium') .withOptions({ headless: false }) .withCursor() .emulateDevice('iPhone 6 landscape') .navigateTo(url) .click(p.selector('a[target="_blank"]').withText('open reactstrap form')); // Then expect(p.hasBeenRedirectedToAnotherTab()).toBe(true); }); });