Skip to content

Instantly share code, notes, and snippets.

@jukbot
Last active December 12, 2025 08:44
Show Gist options
  • Select an option

  • Save jukbot/20520bba303451cb96336573822374c0 to your computer and use it in GitHub Desktop.

Select an option

Save jukbot/20520bba303451cb96336573822374c0 to your computer and use it in GitHub Desktop.
playwright.config.ts for Nuxt 3
import { fileURLToPath } from 'node:url'
import { defineConfig, devices } from '@playwright/test'
import type { ConfigOptions } from '@nuxt/test-utils/playwright'
// For first setup !!
// Please run "npx playwright install" to install the browser
// Increase the timeout to 2 minutes (because Nuxt server is start so slow)
const timeout = 120000
const hostUrl = 'http://localhost:3001'
export default defineConfig<ConfigOptions>({
testDir: "./tests/e2e",
outputDir: 'tests-output',
snapshotDir: 'tests-output',
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
reporter: "html",
timeout,
use: {
nuxt: {
rootDir: fileURLToPath(new URL('.', import.meta.url)),
setupTimeout: timeout
},
actionTimeout: 0,
baseURL: hostUrl,
trace: "on-first-retry",
screenshot: 'on',
},
projects: [{
name: "chromium",
use: {
...devices["Desktop Chrome"],
viewport: { width: 1920, height: 1080 },
// Emulates the user locale.
locale: 'th-TH',
// Emulates the user timezone.
timezoneId: 'Asia/Bangkok',
}
}],
/* Run your local dev server before starting the tests */
webServer: {
command: "bun run dev",
port: 3001,
url: hostUrl,
reuseExistingServer: !process.env.CI,
ignoreHTTPSErrors: true,
stdout: 'ignore',
stderr: 'pipe',
timeout
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment