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.

Revisions

  1. jukbot revised this gist Jun 29, 2024. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions playwright.config.ts
    Original file line number Diff line number Diff line change
    @@ -24,6 +24,7 @@ export default defineConfig<ConfigOptions>({
    timeout,
    use: {
    nuxt: {
    buildDir: '.output',
    rootDir: fileURLToPath(new URL('.', import.meta.url)),
    setupTimeout: timeout,
    },
  2. jukbot revised this gist Jun 28, 2024. 1 changed file with 24 additions and 12 deletions.
    36 changes: 24 additions & 12 deletions playwright.config.ts
    Original file line number Diff line number Diff line change
    @@ -3,50 +3,62 @@ 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
    // 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://0.0.0.0:3001'

    export default defineConfig<ConfigOptions>({
    testDir: "./tests/e2e",
    testDir: './tests/e2e',
    outputDir: 'tests-output',
    snapshotDir: 'tests-output',
    snapshotDir: 'tests-screenshot',
    fullyParallel: true,
    /* Fail the build on CI if you accidentally left test.only in the source code. */
    forbidOnly: !!process.env.CI,
    reporter: "html",
    /* Retry on CI only */
    retries: process.env.CI ? 2 : 0,
    /* Opt out of parallel tests on CI. */
    workers: process.env.CI ? 1 : undefined,
    reporter: process.env.CI ? 'dot' : 'html',
    timeout,
    use: {
    nuxt: {
    rootDir: fileURLToPath(new URL('.', import.meta.url)),
    setupTimeout: timeout
    setupTimeout: timeout,
    },
    actionTimeout: 0,
    baseURL: hostUrl,
    trace: "on-first-retry",
    trace: 'on-first-retry',
    screenshot: 'on',
    },
    projects: [{
    name: "chromium",
    name: 'chromium',
    use: {
    ...devices["Desktop Chrome"],
    ...devices['Desktop Chrome'],
    viewport: { width: 1920, height: 1080 },
    // Emulates the user locale.
    locale: 'th-TH',
    // Emulates the user timezone.
    timezoneId: 'Asia/Bangkok',
    }
    }],
    },
    dependencies: ['setup db'],
    }, {
    name: 'setup db',
    testMatch: /global\.setup\.ts/,
    teardown: 'cleanup db',
    }, {
    name: 'cleanup db',
    testMatch: /global\.teardown\.ts/,
    },],
    /* Run your local dev server before starting the tests */
    webServer: {
    command: "bun run dev",
    command: 'bun run dev',
    port: 3001,
    reuseExistingServer: !process.env.CI,
    ignoreHTTPSErrors: true,
    stdout: 'ignore',
    stderr: 'pipe',
    timeout
    },
    })
    })
  3. jukbot revised this gist Jun 28, 2024. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions playwright.config.ts
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ import type { ConfigOptions } from '@nuxt/test-utils/playwright'

    // Increase the timeout to 2 minutes (because Nuxt server is start so slow)
    const timeout = 120000
    const hostUrl = 'http://localhost:3001'
    const hostUrl = 'http://0.0.0.0:3001'

    export default defineConfig<ConfigOptions>({
    testDir: "./tests/e2e",
    @@ -43,7 +43,6 @@ export default defineConfig<ConfigOptions>({
    webServer: {
    command: "bun run dev",
    port: 3001,
    url: hostUrl,
    reuseExistingServer: !process.env.CI,
    ignoreHTTPSErrors: true,
    stdout: 'ignore',
  4. jukbot revised this gist Jun 28, 2024. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions playwright.config.ts
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,8 @@ import type { ConfigOptions } from '@nuxt/test-utils/playwright'
    // 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 timeout = 120000
    const hostUrl = 'http://localhost:3001'

    export default defineConfig<ConfigOptions>({
    testDir: "./tests/e2e",
    @@ -23,7 +24,7 @@ export default defineConfig<ConfigOptions>({
    setupTimeout: timeout
    },
    actionTimeout: 0,
    baseURL: "http://0.0.0.0:3001",
    baseURL: hostUrl,
    trace: "on-first-retry",
    screenshot: 'on',
    },
    @@ -42,11 +43,11 @@ export default defineConfig<ConfigOptions>({
    webServer: {
    command: "bun run dev",
    port: 3001,
    // url: 'http://0.0.0.0:3001',
    url: hostUrl,
    reuseExistingServer: !process.env.CI,
    ignoreHTTPSErrors: true,
    stdout: 'ignore',
    stderr: 'pipe',
    timeout
    },
    })
    })
  5. jukbot created this gist Jun 28, 2024.
    52 changes: 52 additions & 0 deletions playwright.config.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    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

    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: "http://0.0.0.0:3001",
    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: 'http://0.0.0.0:3001',
    reuseExistingServer: !process.env.CI,
    ignoreHTTPSErrors: true,
    stdout: 'ignore',
    stderr: 'pipe',
    timeout
    },
    })