Azure App Testing の Playwright ワークスペースが GA したので使ってみた

Azure App Testing の Playwright ワークスペースが GA したので使ってみた

2025.09.10

いわさです。

少し前ですが、Azure App Testing というサービスを紹介しました。

https://dev.classmethod.jp/articles/azure-app-testing/

このサービスは Microsoft Azure テストソリューションのハブになるサービスで、内容としては Azure Load Testing や Playwright を含むものです。
ただし、ブログ内でも紹介しているのですが Azure の Playwright マネージドサービスは、以前は Microsoft Playwright Testing というものが存在していましたが(現在も「クラシック」として存在している)、Playwright Workspaces という機能が新しく登場しまして、これが GA となりました。

https://azure.microsoft.com/en-us/updates?id=501953

使い方というか概念はほとんど同じなのですが、セットアップのダッシュボードがなかったりちょっと Playwight Testing とは手順が違っています。
今回軽く触ってみたので紹介します。

リソースの作成

リソースの作成自体は Azure App Testing から作成するだけです。

image.png

Playwight ワークスペースでは特別なセットアップ不要ですぐにブラウザエンドポイントなどが払い出されまして、そのまま使い始めることができます。
以前よりも楽になったかもしれない。

F4B71FF3-F025-46DE-960A-A332E3217A72.png

あとは Playwright 用のコードからエンドポイントを使うだけです。

テストコードを実行してみる

Playwright WorkSpaces 用のサンプルプロジェクトが提供されているので、こちらを使ってみます。

https://github.com/Azure/playwright-workspaces/tree/main/samples/playwright-tests

プロジェクト自体は git クローンしてnpm installするだけですぐ使い始めることができる状態です。
@azure/playwright@latestへの参照が含まれています。

			
			% git clone https://github.com/Azure/playwright-workspaces.git
Cloning into 'playwright-workspaces'...
remote: Enumerating objects: 295, done.
remote: Counting objects: 100% (207/207), done.
remote: Compressing objects: 100% (142/142), done.
remote: Total 295 (delta 101), reused 124 (delta 55), pack-reused 88 (from 1)
Receiving objects: 100% (295/295), 4.00 MiB | 19.15 MiB/s, done.
Resolving deltas: 100% (117/117), done.
% cd playwright-workspaces/samples/playwright-tests
% npm install

added 48 packages, and audited 49 packages in 1s

11 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
% 

		

Playwright Testing のころと同様にPLAYWRIGHT_SERVICE_URLに先程 Azure ポータルから取得したブラウザーエンドポイントを設定します。

			
			% export PLAYWRIGHT_SERVICE_URL="wss://eastus.api.playwright.microsoft.com/playwrightworkspaces/32188e43-572e-42c2-98a5-0f792a5c0472/browsers"

		

また、エンドポイントへの接続にあたって Azure の認証情報が必要になるのでaz loginしておきます。

			
			% az login
A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.

Retrieving tenants and subscriptions for the selection...

[Tenant and subscription selection]

No     Subscription name    Subscription ID                       Tenant
-----  -------------------  ------------------------------------  ---------
[1]    fuga subscription    1aec8e3d-2d54-45a0-b65a-cfbbc32b479c  既定のディレクトリ
[2] *  hoge subscription    a50aeedb-979c-428f-8b2d-28974d5e3d3b  既定のディレクトリ
[3]    piyo subscription    1ca32f02-1ac0-4f8e-83f5-0216720d3b5a  既定のディレクトリ

The default is marked with an *; the default tenant is '既定のディレクトリ' and subscription is 'hoge subscription' (a50aeedb-979c-428f-8b2d-28974d5e3d3b).

Select a subscription and tenant (Type a number or Enter for no changes): 

Tenant: 既定のディレクトリ
Subscription: hoge subscription (a50aeedb-979c-428f-8b2d-28974d5e3d3b)

[Announcements]
With the new Azure CLI login experience, you can select the subscription you want to use more easily. Learn more about it and its configuration at https://go.microsoft.com/fwlink/?linkid=2271236

If you encounter any problem, please open an issue at https://aka.ms/azclibug

[Warning] The login output has been updated. Please be aware that it no longer displays the full list of available subscriptions by default.

		

あとはテストを実行するだけです。
Running tests using Playwright workspacesが表示されていますね。Playwright WorkSpaces 上で実行されていることが確認できます。

			
			% npx playwright test --config=playwright.service.config.ts --workers=20

Running tests using Playwright workspaces.
Test run created successfully.

Running 6 tests using 6 workers
  6 passed (16.3s)

To open last HTML report run:

  npx playwright show-report

		

ローカルでは通常どおりレポートが確認できます。

FAA49B80-4909-4D2A-9534-119A62088AFF_1_105_c.jpeg

Azure ポータル上では何が確認できるでしょうか。
「実行するテスト」メニューを確認してみると、先程実行した履歴が確認できます。
レポートのとおり 6 件(セッション)のテストが実行されていたことが確認できました。

1878C476-AC17-4559-80F4-762EC9757D93.png

A0E7DC26-3C81-4B3B-9549-755EADF112D4.png

さいごに

本日は Azure App Testing の Playwright ワークスペースが GA したので使ってみました。

Playwright Testing と違ってダッシュボードがないので最初困惑しましたが、エンドポイントをクライアント側で使うという点は同じなので実際に使ってみると難しいことはありませんでした。

Playwright Testing はクラシックという扱いになり、今後は今回 GA した Playwright WorkSpaces の利用が推奨されているようなのでぜひ使ってみてください。

Share this article

FacebookHatena blogX

Related articles

Azure App Testing の Playwright ワークスペースが GA したので使ってみた | DevelopersIO