Skip to content

Make Playwright Tests Deployment Ready #9

@digitalrisedorset

Description

@digitalrisedorset

Goal

Allow Playwright tests to run automatically without requiring a manually started development server.

Current State

  • Tests require npm run dev to be running before execution.
  • A developer must start the server manually.
  • Tests target a fixed localhost URL.
  • Tests cannot be executed reliably from deployment pipelines.

Target State

  • Playwright starts the application automatically.
  • Playwright waits until the application is ready.
  • Tests run against a configurable URL.
  • Tests can execute locally and in CI/CD environments without manual intervention.

Acceptance Criteria

  • npm run test:e2e works from a clean checkout.
  • No manual server startup is required.
  • Tests pass locally.
  • Tests can be executed from deployment scripts.
  • Application URL is configurable through environment variables.
  • The test process starts and stops the application automatically.

Suggested Approach

Investigate Playwright's webServer configuration:

export default defineConfig({
    webServer: {
        command: 'npm run dev',
        url: 'http://localhost:5173',
        reuseExistingServer: !process.env.CI
    }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions