Skip to content

feat(junit): add Browser.NewContextOptions fixture - #2005

Merged
Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-1781
Oct 15, 2026
Merged

Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-1781

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • @UsePlaywright can now inject Browser.NewContextOptions, configured from the OptionsFactory the same way as the BrowserContext fixture.
  • It returns a new instance each time and also works in @BeforeAll/@AfterAll, so class-level setup can create its own context.

Fixes #1781

@yury-s
Yury Semikhatsky (yury-s) marked this pull request as ready for review October 14, 2026 21:47
contextOptions.setBaseURL(options.baseUrl);
}

if (options.deviceName != null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert browser type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in decf3d4: setting both deviceName and a browserName that differs from the device's defaultBrowserType now throws. With only deviceName set, the browser is already taken from the device.

@yury-s
Yury Semikhatsky (yury-s) merged commit 2aa1a2b into microsoft:main Oct 15, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: JUnit5: Page and BrowserContext fixture support in BeforeAll/AfterAll methods

2 participants