[Feature]: Configure web servers per project

Cerrado
#43,853 4 comentarios 2 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Ya se ha fusionado un pull request relacionado.

  • #43860 de @microsoft-playwright-automation — fusionado

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
testing

Línea de trabajo

The request is to allow the webServer option to be set per entry in projects, as in the example config, so a project that does not need a server skips starting it. The payload names no source files, so start by finding where the test runner reads webServer and starts those servers. Done means a project with its own webServer starts only its servers, and a project without one starts none, with the smoke-test case covered by a test. Settle the open design questions with maintainers first, such as whether servers are shared across projects.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

🚀 Feature Request

I would love to have the possibility to configure local web servers per project.
In my use case, I have a full suite that runs against a local build of my application and a mock server, and a subset of those tests are used as smoke tests against production.

The problem is that playwright always executes the web servers configured when I run only the smoke-tests project.

Example

If I had the possibility to configure the webServers per project, I would be able to avoid waiting for the local applications to be instantiated, like:

export default defineConfig({
  projects: [
    {
      name: 'functional-chromium',
      grepInvert: /@smoke/,
      use: { ...devices['Desktop Chrome'], baseURL: 'http://localhost:3000' },
      webServer: [
        {
           command: 'yarn serve',
           url: 'http://localhost:3000',
           timeout: 380 * 1000,
           reuseExistingServer: true,
        },
        {
           command: 'yarn mock-server',
           port: 3001,
           reuseExistingServer: true,
        },
      ],
    },
    {
       name: 'smoke-chromium',
       grep: /@smoke/,
       use: { ...devices['Desktop Chrome'], baseURL: 'https://production.app.com' },
    },
  ],
});
Motivation

It provides the necessary flexibility to run the playwright test suite in different settings, like:

  • executing the test suite against a mock server served by the webServer project or against a real environment
  • execute specific web servers on unrelated projects living in the same configuration
Lenguaje dominante
TypeScript
Estrellas
99.1k
Forks
6.8k
Merge medio
16 h 7 min
PR fusionados (30 d)
325

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/playwright

Todos los issues de microsoft/playwright

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.