Skip to content

Commit c620be9

Browse files
authored
Merge pull request #257580 from ntrogh/mpt-first-time-use
[Microsoft Playwright Testing] Add guidance for first time users to limit test minute usage
2 parents 4c7489f + 62db56c commit c620be9

9 files changed

+114
-25
lines changed

articles/playwright-testing/how-to-try-playwright-testing-free.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ The following table lists the limits for the Microsoft Playwright Testing free t
2626
|-|-|
2727
| Duration of trial | 30 days |
2828
| Total test minutes¹ | 100 minutes |
29-
| Number of workspaces¹²³ | 1 |
29+
| Number of workspaces²³ | 1 |
3030

3131
¹ If you run a test that exceeds the free trial test minute limit, only the overage test minutes account towards the pay-as-you-go billing model.
3232

3333
² These limits only apply to the *first* workspace you create in your Azure subscription. Any subsequent workspaces you create in the subscription automatically uses the pay-as-you-go billing model.
3434

3535
³ If you delete the free trial workspace, you can't create a new free trial workspace anymore.
3636

37-
If you exceed any of these limits, the workspace is automatically converted to the pay-as-you-go billing model. Learn more about the [Microsoft Playwright Testing pricing](https://aka.ms/mpt/pricing).
37+
> [!CAUTION]
38+
> If you exceed any of these limits, the workspace is automatically converted to the pay-as-you-go billing model. Learn more about the [Microsoft Playwright Testing pricing](https://aka.ms/mpt/pricing).
3839
3940
## Create a workspace
4041

@@ -56,7 +57,7 @@ To create a workspace in the Playwright portal:
5657
|---------|---------|
5758
|**Workspace name** | Enter a unique name to identify your workspace.<BR>The name can only consist of alphanumerical characters, and have a length between 3 and 64 characters. |
5859
|**Azure subscription** | Select the Azure subscription that you want to use for this Microsoft Playwright Testing workspace. |
59-
|**Region** | Select a geographic location to host your workspace. <BR>This is the location where the test run data is stored for the workspace. |
60+
|**Region** | Select a geographic location to host your workspace. <BR>This location is where the test run data is stored for the workspace. |
6061

6162
1. Select **Create workspace**.
6263

-74.7 KB
Loading
Loading
163 KB
Loading
129 KB
Loading
-59.6 KB
Loading
143 KB
Loading

articles/playwright-testing/quickstart-automate-end-to-end-testing.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,15 @@ Update the CI workflow definition to run your Playwright tests with the Playwrig
218218

219219
When the CI workflow is triggered, your Playwright tests will run in your Microsoft Playwright Testing workspace on cloud-hosted browsers, across 20 parallel workers.
220220

221+
> [!CAUTION]
222+
> With Microsoft Playwright Testing, you get charged based on the number of total test minutes. 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 test minutes.
223+
>
224+
> After you validate that the test runs successfully, you can gradually increase the test load by running more tests with the service.
225+
>
226+
> You can run a single test with the service by using the following command-line:
227+
>
228+
> ```npx playwright test {name-of-file.spec.ts} --config=playwright.service.config.ts```
229+
221230
## Related content
222231

223232
You've successfully set up a continuous end-to-end testing workflow to run your Playwright tests at scale on cloud-hosted browsers.

articles/playwright-testing/quickstart-run-end-to-end-tests.md

Lines changed: 101 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ We recommend that you use the `dotenv` module to manage your environment. With `
8181
> [!CAUTION]
8282
> Make sure that you don't add the `.env` file to your source code repository to avoid leaking your access token value.
8383
84-
## Add Microsoft Playwright Testing configuration
84+
## Add a service configuration file
8585
8686
To run your Playwright tests in your Microsoft Playwright Testing workspace, you need to add a service configuration file alongside your Playwright configuration file. The service configuration file references the environment variables to get the workspace endpoint and your access token.
8787
@@ -112,7 +112,7 @@ To add the service configuration to your project:
112112
// },
113113
workers: 20,
114114

115-
// Enable screenshot testing and configure directory with expectations.
115+
// Enable screenshot testing and configure directory with expectations.
116116
// https://learn.microsoft.com/azure/playwright-testing/how-to-configure-visual-comparisons
117117
ignoreSnapshots: false,
118118
snapshotPathTemplate: `{testDir}/__screenshots__/{testFilePath}/${os}/{arg}{ext}`,
@@ -142,60 +142,135 @@ To add the service configuration to your project:
142142
143143
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).
144144
145-
Perform the following steps to run your Playwright tests with Microsoft Playwright Testing.
145+
### Run a single test at scale
146+
147+
With Microsoft Playwright Testing, you get charged based on the number of total test minutes. 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 test minutes.
148+
149+
After you validate that the test runs successfully, you can gradually increase the test load by running more tests with the service.
150+
151+
Perform the following steps to run a single Playwright test with Microsoft Playwright Testing:
146152
147153
# [Playwright CLI](#tab/playwrightcli)
148154
149-
When you use the Playwright CLI to run your tests, specify the service configuration file in the command-line to connect to use remote browsers.
155+
To use the Playwright CLI to run your tests with Microsoft Playwright Testing, pass the service configuration file as a command-line parameter.
150156
151-
Open a terminal window and enter the following command to run your Playwright tests on remote browsers in your workspace:
157+
1. Open a terminal window.
152158
153-
```bash
154-
npx playwright test --config=playwright.service.config.ts --workers=20
155-
```
156-
157-
Depending on the size of your test suite, this command runs your tests on up to 20 parallel workers.
159+
1. Enter the following command to run your Playwright test on remote browsers in your workspace:
158160
159-
You should see a similar output when the tests complete:
161+
Replace the `{name-of-file.spec.ts}` text placeholder with the name of your test specification file.
160162
161-
```output
162-
Running 6 tests using 6 workers
163-
6 passed (18.2s)
163+
```bash
164+
npx playwright test {name-of-file.spec.ts} --config=playwright.service.config.ts
165+
```
164166
165-
To open last HTML report run:
167+
After the test completes, you can view the test status in the terminal.
166168
169+
```output
170+
Running 1 test using 1 worker
171+
1 passed (2.2s)
172+
173+
To open last HTML report run:
174+
167175
npx playwright show-report
168-
```
176+
```
169177
170178
# [Visual Studio Code](#tab/vscode)
171179
172-
To run your Playwrights tests in Visual Studio Code with Microsoft Playwright Testing:
180+
To run a single Playwright test in Visual Studio Code with Microsoft Playwright Testing, select the service configuration file in the **Test Explorer** view. Then select and run the test from the list of tests.
173181
174182
1. Install the [Playwright Test Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright).
175183
176184
1. Open the **Test Explorer** view in the activity bar.
177185
178-
The test explorer automatically detects your Playwright tests and the service configuration.
186+
The test explorer automatically detects your Playwright tests and the service configuration in your project.
179187
180188
:::image type="content" source="./media/quickstart-run-end-to-end-tests/visual-studio-code-test-explorer.png" alt-text="Screenshot that shows the Test Explorer view in Visual Studio Code, which lists the Playwright tests." lightbox="./media/quickstart-run-end-to-end-tests/visual-studio-code-test-explorer.png":::
181189
182-
1. Select a service profile to run your tests with Microsoft Playwright Testing.
190+
1. Select **Select Default Profile**, and then select your default projects from the service configuration file.
183191
184192
Notice that the service run profiles are coming from the `playwright.service.config.ts` file you added previously.
185193
186-
Optionally, select **Select Default Profile**, and then select your default projects. By setting a default profile, you can automatically run your services with the service, or run multiple Playwright projects simultaneously.
194+
By setting a default profile, you can automatically run your tests with the service, or run multiple Playwright projects simultaneously.
187195
188196
:::image type="content" source="./media/quickstart-run-end-to-end-tests/visual-studio-code-choose-run-profile.png" alt-text="Screenshot that shows the menu to choose a run profile for your tests, highlighting the projects from the service configuration file." lightbox="./media/quickstart-run-end-to-end-tests/visual-studio-code-choose-run-profile.png":::
189197
198+
1. From the list of tests, select the **Run test** button next to a test to run it.
199+
200+
The test runs on the projects you selected in the default profile. If you selected one or more projects from the service configuration, the test runs on remote browsers in your workspace.
201+
202+
:::image type="content" source="./media/quickstart-run-end-to-end-tests/visual-studio-code-run-test.png" alt-text="Screenshot that shows how to run a single test in Visual Studio Code." lightbox="./media/quickstart-run-end-to-end-tests/visual-studio-code-run-test.png":::
203+
190204
> [!TIP]
191-
> You can still debug your test code when you run your tests on remote browsers.
205+
> You can still debug your test code when you run your tests on remote browsers by using the **Debug test** button.
192206
193207
1. You can view the test results directly in Visual Studio Code.
194208
195209
:::image type="content" source="./media/quickstart-run-end-to-end-tests/visual-studio-code-test-results.png" alt-text="Screenshot that shows the Playwright test results in Visual Studio Code." lightbox="./media/quickstart-run-end-to-end-tests/visual-studio-code-test-results.png":::
196210
197211
---
198212
213+
You can now run multiple tests with the service, or run your entire test suite on remote browsers.
214+
215+
> [!CAUTION]
216+
> Depending on the size of your test suite, you might incur additional charges for the test minutes beyond your allotted free test minutes.
217+
218+
### Run a full test suite at scale
219+
220+
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.
221+
222+
Perform the following steps to run a full Playwright test suite with Microsoft Playwright Testing:
223+
224+
# [Playwright CLI](#tab/playwrightcli)
225+
226+
When you run multiple Playwright tests or a full test suite with Microsoft Playwright Testing, you can optionally specify the number of parallel workers as a command-line parameter.
227+
228+
1. Open a terminal window.
229+
230+
1. Enter the following command to run your Playwright test suite on remote browsers in your workspace:
231+
232+
```bash
233+
npx playwright test --config=playwright.service.config.ts --workers=20
234+
```
235+
236+
Depending on the size of your test suite, this command runs your tests on up to 20 parallel workers.
237+
238+
After the test completes, you can view the test status in the terminal.
239+
240+
```output
241+
Running 6 tests using 6 workers
242+
6 passed (18.2s)
243+
244+
To open last HTML report run:
245+
246+
npx playwright show-report
247+
```
248+
249+
# [Visual Studio Code](#tab/vscode)
250+
251+
To run your Playwright test suite in Visual Studio Code with Microsoft Playwright Testing:
252+
253+
1. Open the **Test Explorer** view in the activity bar.
254+
255+
1. Select the **Run tests** button to run all tests with Microsoft Playwright Testing.
256+
257+
When you run all tests, the default profile is used. In the previous step, you configured the default profile to use projects from the service configuration.
258+
259+
:::image type="content" source="./media/quickstart-run-end-to-end-tests/visual-studio-code-run-all-tests.png" alt-text="Screenshot that shows how to run all tests in Visual Studio Code." lightbox="./media/quickstart-run-end-to-end-tests/visual-studio-code-run-all-tests.png":::
260+
261+
> [!TIP]
262+
> You can still debug your test code when you run your tests on remote browsers by using the **Debug tests** button.
263+
264+
1. Alternately, you can select a specific service configuration from the list to only run the tests for a specific browser configuration.
265+
266+
:::image type="content" source="./media/quickstart-run-end-to-end-tests/visual-studio-code-run-all-tests-select-project.png" alt-text="Screenshot that shows how to run all tests for a specific browser configuration, by selecting the project in Visual Studio Code." lightbox="./media/quickstart-run-end-to-end-tests/visual-studio-code-run-all-tests-select-project.png":::
267+
268+
1. You can view all test results in the **Test results** tab.
269+
270+
---
271+
272+
## View test runs in the Playwright portal
273+
199274
Go to the [Playwright portal](https://aka.ms/mpt/portal) to view the test run metadata and activity log for your workspace.
200275
201276
:::image type="content" source="./media/quickstart-run-end-to-end-tests/playwright-testing-activity-log.png" alt-text="Screenshot that shows the activity log for a workspace in the Playwright Testing portal." lightbox="./media/quickstart-run-end-to-end-tests/playwright-testing-activity-log.png":::
@@ -204,7 +279,11 @@ The activity log lists for each test run the following details: the total test c
204279
205280
## Optimize parallel worker configuration
206281
207-
Once your tests are running smoothly with the service, experiment with varying the number of parallel workers to determine the optimal configuration that minimizes test completion time. With Microsoft Playwright Testing, you can run with up to 50 parallel workers. Several factors influence the best configuration for your project, such as the CPU, memory, and network resources of your client machine, the target application's load-handling capacity, and the type of actions carried out in your tests.
282+
Once your tests are running smoothly with the service, experiment with varying the number of parallel workers to determine the optimal configuration that minimizes test completion time.
283+
284+
With Microsoft Playwright Testing, you can run with up to 50 parallel workers. Several factors influence the best configuration for your project, such as the CPU, memory, and network resources of your client machine, the target application's load-handling capacity, and the type of actions carried out in your tests.
285+
286+
You can specify the number of parallel workers on the Playwright CLI command-line, or configure the `workers` property in the Playwright service configuration file.
208287
209288
Learn more about how to [determine the optimal configuration for optimizing test suite completion](./concept-determine-optimal-configuration.md).
210289

0 commit comments

Comments
 (0)