-
Notifications
You must be signed in to change notification settings - Fork 262
Open
Description
🚀 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 do can't make use of that injected server.
Metadata
Metadata
Assignees
Labels
No labels