Skip to content

fix: rename haveRequestHeaders of ppt and pw helpers #3937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions docs/helpers/Playwright.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
28 changes: 14 additions & 14 deletions docs/helpers/Puppeteer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
Expand Down
4 changes: 2 additions & 2 deletions lib/helper/Puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
Expand Down
2 changes: 1 addition & 1 deletion typings/tests/helpers/Playwright.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion typings/tests/helpers/PlaywrightTs.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ playwright._getPageUrl(); // $ExpectType Promise<any>
playwright.grabPopupText(); // $ExpectType Promise<string | null>
playwright.amOnPage(str); // $ExpectType Promise<any>
playwright.resizeWindow(num, num); // $ExpectType Promise<any>
playwright.haveRequestHeaders(str); // $ExpectType Promise<any>
playwright.setPlaywrightRequestHeaders(str); // $ExpectType Promise<any>
playwright.moveCursorTo(str, num, num); // $ExpectType Promise<any>
playwright.dragAndDrop(str); // $ExpectError
playwright.dragAndDrop(str, str); // $ExpectType Promise<any>
Expand Down