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/how-to-test-local-applications.md
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,14 @@
1
1
---
2
-
title: Use remote browsers for local applications
2
+
title: Use remote browsers for local or private applications
3
3
description: Learn how to run end-to-end for locally deployed applications with Microsoft Playwright Testing Preview. Use cloud-hosted browsers to test apps on localhost or private networks.
# Use cloud-hosted browsers for locally deployed apps with Microsoft Playwright Testing Preview
11
+
# Use cloud-hosted browsers for locally deployed or privately hosted apps with Microsoft Playwright Testing Preview
10
12
11
13
Learn how to use Microsoft Playwright Testing Preview to run end-to-end tests for locally deployed applications. Microsoft Playwright Testing uses cloud-hosted, remote browsers for running Playwright tests at scale. You can use the service to run tests for apps on localhost, or that you host on your infrastructure.
12
14
@@ -21,7 +23,9 @@ To expose local networks and resources to remote browsers, you can use the `expo
21
23
22
24
You can specify one or multiple networks by using a list of rules. For example, to expose test/staging deployments and [localhost](https://en.wikipedia.org/wiki/Localhost): `*.test.internal-domain,*.staging.internal-domain,<loopback>`.
23
25
24
-
You can configure the `exposeNetwork` option in `playwright.service.config.ts`. The following example shows how to expose the `localhost` network by using the [`<loopback>`](https://en.wikipedia.org/wiki/Loopback) rule:
26
+
::: zone pivot="playwright-test-runner"
27
+
28
+
You can configure the `exposeNetwork` option in `playwright.service.config.ts`. The following example shows how to expose the `localhost` network by using the [`<loopback>`](https://en.wikipedia.org/wiki/Loopback) rule. You can also replace `localhost` with a domain that you want to enable for the service.
@@ -43,6 +47,27 @@ You can now reference `localhost` in the Playwright test code, and run the tests
43
47
```bash
44
48
npx playwright test --config=playwright.service.config.ts --workers=20
45
49
```
50
+
::: zone-end
51
+
52
+
53
+
::: zone pivot="nunit-test-runner"
54
+
55
+
You can configure the `ExposeNetwork` option in `.runsettings`. The following example shows how to expose the `localhost` network by using the [`<loopback>`](https://en.wikipedia.org/wiki/Loopback) rule. You can also replace `localhost` with a domain that you want to enable for the service.
56
+
57
+
```xml
58
+
<TestRunParameters>
59
+
<!--Use this option to connect to local resources from your Playwright test code without having to configure additional firewall-->
60
+
<Parametername="ExposeNetwork"value="loopback" />
61
+
</TestRunParameters>
62
+
```
63
+
64
+
You can now reference `localhost` in the Playwright test code, and run the tests on cloud-hosted browsers with Microsoft Playwright Testing:
65
+
66
+
```bash
67
+
dotnet test --settings:.runsettings --logger "microsoft-playwright-testing" -- NUnit.NumberOfTestWorkers=20
# Use options available in configuration file with Microsoft Playwright Testing preview
10
+
11
+
# Use options available in service package with Microsoft Playwright Testing preview
12
+
13
+
::: zone pivot="playwright-test-runner"
9
14
10
15
This article shows you how to use the options available in the `playwright.service.config.ts` file that was generated for you.
11
-
If you don't have this file in your code, follow the QuickStart guide, see [Quickstart: Run end-to-end tests at scale with Microsoft Playwright Testing Preview](./quickstart-run-end-to-end-tests.md)
16
+
If you don't have this file in your code, follow [Quickstart: Run end-to-end tests at scale with Microsoft Playwright Testing Preview](./quickstart-run-end-to-end-tests.md)
17
+
18
+
::: zone-end
19
+
20
+
::: zone pivot="nunit-test-runner"
21
+
22
+
This article shows you how to use the options available in the `.runsettings` file.
23
+
If you don't have this file in your code, follow [Quickstart: Run end-to-end tests at scale with Microsoft Playwright Testing Preview](./quickstart-run-end-to-end-tests.md)
24
+
25
+
::: zone-end
12
26
13
27
> [!IMPORTANT]
14
28
> Microsoft Playwright Testing is currently in preview. For legal terms that apply to Azure features that are in beta, in preview, or otherwise not yet released into general availability, see the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
@@ -17,6 +31,8 @@ If you don't have this file in your code, follow the QuickStart guide, see [Quic
17
31
18
32
* Follow the Quickstart guide and set up a project to run with Microsoft Playwright Testing service. See, [Quickstart: Run end-to-end tests at scale with Microsoft Playwright Testing Preview](./quickstart-run-end-to-end-tests.md)
19
33
34
+
::: zone pivot="playwright-test-runner"
35
+
20
36
Here's version of the `playwright.service.config.ts` file with all the available options:
-`AccessToken`touseaccesstokens. Youneedtoenableauthenticationusingaccesstokensifyouwanttousethisoption, see [manageauthentication](./how-to-manage-authentication.md).
221
+
-`EntraId`touseMicrosoftEntraIDforauthentication. It's the default mode.
-**Description**: ThissettingallowsyoutosetauniqueIDforeverytestruntodistinguishthemintheserviceportal. UsingthesamerunIdformultipletestrunsresultsinerror. Ifyoudon't set it, the service package will generate a unique ID every time you trigger a test run. For sharding, keep this same across all shards.
-**Description**: ThissettingallowsyoutoconnecttolocalresourcesfromyourPlaywrighttestcodewithouthavingtoconfigureanotherfirewallsettings. Tolearnmore, see [howtotestlocalapplications](./how-to-test-local-applications.md)
0 commit comments