example.spec.js 543 B

1234567891011121314
  1. // example.spec.js
  2. import { test, expect } from '@playwright/test'
  3. import { env } from '../package.json'
  4. const VITE_SERVER_ADDRESS = `http://127.0.0.1:${env.PORT || 3344}`
  5. test('example test case', async ({ page }) => {
  6. await page.goto(VITE_SERVER_ADDRESS)
  7. // Expect a title "to contain" a substring.
  8. await expect(page).toHaveTitle(/Vite App/)
  9. // Expect an attribute "Hello Vue 3 + TypeScript + Vite" to be visible on the page.
  10. await expect(page.locator('text=Hello Vue 3 + TypeScript + Vite').first()).toBeVisible()
  11. })