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: articles/playwright-testing/quickstart-run-end-to-end-tests.md
+65-4Lines changed: 65 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,10 +70,12 @@ To get the service endpoint URL, perform the following steps:
70
70
71
71
1. In **Add region endpoint in your setup**, copy the region endpoint for your workspace.
72
72
73
-
The endpoint URL matches the Azure region that you selected when creating the workspace.
73
+
The endpoint URL matches the Azure region that you selected when creating the workspace. Make sure this URL is available in `PLAYWRIGHT_SERVICE_URL` environment variable.
74
74
75
75
:::image type="content" source="./media/quickstart-run-end-to-end-tests/playwright-testing-region-endpoint.png" alt-text="Screenshot that shows how to copy the workspace region endpoint in the Playwright Testing portal." lightbox="./media/quickstart-run-end-to-end-tests/playwright-testing-region-endpoint.png":::
76
76
77
+
::: zone pivot="playwright-test-runner"
78
+
77
79
## Set up your environment
78
80
79
81
To set up your environment, you have to configure the `PLAYWRIGHT_SERVICE_URL` environment variable with the value you obtained in the previous steps.
@@ -94,7 +96,26 @@ We recommend that you use the `dotenv` module to manage your environment. With `
94
96
95
97
Make sure to replace the `{MY-REGION-ENDPOINT}` text placeholder with the value you copied earlier.
96
98
99
+
::: zone-end
100
+
101
+
::: zone pivot="nunit-test-runner"
102
+
## Set up service configuration
103
+
104
+
Create a file `PlaywrightServiceSetup.cs`in the root directory with the following content.
105
+
106
+
```csharp
107
+
using Azure.Developer.MicrosoftPlaywrightTesting.NUnit;
108
+
109
+
namespace PlaywrightTests; // Remember to change this as per your project namespace
110
+
111
+
[SetUpFixture]
112
+
public class PlaywrightServiceSetup : PlaywrightServiceNUnit {};
113
+
```
97
114
115
+
> [!NOTE]
116
+
> Make sure your project uses `Microsoft.Playwright.NUnit` version 1.47 or above.
117
+
118
+
::: zone-end
98
119
## Set up Authentication
99
120
100
121
To run your Playwright tests in your Microsoft Playwright Testing workspace, you need to authenticate the Playwright client where you're running the tests with the service. This could be your local dev machine or CI machine.
@@ -124,7 +145,10 @@ You can generate an access token from your Playwright Testing workspace and use
124
145
> [!CAUTION]
125
146
> We strongly recommend using Microsoft Entra ID for authentication to the service. If you are using access tokens, see [How to Manage Access Tokens](./how-to-manage-access-tokens.md)
126
147
148
+
127
149
## Enable artifacts in Playwright configuration
150
+
::: zone pivot="playwright-test-runner"
151
+
128
152
In the `playwright.config.ts` file of your project, make sure you are collecting all the required artifacts.
129
153
```typescript
130
154
use: {
@@ -133,11 +157,23 @@ In the `playwright.config.ts` file of your project, make sure you are collecting
133
157
screenshot:'on'
134
158
}
135
159
```
136
-
## Run your tests at scale with Microsoft Playwright Testing
160
+
::: zone-end
161
+
162
+
::: zone pivot="nunit-test-runner"
163
+
164
+
Enable artifacts such as screenshot, videos and traces to be captured by Playwright.
165
+
- For screenshots, see [capture screenshots](https://playwright.dev/dotnet/docs/screenshots#introduction)
166
+
- For videos, see [record videos for your tests](https://playwright.dev/dotnet/docs/videos#introduction)
167
+
- For traces, see [recording a trace](https://playwright.dev/dotnet/docs/trace-viewer-intro#recording-a-trace)
168
+
::: zone-end
169
+
170
+
## Run your tests at scale and troubleshoot easily with Microsoft Playwright Testing
171
+
172
+
::: zone pivot="playwright-test-runner"
137
173
138
174
You've now prepared the configuration for running your Playwright tests in the cloud with Microsoft Playwright Testing. You can either use the Playwright CLI to run your tests, or use the [Playwright Test Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright).
139
175
140
-
### Run a single test at scale
176
+
### Run a single test with the service
141
177
142
178
With Microsoft Playwright Testing, you get charged based on the number of total test minutes and number of test results published. If you're a first-time user or [getting started with a free trial](./how-to-try-playwright-testing-free.md), you might start with running a single test at scale instead of your full test suite to avoid exhausting your free trial limits.
143
179
@@ -213,7 +249,7 @@ You can now run multiple tests with the service, or run your entire test suite o
213
249
> [!CAUTION]
214
250
> Depending on the size of your test suite, you might incur additional charges for the test minutes and test results beyond your allotted free test minutes and free test results.
215
251
216
-
### Run a full test suite at scale
252
+
### Run a full test suite with the service
217
253
218
254
Now that you've validated that you can run a single test with Microsoft Playwright Testing, you can run a full Playwright test suite at scale.
219
255
@@ -264,6 +300,31 @@ To run your Playwright test suite in Visual Studio Code with Microsoft Playwrigh
264
300
1. You can view all test results in the **Test results** tab.
265
301
266
302
---
303
+
::: zone-end
304
+
305
+
::: zone pivot="nunit-test-runner"
306
+
307
+
Run Playwright tests against browsers managed by the service and see the results in the unified portal using the configuration you created above.
308
+
309
+
```bash
310
+
dotnet test --logger "microsoft-playwright-testing"
311
+
```
312
+
After the test run completes, you can view the test status in the terminal..
313
+
314
+
```output
315
+
Starting test execution, please wait...
316
+
317
+
Initializing reporting for this test run. You can view the results at: https://playwright.microsoft.com/workspaces/<workspace-id>/runs/<run-id>
318
+
319
+
A total of 100 test files matched the specified pattern.
320
+
321
+
Test Report: https://playwright.microsoft.com/workspaces/<workspace-id>/runs/<run-id>
0 commit comments