Functions
Playwright navigation test integration
Ecosystem pattern, not a Next.js API. Verify observable navigation and capture errors in a real browser. Source: https://nextjs.org/docs/app/guides/testing/playwright
Formal Syntax & Structure
nextjs syntaxnextjs
await page.goto(path); await expect(page).toHaveURL(...)Working Example
Example Snippetnextjs
import {test,expect} from '@playwright/test';test('catalog navigation',async({page})=>{ const errors:string[]=[];page.on('pageerror',e=>errors.push(e.message)); await page.goto('/'); await page.getByRole('link',{name:'Catalog'}).click(); await expect(page).toHaveURL(/\/catalog$/); await expect(page.getByRole('heading',{name:'Catalog'})).toBeVisible(); await page.reload(); await expect(page.getByRole('heading',{name:'Catalog'})).toBeVisible(); expect(errors).toEqual([]);});