メインコンテンツへスキップ

All Posts

News bits

Playwright v1.49 - Aria Snapshots

Playwright v1.49 リリース。

https://playwright.dev/docs/release-notes#version-149

アクセシビリティツリーのスナップショットを取れる Aria Snapshot 機能が追加。 従来の DOM 構造のスナップショットに比べて、リファクタリング耐性が高い。

tsx
await expect(page.locator("body")).toMatchAriaSnapshot("...");

https://playwright.dev/docs/aria-snapshots

#New Chromium

新しいヘッドレス Chromium を選択できるようになった。

次のようにオプトインできる。

tsx
import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
  projects: [
    {
      name: "chromium",
      use: { ...devices["Desktop Chrome"], channel: "chromium" },
    },
  ],
});

これは Chrome が言及しているもので、本物の Chrome ブラウザを利用することが出来る。

https://developer.chrome.com/blog/chrome-headless-shell?hl=ja

Playwright では、この変更に伴いデフォルトで古いヘッドレス実装と新しいヘッドレス実装の両方がダウンロードされるようになったため、ダウンロードサイズが増加した。

https://github.com/microsoft/playwright/issues/33566

どちらを利用するかに合わせて次のようにオプションを渡すことで最適化できる。

shell
# after for headless-only tests
npx playwright install --only-shell

# after for new headless mode
npx playwright install --no-shell

著者について

Hi there. I'm hrdtbs, a frontend expert and technical consultant. I started my career in the creative industry over 13 years ago, learning on the job as a 3DCG modeler and game engineer in the indie scene.

In 2015 I began working as a freelance web designer and engineer. I handled everything from design and development to operation and advertising, delivering comprehensive solutions for various clients.

In 2016 I joined Wemotion as CTO, where I built the engineering team from the ground up and led the development of core web and mobile applications for three years.

In 2019 I joined matsuri technologies as a Frontend Expert, and in 2020 I also began serving as a technical manager supporting streamers and content creators.

I'm so grateful to be working in this field, doing something that brings me so much joy. Thanks for stopping by.