Skip to content

Commit

Permalink
fix: relax grabCookie type
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Oct 10, 2023
1 parent ed5d43c commit 5e4fd6a
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion docs/helpers/Nightmare.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ assert(cookie.value, '123456');
- `name` **[string][3]?** cookie name.
Returns **([Promise][8]<[string][3]> | [Promise][8]<[Array][10]<[string][3]>>)** attribute valueCookie in JSON format. If name not passed returns all cookies for this domain.Multiple cookies can be received by passing query object `I.grabCookie({ secure: true});`. If you'd like get all cookies for all urls, use: `.grabCookie({ url: null }).`
Returns **any** attribute valueCookie in JSON format. If name not passed returns all cookies for this domain.Multiple cookies can be received by passing query object `I.grabCookie({ secure: true});`. If you'd like get all cookies for all urls, use: `.grabCookie({ url: null }).`
### grabCssPropertyFrom
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/Playwright.md
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ assert(cookie.value, '123456');

- `name` **[string][8]?** cookie name.

Returns **([Promise][21]<[string][8]> | [Promise][21]<[Array][9]<[string][8]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
Returns **any** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.

### grabCssPropertyFrom

Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/Protractor.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ assert(cookie.value, '123456');
- `name` **[string][9]?** cookie name.
Returns **([Promise][13]<[string][9]> | [Promise][13]<[Array][14]<[string][9]>>)** attribute valueReturns cookie in JSON [format][16].
Returns **any** attribute valueReturns cookie in JSON [format][16].
### grabCssPropertyFrom
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/Puppeteer.md
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ assert(cookie.value, '123456');
- `name` **[string][6]?** cookie name.
Returns **([Promise][13]<[string][6]> | [Promise][13]<[Array][15]<[string][6]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
Returns **any** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
### grabCssPropertyFrom
Expand Down
56 changes: 28 additions & 28 deletions docs/helpers/TestCafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ assert(cookie.value, '123456');

- `name` **[string][4]?** cookie name.

Returns **([Promise][9]<[string][4]> | [Promise][9]<[Array][11]<[string][4]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
Returns **any** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.

### grabCurrentUrl

Expand All @@ -547,7 +547,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');

- `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.

Returns **[Promise][9]<[number][12]>** number of visible elements
Returns **[Promise][9]<[number][11]>** number of visible elements

### grabPageScrollPosition

Expand Down Expand Up @@ -601,7 +601,7 @@ let pins = await I.grabTextFromAll('#pin li');

- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.

Returns **[Promise][9]<[Array][11]<[string][4]>>** attribute value
Returns **[Promise][9]<[Array][12]<[string][4]>>** attribute value

### grabValueFrom

Expand Down Expand Up @@ -632,7 +632,7 @@ let inputs = await I.grabValueFromAll('//form/input');

- `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.

Returns **[Promise][9]<[Array][11]<[string][4]>>** attribute value
Returns **[Promise][9]<[Array][12]<[string][4]>>** attribute value

### moveCursorTo

Expand All @@ -647,8 +647,8 @@ I.moveCursorTo('#submit', 5,5);
#### Parameters

- `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.
- `offsetX` **[number][12]** (optional, `0` by default) X-axis offset.
- `offsetY` **[number][12]** (optional, `0` by default) Y-axis offset.
- `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
- `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
⚠️ returns a _promise_ which is synchronized internally by recorder

### pressKey
Expand All @@ -665,7 +665,7 @@ I.pressKey(['Control','a']);

#### Parameters

- `key` **([string][4] | [Array][11]<[string][4]>)** key or array of keys to press.
- `key` **([string][4] | [Array][12]<[string][4]>)** key or array of keys to press.
⚠️ returns a _promise_ which is synchronized internally by recorder


Expand Down Expand Up @@ -718,8 +718,8 @@ First parameter can be set to `maximize`.

#### Parameters

- `width` **[number][12]** width in pixels or `maximize`.
- `height` **[number][12]** height in pixels.
- `width` **[number][11]** width in pixels or `maximize`.
- `height` **[number][11]** height in pixels.
⚠️ returns a _promise_ which is synchronized internally by recorder

### rightClick
Expand Down Expand Up @@ -806,8 +806,8 @@ I.scrollTo('#submit', 5, 5);
#### Parameters

- `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.
- `offsetX` **[number][12]** (optional, `0` by default) X-axis offset.
- `offsetY` **[number][12]** (optional, `0` by default) Y-axis offset.
- `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
- `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
⚠️ returns a _promise_ which is synchronized internally by recorder

### see
Expand Down Expand Up @@ -955,7 +955,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
#### Parameters

- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
- `num` **[number][12]** number of elements.
- `num` **[number][11]** number of elements.
⚠️ returns a _promise_ which is synchronized internally by recorder

### seeTextEquals
Expand Down Expand Up @@ -995,7 +995,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
#### Parameters

- `select` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
- `option` **([string][4] | [Array][11]<any>)** visible text or value of option.
- `option` **([string][4] | [Array][12]<any>)** visible text or value of option.
⚠️ returns a _promise_ which is synchronized internally by recorder

### setCookie
Expand All @@ -1016,7 +1016,7 @@ I.setCookie([

#### Parameters

- `cookie` **(Cookie | [Array][11]<Cookie>)** a cookie object or array of cookie objects.
- `cookie` **(Cookie | [Array][12]<Cookie>)** a cookie object or array of cookie objects.
⚠️ returns a _promise_ which is synchronized internally by recorder

### switchTo
Expand Down Expand Up @@ -1082,7 +1082,7 @@ I.wait(2); // wait 2 secs

#### Parameters

- `sec` **[number][12]** number of second to wait.
- `sec` **[number][11]** number of second to wait.
⚠️ returns a _promise_ which is synchronized internally by recorder

### waitForElement
Expand All @@ -1098,7 +1098,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
#### Parameters

- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
- `sec` **[number][12]?** (optional, `1` by default) time in seconds to wait
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
⚠️ returns a _promise_ which is synchronized internally by recorder

### waitForFunction
Expand All @@ -1119,8 +1119,8 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
#### Parameters

- `fn` **([string][4] | [function][8])** to be executed in browser context.
- `argsOrSec` **([Array][11]<any> | [number][12])?** (optional, `1` by default) arguments for function or seconds.
- `sec` **[number][12]?** (optional, `1` by default) time in seconds to wait
- `argsOrSec` **([Array][12]<any> | [number][11])?** (optional, `1` by default) arguments for function or seconds.
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
⚠️ returns a _promise_ which is synchronized internally by recorder

### waitForInvisible
Expand All @@ -1135,7 +1135,7 @@ I.waitForInvisible('#popup');
#### Parameters

- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
⚠️ returns a _promise_ which is synchronized internally by recorder

### waitForText
Expand All @@ -1152,7 +1152,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
#### Parameters

- `text` **[string][4]** to wait for.
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
- `context` **([string][4] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
⚠️ returns a _promise_ which is synchronized internally by recorder

Expand All @@ -1168,7 +1168,7 @@ I.waitForVisible('#popup');
#### Parameters

- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
⚠️ returns a _promise_ which is synchronized internally by recorder

### waitInUrl
Expand All @@ -1182,7 +1182,7 @@ I.waitInUrl('/info', 2);
#### Parameters

- `urlPart` **[string][4]** value to check.
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
⚠️ returns a _promise_ which is synchronized internally by recorder

### waitNumberOfVisibleElements
Expand All @@ -1196,8 +1196,8 @@ I.waitNumberOfVisibleElements('a', 3);
#### Parameters

- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
- `num` **[number][12]** number of elements.
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
- `num` **[number][11]** number of elements.
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
⚠️ returns a _promise_ which is synchronized internally by recorder

### waitToHide
Expand All @@ -1212,7 +1212,7 @@ I.waitToHide('#popup');
#### Parameters

- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
⚠️ returns a _promise_ which is synchronized internally by recorder

### waitUrlEquals
Expand All @@ -1227,7 +1227,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
#### Parameters

- `urlPart` **[string][4]** value to check.
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
⚠️ returns a _promise_ which is synchronized internally by recorder

## getPageUrl
Expand Down Expand Up @@ -1258,9 +1258,9 @@ Client Functions

[10]: https://playwright.dev/docs/api/class-locator#locator-focus

[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[13]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value

Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/WebDriver.md
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ assert(cookie.value, '123456');
- `name` **[string][17]?** cookie name.
Returns **([Promise][25]<[string][17]> | [Promise][25]<[Array][28]<[string][17]>>)** attribute value
Returns **any** attribute value
### grabCssPropertyFrom
Expand Down
2 changes: 1 addition & 1 deletion docs/webapi/grabCookie.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ assert(cookie.value, '123456');
```

@param {?string} [name=null] cookie name.
@returns {Promise<string>|Promise<string[]>} attribute value
@returns {any} attribute value
2 changes: 1 addition & 1 deletion typings/tests/helpers/Playwright.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ playwright.seeNumberOfVisibleElements(str, num); // $ExpectType void
playwright.setCookie({ name: str, value: str}); // $ExpectType void
playwright.seeCookie(str); // $ExpectType void
playwright.dontSeeCookie(str); // $ExpectType void
playwright.grabCookie(); // $ExpectType Promise<string[]> | Promise<string>
playwright.grabCookie(); // $ExpectType any
playwright.clearCookie(); // $ExpectType void
playwright.executeScript(() => {}); // $ExpectType Promise<any>
playwright.grabTextFrom(str); // $ExpectType Promise<string>
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 @@ -91,7 +91,7 @@ playwright.seeNumberOfVisibleElements(str, num); // $ExpectType Promise<any>
playwright.setCookie({ name: str, value: str}); // $ExpectType Promise<any>
playwright.seeCookie(str); // $ExpectType Promise<any>
playwright.dontSeeCookie(str); // $ExpectType Promise<any>
playwright.grabCookie(); // $ExpectType Promise<string[]> | Promise<string>
playwright.grabCookie(); // $ExpectType Promise<any>
playwright.clearCookie(); // $ExpectType Promise<any>
playwright.executeScript(() => {}); // $ExpectType Promise<any>
playwright.grabTextFrom(str); // $ExpectType Promise<string>
Expand Down
4 changes: 2 additions & 2 deletions typings/tests/helpers/WebDriverIO.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ wd.grabCurrentUrl(); // $ExpectType Promise<string>
wd.grabNumberOfVisibleElements(); // $ExpectError
wd.grabNumberOfVisibleElements('div'); // $ExpectType Promise<number>

wd.grabCookie(); // $ExpectType Promise<string[]> | Promise<string>
wd.grabCookie('name'); // $ExpectType Promise<string[]> | Promise<string>
wd.grabCookie(); // $ExpectType any
wd.grabCookie('name'); // $ExpectType any

wd.grabPopupText(); // $ExpectType Promise<string>

Expand Down

0 comments on commit 5e4fd6a

Please sign in to comment.