Skip to main content

Examples

Explore working examples in the GitHub repository.

Sample YAML Test

name: TodoMVC Tests
url: https://demo.playwright.dev/todomvc/

tests:
  - name: Add todo item
    steps:
      - Navigate to the TodoMVC home page
      - Add a new todo item "Buy groceries"
      - Verify "Buy groceries" appears in the list

Sample Feature File

Feature: TodoMVC

  Scenario: Add todo item
    Given I navigate to "https://demo.playwright.dev/todomvc/"
    When I add a new todo item "Buy groceries"
    Then I should see "Buy groceries" in the todo list

Sample Playwright Test

import { test } from "@playwright/test";
import { runAgent } from "openqa";

test("Add todo", async ({ context }) => {
  await runAgent('Navigate to "https://demo.playwright.dev/todomvc/"', context);
  await runAgent('Add a new todo item "Buy groceries"', context);
  await runAgent('Verify "Buy groceries" appears in the list', context);
});