You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/src/codegen.md
+13-13
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Install the VS Code extension and generate tests directly from VS Code. The exte
21
21
22
22
### Record a New Test
23
23
24
-
To record a test click on the **Record new** button from the Testing sidebar. This will create a `test-1.spec.ts` file as well as open up a browser window.
24
+
To record a test click on the **Record new** button from the Testing sidebar. This will create a `test-1.spec.ts` file as well as open up a browser window.
25
25
26
26
<imgwidth="1385"alt="record new in vs code"src="https://user-images.githubusercontent.com/13063165/220961665-615d0ab8-3f0b-439c-ad0b-0424d9aa154b.png" />
27
27
@@ -58,16 +58,16 @@ In the test file in VS Code you will see your new generated actions added to you
58
58
59
59
### Generating locators
60
60
61
-
You can generate locators with the test generator.
62
-
- Click on the **Pick locator** button form the testing sidebar and then hover over elements in the browser window to see the [locator](./locators.md) highlighted underneath each element.
63
-
- Click the element you require and it will now show up in the **Pick locator** box in VS Code.
61
+
You can generate locators with the test generator.
62
+
- Click on the **Pick locator** button form the testing sidebar and then hover over elements in the browser window to see the [locator](./locators.md) highlighted underneath each element.
63
+
- Click the element you require and it will now show up in the **Pick locator** box in VS Code.
64
64
- Press <kbd>Enter</kbd> on your keyboard to copy the locator into the clipboard and then paste anywhere in your code. Or press 'escape' if you want to cancel.
65
65
66
66
<imgwidth="1641"alt="Pick locators in VS code"src="https://user-images.githubusercontent.com/13063165/220958368-95b03620-3c9b-40a8-be74-01c96ba03cad.png" />
67
67
68
68
## Generate tests with the Playwright Inspector
69
69
70
-
When running the `codegen` command two windows will be opened, a browser window where you interact with the website you wish to test and the Playwright Inspector window where you can record your tests and then copy them into your editor.
70
+
When running the `codegen` command two windows will be opened, a browser window where you interact with the website you wish to test and the Playwright Inspector window where you can record your tests and then copy them into your editor.
71
71
72
72
### Running Codegen
73
73
@@ -128,10 +128,10 @@ When you have finished interacting with the page, press the **record** button to
128
128
Use the **clear** button to clear the code to start recording again. Once finished, close the Playwright inspector window or stop the terminal command.
129
129
130
130
### Generating locators
131
-
You can generate [locators](/locators.md) with the test generator.
131
+
You can generate [locators](/locators.md) with the test generator.
132
132
133
133
* Press the `'Record'` button to stop the recording and the `'Pick Locator'` button will appear.
134
-
* Click on the `'Pick Locator'` button and then hover over elements in the browser window to see the locator highlighted underneath each element.
134
+
* Click on the `'Pick Locator'` button and then hover over elements in the browser window to see the locator highlighted underneath each element.
135
135
* To choose a locator, click on the element you would like to locate and the code for that locator will appear in the field next to the Pick Locator button.
136
136
* You can then edit the locator in this field to fine tune it or use the copy button to copy it and paste it into your code.
137
137
@@ -164,19 +164,19 @@ You can use the test generator to generate tests using emulation so as to genera
164
164
Playwright opens a browser window with its viewport set to a specific width and height and is not responsive as tests need to be run under the same conditions. Use the `--viewport` option to generate tests with a different viewport size.
Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
328
+
Run `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) at the end of the session. This is useful to separately record an authentication step and reuse it later when recording more tests.
After performing authentication and closing the browser, `auth.json` will contain the storage state which you can then reuse in your tests.
370
+
After performing authentication and closing the browser, `auth.json` will contain the storage state which you can then reuse in your tests.
371
371
372
372
<imgwidth="1394"alt="login to GitHub screen"src="https://user-images.githubusercontent.com/13063165/220561688-04b2b984-4ba6-4446-8b0a-8058876e2a02.png" />
0 commit comments