Skip to content

Commit 4f7a2b3

Browse files
author
rocketraccoon
committed
docs: add getState and config options
1 parent 7b7a93a commit 4f7a2b3

File tree

6 files changed

+1064
-833
lines changed

6 files changed

+1064
-833
lines changed

docs/commands/browser/getState.mdx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import Version from "../../_partials/specs/version.mdx";
2+
3+
# getState
4+
5+
<Version version="8.38.0" />
6+
7+
## Overview {#overview}
8+
9+
A browser command that restores the session state from a file which previously saved using the [saveState][saveState] command.
10+
11+
## Usage {#usage}
12+
13+
```typescript
14+
import type { SaveStateData } from "testplane";
15+
16+
const stateDump: SaveStateData = await browser.getState({
17+
path: "./stateDump.json",
18+
});
19+
```
20+
21+
## Command Parameters {#parameters}
22+
23+
<table>
24+
<thead>
25+
<tr>
26+
<td>**Name**</td>
27+
<td>**Type**</td>
28+
<td>**Default**</td>
29+
<td>**Description**</td>
30+
</tr>
31+
</thead>
32+
<tbody>
33+
<tr>
34+
<td>path</td>
35+
<td>`string`</td>
36+
<td>`-`</td>
37+
<td>Path to file with state.</td>
38+
</tr>
39+
</tbody>
40+
</table>
41+
42+
## Usage Examples {#examples}
43+
44+
Save state in file.
45+
46+
```typescript
47+
it("test", async ({ browser }) => {
48+
const stateData = await browser.getState({
49+
path: "./stateDump.json",
50+
});
51+
});
52+
```
53+
54+
## Related Commands {#related}
55+
56+
- [saveState](../saveState)

docs/commands/browser/restoreState.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ await browser.restoreState({
8484
Function for filtering cookies, receiving cookie objects, and returning boolean.
8585
</td>
8686
</tr>
87+
<tr>
88+
<td>refresh</td>
89+
<td>`boolean`</td>
90+
<td>`true`</td>
91+
<td>Refresh page after restore state.</td>
92+
</tr>
8793
</tbody>
8894
</table>
8995

@@ -99,9 +105,6 @@ it("test", async ({ browser }) => {
99105
path: "./stateDump.json",
100106
cookieFilter: ({ domain }) => domain === ".example.com",
101107
});
102-
103-
// Reload page for see auth result.
104-
await browser.refresh();
105108
});
106109
```
107110

0 commit comments

Comments
 (0)