playwright-fluent
Version:
Fluent API around playwright
63 lines (62 loc) • 2.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const SUT = tslib_1.__importStar(require("../../playwright-fluent"));
describe('Playwright Fluent - navigateTo', () => {
let p;
beforeEach(() => {
p = new SUT.PlaywrightFluent();
});
afterEach(async () => {
await p.close();
});
test('should give back an error on navigating to an url without launching the browser', async () => {
// Given
// When
let result = undefined;
try {
await p.navigateTo('https://www.google.fr');
}
catch (error) {
result = error;
}
// Then
expect(result && result.message).toContain("Cannot navigate to 'https://www.google.fr' because no browser has been launched");
});
test('should navigate to url with chromium', async () => {
// Given
const url = 'https://reactstrap.github.io/?path=/docs/components-forms--input';
// When
// prettier-ignore
await p
.withBrowser('chromium')
.navigateTo(url);
// Then
expect(await p.getCurrentUrl()).toBe(`${url}`);
expect(p.lastError()).toBe(undefined);
});
test('should navigate to url with firefox', async () => {
// Given
const url = 'https://reactstrap.github.io/?path=/docs/components-forms--input';
// When
// prettier-ignore
await p
.withBrowser('firefox')
.navigateTo(url);
// Then
expect(await p.getCurrentUrl()).toBe(`${url}`);
expect(p.lastError()).toBe(undefined);
});
test('should navigate to url with webkit', async () => {
// Given
const url = 'https://reactstrap.github.io/?path=/docs/components-forms--input';
// When
// prettier-ignore
await p
.withBrowser('webkit')
.navigateTo(url);
// Then
expect(await p.getCurrentUrl()).toBe(`${url}`);
expect(p.lastError()).toBe(undefined);
});
});