microsoft / microsoft/playwright-java
[Bug]: Playwright-Junit lifecycle incompatible with maven retries 'surefire.rerunFailingTestsCount'
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 298
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 14
Description
Version
1.50.0
Steps to reproduce
- Have a basic Playwright test that fails
- Try running it with maven retries:
./mvnw test -Dtest=MyTest -Dsurefire.rerunFailingTestsCount=2
Expected behavior
System is able to retry the failing test, system can work with Playwright context (browser, page etc.)
Actual behavior
First attempt is a legit failure, subsequent rerun attempts have broken Playwright context
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.002 s <<< FAILURE! -- in fm.seller.onboardingweb.test.MyTest
[ERROR] fm.seller.onboardingweb.test.MyTest.test(Page) -- Time elapsed: 0.001 s <<< ERROR!
org.junit.jupiter.api.extension.ParameterResolutionException: Failed to resolve parameter [com.microsoft.playwright.Page page] in method [public void fm.seller.onboardingweb.test.MyTest.test(com.microsoft.playwright.Page)]: Playwright connection closed
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: com.microsoft.playwright.PlaywrightException: Playwright connection closed
at com.microsoft.playwright.impl.PipeTransport.send(PipeTransport.java:50)
at com.microsoft.playwright.impl.Connection.internalSendMessage(Connection.java:168)
at com.microsoft.playwright.impl.Connection.sendMessageAsync(Connection.java:134)
at com.microsoft.playwright.impl.ChannelOwner.sendMessageAsync(ChannelOwner.java:109)
at com.microsoft.playwright.impl.SelectorsImpl.setTestIdAttributeName(SelectorsImpl.java:42)
at com.microsoft.playwright.impl.SharedSelectors.lambda$setTestIdAttribute$2(SharedSelectors.java:72)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at com.microsoft.playwright.impl.SharedSelectors.setTestIdAttribute(SharedSelectors.java:72)
at com.microsoft.playwright.impl.junit.ExtensionUtils.setTestIdAttribute(ExtensionUtils.java:53)
at com.microsoft.playwright.impl.junit.BrowserContextExtension.getOrCreateBrowserContext(BrowserContextExtension.java:60)
at com.microsoft.playwright.impl.junit.PageExtension.getOrCreatePage(PageExtension.java:51)
at com.microsoft.playwright.impl.junit.PageExtension.resolveParameter(PageExtension.java:35)
... 2 more
[ERROR] Errors:
[ERROR] fm.seller.onboardingweb.test.MyTest.test(Page)
[ERROR] Run 1: MyTest.test:13
[ERROR] Run 2: MyTest.test(Page) » ParameterResolution Failed to resolve parameter [com.microsoft.playwright.Page page] in method [public void fm.seller.onboardingweb.test.MyTest.test(com.microsoft.playwright.Page)]: Playwright connection closed
[ERROR] Run 3: MyTest.test(Page) » ParameterResolution Failed to resolve parameter [com.microsoft.playwright.Page page] in method [public void fm.seller.onboardingweb.test.MyTest.test(com.microsoft.playwright.Page)]: Playwright connection closed
Additional context
Minimal test:
@UsePlaywright(OptionsFactory.class)
public class MyTest {
@Test
public void test(Page page) {
page.navigate("https://google.com/");
assert false;
}
}
Environment
- OS name: "mac os x", version: "15.3", arch: "aarch64", family: "mac"
- Java version: 17.0.2, vendor: Oracle Corporation
- Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
- playwright 1.50.0
- Junit 5.11.4
- surefire 3.5.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal MyTest reproduction and run it using the Maven command with surefire.rerunFailingTestsCount=2. Trace the JUnit lifecycle through PageExtension, BrowserContextExtension, and ExtensionUtils, where the stack trace shows the retry failure. Done means the initial failure can be retried while Playwright Page and browser context parameters remain usable on subsequent attempts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100