Allow custom wsEndpoint for Playwright

Aperta
#33,115 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
angular, playwright, typescript

Direzione di ricerca

Inizia leggendo browser-provider.ts intorno alle righe 164-187, in particolare providerFactory, quindi esamina gli override del provider in plugins.ts intorno alle righe 265-284. Traccia il percorso della configurazione di Playwright fino all’Angular builder e determina quale opzione compatibile con le versioni precedenti sia appropriata. Il lavoro è completato quando un wsEndpoint configurato esplicitamente viene rispettato invece di essere sovrascritto implicitamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: @angular-devkit/build-angular gemini-triaged
Command

build

Description

In our project, I've been trying to set up visual regression testing using Vitest, and to make the screenshot tests stable, we want to make those tests in the same environment, regardless of the developers' OS, which can impact the tests. When using Playwright as a browser provider, Vites allows for providing/overriding the WS endpoint, which is not respected & overridden in the unit test builder.

After a quick look at the code, presumably this is being dropped in browser-provider.ts:164-87 - providerFactory(..) function is called with only baseOptions, and also, plugins.ts:265-284 has some more overrides, and comments (// CLI provider browser options override, if present)

Describe the solution you'd like

Ideally, as a developer, I'd like to have better control over the browser provider configuration, instead of having it implicitly overridden on the builder side.

These are the options that I have on my mind, both of them backward compatible with the existing API:

  1. Allow full customization for the browser provider

The solution is as simple as not overriding the provider value if defined explicitly in vitetest-base.config.ts. This option would be backward compatible with the existing API, but might break the projects that've attempted to override the provider property and haven't noticed that it has no impact.

  1. Add wsEndpoint property to the builder schema, and allow overriding the value from angular.json

Safer solution, but less flexible.

Describe alternatives you've considered

All other alternatives require significant efforts to support, and require bypassing the Angular builders, or using a different framework for the same purpose.

I'm also happy to make a contribution, but first, I'd like to get an opinion, and maybe get more context on why the browser config is overridden from Angular's side.

Lingua principale
TypeScript
Stelle
27k
Fork
11.8k
Merge medio
16h 21m
PR unite (30g)
170

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di angular/angular-cli

Tutte le issue di angular/angular-cli

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.