From f78c027999b7446f2d035f38c0352942967de962 Mon Sep 17 00:00:00 2001 From: KobeNguyenT <7845001+kobenguyent@users.noreply.github.com> Date: Sat, 28 Oct 2023 13:26:42 +0200 Subject: [PATCH] fix: rename haveRequestHeaders of ppt and pw helpers (#3937) * fix: rename haveRequestHeaders of ppt and pw helpers * Update Playwright.types.ts * Update PlaywrightTs.types.ts --- docs/helpers/Playwright.md | 28 ++++++++++----------- docs/helpers/Puppeteer.md | 28 ++++++++++----------- lib/helper/Playwright.js | 4 +-- lib/helper/Puppeteer.js | 4 +-- typings/tests/helpers/Playwright.types.ts | 2 +- typings/tests/helpers/PlaywrightTs.types.ts | 2 +- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/docs/helpers/Playwright.md b/docs/helpers/Playwright.md index 8270b4713..cafce65a9 100644 --- a/docs/helpers/Playwright.md +++ b/docs/helpers/Playwright.md @@ -1377,20 +1377,6 @@ I.waitForFile('avatar.jpg', 5); Returns **[Promise][9]<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 @@ -2077,6 +2063,20 @@ I.setCookie([ Returns **[Promise][9]<void>** automatically synchronized promise through #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 589772e34..26b5e43b0 100644 --- a/docs/helpers/Puppeteer.md +++ b/docs/helpers/Puppeteer.md @@ -1227,20 +1227,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. @@ -1830,6 +1816,20 @@ I.setCookie([ Returns **[Promise][7]<void>** automatically synchronized promise through #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 9fb962006..b2aa9601a 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 fe3cfa17d..4d9e771b8 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 Promise playwright.resizeWindow(num, num); // $ExpectType Promise -playwright.haveRequestHeaders(str); // $ExpectType void +playwright.setPlaywrightRequestHeaders(str); // $ExpectType void playwright.moveCursorTo(str, num, num); // $ExpectType Promise playwright.dragAndDrop(str); // $ExpectError playwright.dragAndDrop(str, str); // $ExpectType Promise diff --git a/typings/tests/helpers/PlaywrightTs.types.ts b/typings/tests/helpers/PlaywrightTs.types.ts index 85b75591a..d4cbd6f23 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