microsoft / microsoft/playwright-java
[Feature]: OptionsFactory that has access to test instance fields
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 1.6k
- Fork
- 298
- Merge medio
- 3g 2h
- PR unite (30g)
- 14
Descrizione
🚀 Feature Request
I'd like the ability to populate Options for use with @UsePlaywright with values that are determined by the running test, not just statically.
The OptionsFactory approach to customizing @UsePlaywright has a big gap - it can't access instance fields of the test. A non-static inner class doesn't work as it requires the outer class as a constructor argument.
Example
@UsePlaywright
@MicronautTest
class MyTest {
@Inject
EmbeddedServer server;
Options getOptions() {
return new Options().setBaseUrl(server.getUrl())
}
@Test
void myTest(Page page) {
}
}
Motivation
I'm trying to use Playwright with a fake server (Spring MockMVC, Micronaut EmbeddedServer, etc). These approaches all inject a server into an instance field of the test class, and one retrieves the base URL from that server. However, OptionsFactory is initialized outside of the test instance scope, and so can't make use of that injected server.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando l’integrazione di @UsePlaywright OptionsFactory e il modo in cui viene inizializzata rispetto all’istanza del test. Esamina l’esempio con un EmbeddedServer iniettato e determina il ciclo di vita necessario per accedere ai campi dell’istanza. Il lavoro è completato quando Options può usare valori dal test in esecuzione e il comportamento esistente di @UsePlaywright continua a essere supportato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- testing-qa
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100