Skip to content

Instantly share code, notes, and snippets.

@hatappo
Created December 1, 2023 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hatappo/87e82dfe388136b5b824a55bbe8a5e36 to your computer and use it in GitHub Desktop.
Save hatappo/87e82dfe388136b5b824a55bbe8a5e36 to your computer and use it in GitHub Desktop.
ごく簡易な Playwright のテストシナリオのコード例
import { test, expect } from "@playwright/test";
test("検索ワード無しで検索した場合に急上昇ワードが表示される", async ({ page }) => {
// 1. Yahoo!Japan のサイトを開く。
await page.goto("https://www.yahoo.co.jp/");
// 2. 「検索」というラベルが付いた要素を探し出してきて、クリックする。
await page.getByRole("link", { name: "検索" }).click();
// 3. 「ウェブ検索の急上昇ワード」という見出しがページ上にあることを確認。
await expect(page.getByRole("heading", { name: "ウェブ検索の急上昇ワード" })).toBeVisible();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment