Blog Post

Apps on Azure Blog
3 MIN READ

Introducing Microsoft Playwright Testing service private preview

Vanshvsingh's avatar
Vanshvsingh
Icon for Microsoft rankMicrosoft
Aug 22, 2023

[Update Oct 4th, 2023] We are excited to announce that the Microsoft Playwright Testing service is now available in Preview! Explore the numerous features and enhancements by reading the announcement.

 

No more waitlists! You can dive straight in and start using the service directly here.

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

 

We are excited to introduce Microsoft Playwright Testing, a new service built for running Playwright tests easily at scale. Playwright is a fast-growing, open-source framework that enables reliable end-to-end testing and automation for modern web apps. Playwright Testing service uses the cloud to enable you to run Playwright tests with much higher parallelization across different operating system-browser combinations simultaneously. This means getting tests done faster, which can help speed up delivery of features without sacrificing quality. 

 

We are currently in private preview and need your feedback to help shape this service! To get started, join the waitlist. 

 

Get test suite results faster 

Automating end-to-end tests with Playwright helps ensure your web app works the way you expect it to across different web browsers or operating systems. Plus, adding it to your continuous integration (CI) workflow helps ensure those experiences remain great as that app evolves. However, as the app becomes more complex, the test suite required for comprehensive testing also increases in size. This results in longer test suite completion times, which can slow down your pace of feature delivery. Playwright Testing service gives you the ability to distribute your tests across many parallel browsers, leading to a quicker test suite completion.  

 

Test across multiple operating systems and browser combinations 

App complexity isn’t the only factor in increasing test suite size. Modern web apps need to work flawlessly across numerous browsers, operating systems, and devices. Testing across all these variables increases the amount of time it takes to run your test suite. With Playwright Testing service you’ll use the limitless scale of the cloud to run these tests simultaneously across all modern browsers on Windows and Linux and mobile emulation of Google Chrome for Android and Mobile Safari. This means you can have comprehensive test coverage without compromising how soon you want to ship. 

 

No test code changes required 

If you’re using Playwright today, getting started with Playwright Testing service is easy! The service is designed to seamlessly integrate with the Playwright test suite and requires no changes to existing test code. In just a few steps you can connect your test suite to Playwright Testing service and unlock the full potential of cloud-powered parallel testing. The service supports multiple versions of Playwright and updates with each new Playwright release. With Playwright Testing service you can focus on thorough application testing without worrying about the complexity of managing test infrastructure. 

  

Join the private preview and help shape the future of the service 

We invite teams interested in improving their end-to-end testing to join the private preview of Playwright Testing service. The service comes with no additional charge while it is in private preview. Your feedback and insights will be crucial in refining and enhancing this service. By participating in the private preview, you will have early access and direct contact with the product team to share your experience and help build a better product.  

 

You can join the waitlist for Microsoft Playwright Testing service here at https://aka.ms/mpt/signup. 

Updated Oct 02, 2023
Version 3.0
  • aliquarto's avatar
    aliquarto
    Copper Contributor

    Are there any plans to roll this out to UK South? Currently I can really use the trial because my organisation has restrictions on regions. 

  • woowwee's avatar
    woowwee
    Copper Contributor

    How to configure Playwright service for .NET?

    There are two ways: 

    if you are using Playwright Nunit you just need to specify to env variables:

    PLAYWRIGHT_SERVICE_ACCESS_TOKEN={MY-ACCESS-TOKEN}
    PLAYWRIGHT_SERVICE_URL={MY-REGION-ENDPOINT}

    to configure number of workers you can use runsettings file:

    <?xml version="1.0" encoding="utf-8"?>
    <RunSettings>
    	<!-- NUnit adapter -->
    	<NUnit>
    		<NumberOfTestWorkers>50</NumberOfTestWorkers>
    	</NUnit>
    	<!-- General run configuration -->
    	<RunConfiguration>
    		<EnvironmentVariables>
    			<!-- For debugging selectors, it's recommend to set the following environment variable -->
    			<!-- <DEBUG>pw:api</DEBUG> -->
    		</EnvironmentVariables>
    		<MaxCpuCount>0</MaxCpuCount>
    	</RunConfiguration>
    </RunSettings>
    

    if you are using Playwright Library you need to add the following code on browser initialization:

    private Tuple<string, BrowserTypeConnectOptions> PlaywrightServiceConfiguration()
            {
                var accessKey = Environment.GetEnvironmentVariable("PLAYWRIGHT_SERVICE_ACCESS_KEY");
                var serviceUrl = Environment.GetEnvironmentVariable("PLAYWRIGHT_SERVICE_URL");
                if (!accessKey.IsNullOrEmpty() && !serviceUrl.IsNullOrEmpty())
                {
                    var exposeNetwork = Environment.GetEnvironmentVariable("PLAYWRIGHT_SERVICE_EXPOSE_NETWORK") ?? "<loopback>";
                    var caps = new Dictionary<string, string>
                    {
                        ["os"] = Environment.GetEnvironmentVariable("PLAYWRIGHT_SERVICE_OS") ?? "linux",
                        ["runId"] = Environment.GetEnvironmentVariable("RELEASE_RELEASENAME") ?? DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture),
                    };
                    var wsEndpoint = $"{serviceUrl}?cap={JsonSerializer.Serialize(caps)}";
                    var connectOptions = new BrowserTypeConnectOptions
                    {
                        Timeout = 3 * 60 * 1000,
                        ExposeNetwork = exposeNetwork,
                        Headers = new Dictionary<string, string>
                        {
                            ["x-mpt-access-key"] = accessKey
                        }
                    };
                    return new Tuple<string, BrowserTypeConnectOptions>(wsEndpoint, connectOptions);
                }
                else
                {
                    return new Tuple<string, BrowserTypeConnectOptions>(null, null);
                }
            }

    and use it in 

                // service configuration
                Tuple<string, BrowserTypeConnectOptions> serviceConfig = PlaywrightServiceConfiguration();
                var browserTypeLaunchOptions = new BrowserTypeLaunchOptions()
                {
                    Headless = StartConfiguration.Headless,
                    Channel = StartConfiguration.Browser,
                    //Args = new[] { "--start-maximized" }
                    //SlowMo = 200
                };
    
    if (serviceConfig.Item1.IsNullOrEmpty() || serviceConfig.Item2 is null)
                    Browser = await BrowserType.LaunchAsync(browserTypeLaunchOptions).ConfigureAwait(false);
                else
                    Browser = await BrowserType.ConnectAsync(serviceConfig.Item1, serviceConfig.Item2).ConfigureAwait(false);
  • HI dinesh2703 I would like to understand more around "private browser", can you open an issue in our Github repo and we can look into it.

  • Does it work with browser in private mode?
    I tried in persistent mode, its working. but in private mode its not working. its giving time out error while loading test url. The url is http and not https.

  • Hi folks, Thanks for reaching out to us. 

    We have .NET support on our roadmap and will share an update soon. Currently the service supports running Playwright tests written in js/ts and using Playwright test runner. 

    We are tracking the feature requests on our GitHub repo: Issues · microsoft/playwright-testing-service (github.com)

    Please file an issue if you want us to build something or upvote an existing issue. This will help us prioritize our roadmap and get more feedback from the community. 

     

    Thanks 

  • davydantipov's avatar
    davydantipov
    Copper Contributor

    Hopefully we get a .NET version soon... Would make my Azure workflow much less painful...

  • aliquarto's avatar
    aliquarto
    Copper Contributor

    Does this service only work with typescript ? what about .net tests thanks