playwright-fluent
Version:
Fluent API around playwright
30 lines (29 loc) • 1.36 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 playwright_fluent_1 = require("../../playwright-fluent");
describe('Playwright Fluent - ctor usage', () => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
beforeEach(() => { });
test('should be called with both a browser and a page instance - chromium case', async () => {
// Given
const browser = await playwright_1.chromium.launch({ headless: true });
const context = await browser.newContext();
const url = `file:${path.join(__dirname, 'ctor.test.html')}`;
const page = await context.newPage();
await page.goto(url);
// When
const pwc1 = new playwright_fluent_1.PlaywrightFluent(browser);
const pwc2 = new playwright_fluent_1.PlaywrightFluent(undefined, page);
// Then
expect(pwc1.currentBrowser()).toBe(undefined);
expect(pwc1.currentPage()).toBe(undefined);
expect(pwc1.currentFrame()).toBe(undefined);
expect(pwc2.currentBrowser()).toBe(undefined);
expect(pwc2.currentPage()).toBe(undefined);
expect(pwc2.currentFrame()).toBe(undefined);
await browser.close();
});
});
;