diff --git a/docs/src/getting-started-vscode-js.md b/docs/src/getting-started-vscode-js.md index 3f028891ec..3a5adf5719 100644 --- a/docs/src/getting-started-vscode-js.md +++ b/docs/src/getting-started-vscode-js.md @@ -11,7 +11,7 @@ Get started by installing Playwright and generating a test to see it in action. Install the [VS Code extension from the marketplace](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright). -image +image Once installed, open the command panel and type: @@ -21,63 +21,76 @@ Install Playwright image -Select "Test: Install Playwright" and Choose the browsers you would like to run your tests on. These can be later configured in the [playwright.config file](./test-configuration.md) file. You can also choose if you would like to have a GitHub Actions setup to run your tests on CI. +Select "Test: Install Playwright" and Choose the browsers you would like to run your tests on. These can be later configured in the [playwright.config](./test-configuration.md) file. You can also choose if you would like to have a GitHub Actions setup to run your tests on CI. -## Generating Tests with Codegen - -[CodeGen](./codegen.md) will auto generate your tests for you and is a great way to quickly get started. Click on the Testing icon in the left menu to open the testing sidebar. - -### Recording a Test - -To record a test click on the record icon. This will create a `test-1.spec.ts` file as well as open up a browser window. - -image - -### Generating a Test - -As you interact with the page Codegen will generate the test for you in the newly created file in VS Code. When you hover over an element Playwright will highlight the element and show the [selector](./selectors.md) underneath it. - -image ## Running Tests You can run a single test by clicking the green triangle next to your test block to run your test. Playwright will run through each line of the test and when it finishes you will see a green tick next to your test block as well as the time it took to run the test. -image -### View All Tests -View all tests in the testing sidebar and extend the tests by clicking on each test. Tests that have not been run will not have the green check next to them. +image -image +### View and Run All Tests -### Run All Tests +View all tests in the testing sidebar and extend the tests by clicking on each test. Tests that have not been run will not have the green check next to them. Run all tests by clicking on the white triangle as you hover over the tests in the testing sidebar. -Run all tests by clicking on the white triangle as you hover over the tests in the testing sidebar. +image -image ### Run Tests on Specific Browsers The VS Code test runner runs your tests on the default browser of Chrome. To run on other/multiple browsers click the play button's dropdown and choose the option of "Select Default Profile" and select the browsers you wish to run your tests on. -image +image ## Debugging Tests -With the VS Code extension you can debug your tests right in VS Code see error messages and create breakpoints. Click next to the line number so a red dot appears and then run the tests in debug mode by right clicking on the line next to the test you want to run. A browser window will open and the test will run and pause at where the breakpoint is set. +With the VS Code extension you can debug your tests right in VS Code see error messages, create breakpoints and live debug your tests. -image +### Error Messages -### Live Debugging with VS Code +If your test fails VS Code will show you error messages right in the editor showing what was expected, what was received as well as a complete call log. -Modify your test right in VS Code while debugging and Playwright Test will highlight the selector you are modifying in the browser. You can step through the tests, pause the test and rerun the tests from the menu in VS Code. +image + +### Run in Debug Mode + +To set a breakpoint click next to the line number where you want the breakpoint to be until a red dot appears. Run the tests in debug mode by right clicking on the line next to the test you want to run. A browser window will open and the test will run and pause at where the breakpoint is set. + +image + + +### Live Debugging + +You can modify your test right in VS Code while debugging and Playwright will highlight the selector in the browser. This is a great way of seeing if the selector exits or if there is more than one result. You can step through the tests, pause the test and rerun the tests from the menu in VS Code. + +image + + +## Generating Tests + +CodeGen will auto generate your tests for you as you perform actions in the browser and is a great way to quickly get started. The viewport for the browser window is set to a specific width and height. See the [configuration guide](./test-configuration.md) to change the viewport or emulate different environments. + +### Recording a Test + +To record a test click on the record icon. This will create a `test-1.spec.ts` file as well as open up a browser window. + + +image + +### Selector Highlighting + +As you interact with the page Codegen will generate the test for you in the newly created file in VS Code. When you hover over an element Playwright will highlight the element and show the [selector](./selectors.md) underneath it. + +image -image ## What's next - [Write tests using web first assertions, page fixtures and locators](./writing-tests.md) -- [See a trace of your tests](./trace-viewer.md) \ No newline at end of file +- [See test reports](./running-tests.md#test-reports) +- [See a trace of your tests](./trace-viewer.md)