diff --git a/docs/helpers/Playwright.md b/docs/helpers/Playwright.md index b1f7ea5a1..829e406f3 100644 --- a/docs/helpers/Playwright.md +++ b/docs/helpers/Playwright.md @@ -1353,20 +1353,6 @@ I.waitForFile('avatar.jpg', 5); Returns **[Promise][21]<void>** -### haveRequestHeaders - -Set headers for all next requests - -```js -I.haveRequestHeaders({ - 'X-Sent-By': 'CodeceptJS', -}); -``` - -#### Parameters - -- `customHeaders` **[object][5]** headers to set - ### makeApiRequest Performs [api request][25] using @@ -2025,6 +2011,20 @@ I.setCookie([ - `cookie` **(Cookie | [Array][9]<Cookie>)** a cookie object or array of cookie objects. ⚠️ returns a _promise_ which is synchronized internally by recorder +### setPlaywrightRequestHeaders + +Set headers for all next requests + +```js +I.setPlaywrightRequestHeaders({ + 'X-Sent-By': 'CodeceptJS', +}); +``` + +#### Parameters + +- `customHeaders` **[object][5]** headers to set + ### startRecordingTraffic Starts recording the network traffics. diff --git a/docs/helpers/Puppeteer.md b/docs/helpers/Puppeteer.md index 0dcc642ae..49407086f 100644 --- a/docs/helpers/Puppeteer.md +++ b/docs/helpers/Puppeteer.md @@ -1201,20 +1201,6 @@ I.seeFile('avatar.jpg'); - `downloadPath` **[string][6]** change this parameter to set another directory for saving -### haveRequestHeaders - -Set headers for all next requests - -```js -I.haveRequestHeaders({ - 'X-Sent-By': 'CodeceptJS', -}); -``` - -#### Parameters - -- `customHeaders` **[object][4]** headers to set - ### moveCursorTo Moves cursor to element matched by locator. @@ -1776,6 +1762,20 @@ I.setCookie([ - `cookie` **(Cookie | [Array][15]<Cookie>)** a cookie object or array of cookie objects. ⚠️ returns a _promise_ which is synchronized internally by recorder +### setPuppeteerRequestHeaders + +Set headers for all next requests + +```js +I.setPuppeteerRequestHeaders({ + 'X-Sent-By': 'CodeceptJS', +}); +``` + +#### Parameters + +- `customHeaders` **[object][4]** headers to set + ### switchTo Switches frame or in case of null locator reverts to parent. diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index 2b84f1214..959c3e511 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -942,14 +942,14 @@ class Playwright extends Helper { * Set headers for all next requests * * ```js - * I.haveRequestHeaders({ + * I.setPlaywrightRequestHeaders({ * 'X-Sent-By': 'CodeceptJS', * }); * ``` * * @param {object} customHeaders headers to set */ - async haveRequestHeaders(customHeaders) { + async setPlaywrightRequestHeaders(customHeaders) { if (!customHeaders) { throw new Error('Cannot send empty headers.'); } diff --git a/lib/helper/Puppeteer.js b/lib/helper/Puppeteer.js index 89ba6df16..eb9284f6c 100644 --- a/lib/helper/Puppeteer.js +++ b/lib/helper/Puppeteer.js @@ -682,14 +682,14 @@ class Puppeteer extends Helper { * Set headers for all next requests * * ```js - * I.haveRequestHeaders({ + * I.setPuppeteerRequestHeaders({ * 'X-Sent-By': 'CodeceptJS', * }); * ``` * * @param {object} customHeaders headers to set */ - async haveRequestHeaders(customHeaders) { + async setPuppeteerRequestHeaders(customHeaders) { if (!customHeaders) { throw new Error('Cannot send empty headers.'); } diff --git a/typings/tests/helpers/Playwright.types.ts b/typings/tests/helpers/Playwright.types.ts index 014640ceb..51d0766d3 100644 --- a/typings/tests/helpers/Playwright.types.ts +++ b/typings/tests/helpers/Playwright.types.ts @@ -22,7 +22,7 @@ playwright._createContextPage(); // $ExpectType void playwright._createContextPage({}); // $ExpectType void playwright.amOnPage(str); // $ExpectType void playwright.resizeWindow(num, num); // $ExpectType void -playwright.haveRequestHeaders(str); // $ExpectType void +playwright.setPlaywrightRequestHeaders(str); // $ExpectType void playwright.moveCursorTo(str, num, num); // $ExpectType void playwright.dragAndDrop(str); // $ExpectError playwright.dragAndDrop(str, str); // $ExpectType void diff --git a/typings/tests/helpers/PlaywrightTs.types.ts b/typings/tests/helpers/PlaywrightTs.types.ts index afa434b6f..7eb4f0eb2 100644 --- a/typings/tests/helpers/PlaywrightTs.types.ts +++ b/typings/tests/helpers/PlaywrightTs.types.ts @@ -20,7 +20,7 @@ playwright._getPageUrl(); // $ExpectType Promise playwright.grabPopupText(); // $ExpectType Promise playwright.amOnPage(str); // $ExpectType Promise playwright.resizeWindow(num, num); // $ExpectType Promise -playwright.haveRequestHeaders(str); // $ExpectType Promise +playwright.setPlaywrightRequestHeaders(str); // $ExpectType Promise playwright.moveCursorTo(str, num, num); // $ExpectType Promise playwright.dragAndDrop(str); // $ExpectError playwright.dragAndDrop(str, str); // $ExpectType Promise