playwright-fluent
Version:
Fluent API around playwright
31 lines (30 loc) • 1.12 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const playwright_fluent_1 = require("../../playwright-fluent");
const utils_1 = require("../../../utils");
describe('Playwright Fluent - withExtraHttpHeaders', () => {
let p;
beforeEach(() => {
p = new playwright_fluent_1.PlaywrightFluent();
});
afterEach(async () => {
await p.close();
});
test('should set headers - webkit', async () => {
// Given
const browser = 'webkit';
const url = 'https://reactstrap.github.io';
// When
await p
.withBrowser(browser)
.withOptions({ headless: false })
.withExtraHttpHeaders({ 'X-FOO': 'false', 'X-BAR': 'true' })
.recordRequestsTo('/reactstrap.github.io')
.navigateTo(url);
// Then
const requests = await p.getRecordedRequestsTo(url);
const firstRequest = requests[0];
const request = await (0, utils_1.toRequestInfo)(firstRequest);
expect(request.headers).toMatchObject({ 'x-foo': 'false', 'x-bar': 'true' });
});
});
;