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-automate-end-to-end-testing.md
+47-47Lines changed: 47 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ After you complete this quickstart, you have a CI workflow that runs your Playwr
21
21
22
22
* An Azure account with an active subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
23
23
24
-
* A Microsoft Playwright Testing workspace. Complete the [quickstart: run Playwright tests at scale](./quickstart-run-end-to-end-tests.md)to create a workspace.
24
+
* A Microsoft Playwright Testing workspace. Complete the [quickstart: run Playwright tests at scale](./quickstart-run-end-to-end-tests.md)and create a workspace.
25
25
26
26
# [GitHub Actions](#tab/github)
27
27
- A GitHub account. If you don't have a GitHub account, you can [create one for free](https://github.com/).
@@ -62,7 +62,7 @@ To get the service endpoint URL and store it as a CI workflow secret, perform th
62
62
::: zone pivot="playwright-test-runner"
63
63
## Add service configuration file
64
64
65
-
If you haven't configured your Playwright tests yet for running them with service, add a service configuration file to your repository. In the next step, you then specify this service configuration file on the Playwright CLI.
65
+
If you don't have Playwright tests configured to run with the service, add a service configuration file to your repository. In the next step, you then specify this service configuration file on the Playwright CLI.
66
66
67
67
1. Create a new file `playwright.service.config.ts` alongside the `playwright.config.ts` file.
68
68
@@ -92,7 +92,7 @@ Update the `package.json` file in your repository to add details about Microsoft
92
92
93
93
## Enable artifacts in Playwright configuration
94
94
95
-
In the `playwright.config.ts` file of your project, make sure you are collecting all the required artifacts.
95
+
In the `playwright.config.ts` file of your project, make sure you're collecting all the required artifacts.
96
96
```typescript
97
97
use: {
98
98
trace: 'on-first-retry',
@@ -120,7 +120,7 @@ In your project, install Microsoft Playwright Testing package.
This updates your project's `csproj` file by adding the service package details to the `ItemGroup` section. Remember to commit these changes.
123
+
This command updates your project's `csproj` file by adding the service package details to the `ItemGroup` section. Remember to commit these changes.
124
124
125
125
```xml
126
126
<ItemGroup>
@@ -150,85 +150,85 @@ If you haven't configured your Playwright tests yet for running them with servic
150
150
151
151
## Enable artifacts in your Playwright setup
152
152
153
-
Enable artifacts such as screenshot, videos and traces to be captured by Playwright.
153
+
Set up Playwright to capture artifacts such as screenshot, videos and traces.
154
154
- For screenshots, see [capture screenshots](https://playwright.dev/dotnet/docs/screenshots#introduction)
155
155
- For videos, see [record videos for your tests](https://playwright.dev/dotnet/docs/videos#introduction)
156
156
- For traces, see [recording a trace](https://playwright.dev/dotnet/docs/trace-viewer-intro#recording-a-trace)
157
157
158
-
Once you collect these artifacts, attach them to the `TestContext` to ensure they are available in your test reports. For more information, see our [sample project for NUnit](https://aka.ms/mpt/nunit-sample)
158
+
Once you collect these artifacts, attach them to the `TestContext` to ensure they're available in your test reports. For more information, see our [sample project for NUnit](https://aka.ms/mpt/nunit-sample)
159
159
::: zone-end
160
160
161
161
## Set up authentication
162
162
163
-
The CI machine running Playwright tests needs to authenticate with Playwright Testing service to get the browsers to run the tests and to publish the test results and arifacts back to the service.
163
+
The CI machine running Playwright tests needs to authenticate with Playwright Testing service to get the browsers to run the tests and to publish the test results and artifacts back to the service.
164
164
165
165
The service offers two authentication methods: Microsoft Entra ID and Access Tokens. We strongly recommend using Microsoft Entra ID to authenticate your pipelines.
166
166
167
167
#### Set up authentication using Microsoft Entra ID
168
168
169
-
# [GitHub Actions](#tab/github)
169
+
# [GitHub Actions](#tab/github)
170
170
171
-
If you are using GitHub Actions, you can connect to the service using GitHub OpenID Connect. Follow the steps below to set up the integration:
171
+
If you are using GitHub Actions, you can connect to the service using GitHub OpenID Connect. Follow the steps to set up the integration:
172
172
173
-
##### Prerequisites
173
+
##### Prerequisites
174
174
175
-
**Option 1: Microsoft Entra application**
175
+
**Option 1: Microsoft Entra application**
176
176
177
-
* Create a Microsoft Entra application with a service principal by [Azure portal](/entra/identity-platform/howto-create-service-principal-portal#register-an-application-with-microsoft-entra-id-and-create-a-service-principal), [Azure CLI](/cli/azure/azure-cli-sp-tutorial-1#create-a-service-principal), or [Azure PowerShell](/powershell/azure/create-azure-service-principal-azureps#create-a-service-principal).
177
+
* Create a Microsoft Entra application with a service principal by [Azure portal](/entra/identity-platform/howto-create-service-principal-portal#register-an-application-with-microsoft-entra-id-and-create-a-service-principal), [Azure CLI](/cli/azure/azure-cli-sp-tutorial-1#create-a-service-principal), or [Azure PowerShell](/powershell/azure/create-azure-service-principal-azureps#create-a-service-principal).
178
178
179
-
* Copy the values for **Client ID**, **Subscription ID**, and **Directory (tenant) ID** to use later in your GitHub Actions workflow.
180
-
181
-
* Assign the `Owner` or `Contributor` role to the service principal created in the previous step. These roles must be assigned on the Playwright Testing workspace. For more details, refer to [How to manage access](./how-to-manage-access-tokens.md).
182
-
183
-
*[Configure a federated identity credential on a Microsoft Entra application](/entra/workload-id/workload-identity-federation-create-trust) to trust tokens issued by GitHub Actions to your GitHub repository.
179
+
* Copy the values for **Client ID**, **Subscription ID**, and **Directory (tenant) ID** to use later in your GitHub Actions workflow.
184
180
185
-
**Option 2: User-assigned managed identity**
181
+
* Assign the `Owner` or `Contributor` role to the service principal created in the previous step. These roles must be assigned on the Playwright Testing workspace. For more details, see [how to manage access](./how-to-manage-access-tokens.md).
186
182
187
-
*[Create a user-assigned managed identity](/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities#create-a-user-assigned-managed-identity).
183
+
*[Configure a federated identity credential on a Microsoft Entra application](/entra/workload-id/workload-identity-federation-create-trust) to trust tokens issued by GitHub Actions to your GitHub repository.
188
184
189
-
* Copy the values for **Client ID**, **Subscription ID**, and **Directory (tenant) ID** to use later in your GitHub Actions workflow.
190
-
191
-
* Assign the `Owner` or `Contributor` role to the user-assigned managed identity created in the previous step. These roles must be assigned on the Playwright Testing workspace. For more details, refer to [How to manage access](./how-to-manage-access-tokens.md).
192
-
193
-
*[Configure a federated identity credential on a user-assigned managed identity](/entra/workload-id/workload-identity-federation-create-trust-user-assigned-managed-identity) to trust tokens issued by GitHub Actions to your GitHub repository.
185
+
**Option 2: User-assigned managed identity**
194
186
195
-
##### Create GitHub secrets
187
+
*[Create a user-assigned managed identity](/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities#create-a-user-assigned-managed-identity).
196
188
197
-
1. Add the values you got in the previous step as secrets to your GitHub repository. See [set up GitHub Action Secret](/azure/developer/github/connect-from-azure-openid-connect?branch=main#create-github-secrets). These variables will be used in the GitHub Action workflow in subsequest steps.
189
+
* Copy the values for **Client ID**, **Subscription ID**, and **Directory (tenant) ID** to use later in your GitHub Actions workflow.
* Assign the `Owner` or `Contributor` role to the user-assigned managed identity created in the previous step. These roles must be assigned on the Playwright Testing workspace. For more details, see [how to manage access](./how-to-manage-access-tokens.md).
204
192
205
-
> **Note:**
206
-
> For enhanced security, it is strongly recommended to use GitHub Secrets to store sensitive values rather than including them directly in your workflow file.
193
+
*[Configure a federated identity credential on a user-assigned managed identity](/entra/workload-id/workload-identity-federation-create-trust-user-assigned-managed-identity) to trust tokens issued by GitHub Actions to your GitHub repository.
207
194
208
-
# [Azure Pipelines](#tab/pipelines)
195
+
##### Create GitHub secrets
209
196
210
-
If you are using Azure Pipelines, you can connect to the service using Service Connections. Follow the steps below to set up the integration:
197
+
1. Add the values you got in the previous step as secrets to your GitHub repository. See [set up GitHub Action Secret](/azure/developer/github/connect-from-azure-openid-connect?branch=main#create-github-secrets). These variables are used in the GitHub Action workflow in subsequent steps.
211
198
212
-
1.[Create an app registration with workload identity federation](/azure/devops/pipelines/library/connect-to-azure?view=azure-devops#create-an-app-registration-with-workload-identity-federation-automatic). Select the subscription and resource group associated with your Playwright Testing workspace. Typically, the resource group has the same name as the Playwright Testing workspace.
2. Use this service connection in Azure Pipeline yaml file as shown in subsequent steps.
205
+
> **Note:**
206
+
> For enhanced security, it is strongly recommended to use GitHub Secrets to store sensitive values rather than including them directly in your workflow file.
215
207
216
-
#### Set up authentication using access tokens
208
+
# [Azure Pipelines](#tab/pipelines)
217
209
218
-
> [!CAUTION]
219
-
> 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)
210
+
If you're using Azure Pipelines, you can connect to the service using Service Connections. Follow the steps to set up the integration:
220
211
221
-
You can generate an access token from your Playwright Testing workspace and use it in your setup. However, we strongly recommend Microsoft Entra ID for authentication due to its enhanced security. Access tokens, while convenient, function like long-lived passwords and are more susceptible to being compromised.
212
+
1.[Create an app registration with workload identity federation](https://learn.microsoft.com//azure/devops/pipelines/library/connect-to-azure#create-an-app-registration-with-workload-identity-federation-automatic). Select the subscription and resource group associated with your Playwright Testing workspace. Typically, the resource group has the same name as the Playwright Testing workspace.
222
213
223
-
1. Authentication using access tokens is disabled by default. To use, [Enable access-token based authentication](./how-to-manage-authentication.md#enable-authentication-using-access-tokens)
214
+
2. Use this service connection in Azure Pipeline yaml file as shown in subsequent steps.
224
215
225
-
2.[Set up authentication using access tokens](./how-to-manage-authentication.md#set-up-authentication-using-access-tokens)
216
+
#### Set up authentication using access tokens
226
217
227
-
3. Store the access token in a CI workflow secret and use it in the GitHub Actions workflow or Azure Pipeline yaml file.
218
+
> [!CAUTION]
219
+
> We strongly recommend using Microsoft Entra ID for authentication to the service. If you're using access tokens, see [How to Manage Access Tokens](./how-to-manage-access-tokens.md)
228
220
229
-
| Secret name | Value |
230
-
| ----------- | ------------ |
231
-
|*PLAYWRIGHT_SERVICE_ACCESS_TOKEN*| Paste the value of Access Token you created previously. |
221
+
You can generate an access token from your Playwright Testing workspace and use it in your setup. However, we strongly recommend Microsoft Entra ID for authentication due to its enhanced security. Access tokens, while convenient, function like long-lived passwords and are more susceptible to being compromised.
222
+
223
+
1. Authentication using access tokens is disabled by default. To use, [Enable access-token based authentication](./how-to-manage-authentication.md#enable-authentication-using-access-tokens)
224
+
225
+
2.[Set up authentication using access tokens](./how-to-manage-authentication.md#set-up-authentication-using-access-tokens)
226
+
227
+
3. Store the access token in a CI workflow secret and use it in the GitHub Actions workflow or Azure Pipeline yaml file.
228
+
229
+
| Secret name | Value |
230
+
| ----------- | ------------ |
231
+
|*PLAYWRIGHT_SERVICE_ACCESS_TOKEN*| Paste the value of Access Token you created previously. |
0 commit comments