testcafe-modheader
v1.0.14
Published
A package to set ModHeader values in TestCafe tests.
Downloads
10
Maintainers
Readme
TestCafe ModHeader Package
This package allows you to set ModHeader values in your TestCafe test cases. It provides a convenient way to manipulate request headers using the ModHeader Chrome extension during your TestCafe tests.
Installation
You can install the package via npm:
npm install testcafe-modheader --save-dev
Usage
import testCafeModHeader from 'testcafe-modheader';
fixture`Example Page`.page`http://www.example.com`;
test('Example Test', async (t) => {
// Define the request headers
const requestHeaders = {
'Authorization': 'Bearer your_token_here',
'Content-Type': 'application/json',
};
// Set the ModHeader values
await testCafeModHeader.setModHeaders(requestHeaders);
// Execute your TestCafe test steps here
await t
.typeText('#inputField', 'Test input')
.click('#submitButton')
.expect(Selector('#result').innerText).eql('Expected Result');
});