Skip to content

Commit 764b532

Browse files
committed
resolve conflicts
2 parents f9cc42f + 3bbe104 commit 764b532

File tree

9 files changed

+52
-17
lines changed

9 files changed

+52
-17
lines changed

.github/workflows/maven.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
os: [ ubuntu-latest, macos-latest ]
13+
os: [ ubuntu-latest, macos-latest, windows-latest ]
1414
java: [ '8', '11', '17' ]
15-
playwright: [ '1.18.0', '1.19.0', '1.20.0' ]
15+
playwright: [ '1.18.0', '1.27.1' ]
1616
runs-on: ${{ matrix.os }}
1717
name: ${{matrix.os}} - Java ${{ matrix.java }} - Playwright ${{matrix.playwright}}
1818
steps:
@@ -22,5 +22,5 @@ jobs:
2222
with:
2323
distribution: 'temurin'
2424
java-version: ${{ matrix.java }}
25-
- run: mvn clean test "-Dplaywright.version=${{matrix.playwright}}" -DexcludedGroups=playwrightCreate,indirect --file pom.xml --no-transfer-progress
26-
- run: mvn clean test "-Dplaywright.version=${{matrix.playwright}}" -Dgroups=playwrightCreate --file pom.xml --no-transfer-progress
25+
- run: mvn clean test "-Dplaywright.version=${{matrix.playwright}}" "-DexcludedGroups=playwrightCreate,indirect" --file pom.xml --no-transfer-progress
26+
- run: mvn clean test "-Dplaywright.version=${{matrix.playwright}}" -Dgroups=playwrightCreate -DexcludedGroups=flakey --file pom.xml --no-transfer-progress

.idea/compiler.xml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ the wiki for v1 docs. It is recommended to upgrade to v2.0. Migration help can
1616
<dependency>
1717
<groupId>io.github.uchagani</groupId>
1818
<artifactId>junit-playwright</artifactId>
19-
<version>2.2.3</version>
19+
<version>3.0.1</version>
2020
</dependency>
2121
```
2222

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.uchagani</groupId>
88
<artifactId>junit-playwright</artifactId>
9-
<version>2.2.5</version>
9+
<version>3.0.1</version>
1010

1111
<name>junit-playwright</name>
1212
<description>junit-playwright allows you to easily run Playwright-Java tests in parallel</description>
@@ -21,10 +21,10 @@
2121
<properties>
2222
<maven.compiler.source>8</maven.compiler.source>
2323
<maven.compiler.target>8</maven.compiler.target>
24-
<playwright.version>1.20.0</playwright.version>
24+
<playwright.version>1.27.1</playwright.version>
2525
<junit.version>5.8.2</junit.version>
2626
<!-- set latest manifold version here -->
27-
<manifold.version>2022.1.7</manifold.version>
27+
<manifold.version>2022.1.19</manifold.version>
2828
</properties>
2929

3030
<scm>

run-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mvn clean test -DexcludedGroups=playwrightCreate,indirect
2+
mvn clean test -Dgroups=playwrightCreate

src/main/java/io/github/uchagani/jp/PlaywrightTestWatcher.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import java.nio.file.Path;
99
import java.nio.file.Paths;
10+
import java.util.regex.Matcher;
11+
import java.util.regex.Pattern;
1012

1113
import static io.github.uchagani.jp.APIRequestContextParameterResolver.closeAPIRequestContext;
1214
import static io.github.uchagani.jp.ExtensionUtils.getBrowserConfig;
@@ -53,7 +55,10 @@ private void stopTrace(ExtensionContext extensionContext) {
5355
}
5456

5557
private String getSafeTestName(ExtensionContext extensionContext) {
56-
return String.format("%s.%s.zip", extensionContext.getRequiredTestClass().getName(), extensionContext.getRequiredTestMethod().getName());
58+
Pattern regex = Pattern.compile("\\[class:(.*)\\]\\/\\[method:(.*)\\]");
59+
Matcher matcher = regex.matcher(extensionContext.getUniqueId());
60+
matcher.find();
61+
return matcher.group(1) + "." + matcher.group(2) + ".zip";
5762
}
5863

5964
private void cleanup(ExtensionContext extensionContext) {

src/test/java/io/github/uchagani/jp/PlaywrightTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ void injectPlaywrightTestRunsSuccessfully() {
2222
.assertStatistics(stat -> stat.succeeded(1));
2323
}
2424

25+
@Tag("flakey")
2526
@Test
2627
void injectPlaywrightWithOptionsTestRunsFails() {
2728
EngineTestKit

src/test/java/io/github/uchagani/jp/TraceTestCase.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ public void traceFile_onFail_isCreated(Page ignored) {
7676
fail("force fail");
7777
}
7878

79+
@Test
80+
@UseBrowserConfig(TraceBrowserConfigSaveOnlyOnFailure.class)
81+
public void traceFile_onFail_isCreated(Page ignored, String foo) {
82+
fail("force fail");
83+
}
84+
85+
@Test
86+
@UseBrowserConfig(TraceBrowserConfigSaveOnlyOnFailure.class)
87+
public void traceFile_onFail_isCreated() {
88+
fail("force fail");
89+
}
90+
7991
@Test
8092
@UseBrowserConfig(TraceBrowserConfigAlternateOutputDir.class)
8193
public void traceFile_inAlternateDir_isCreated(Page ignored) {

src/test/java/io/github/uchagani/jp/TraceTests.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.junit.platform.testkit.engine.EngineTestKit;
77

88
import java.lang.reflect.Method;
9+
import java.lang.reflect.Parameter;
910
import java.nio.file.Path;
1011
import java.util.Arrays;
1112
import java.util.List;
@@ -30,14 +31,28 @@ void verifyTraceTestStats() {
3031
BrowserConfig config = getBrowserConfig(test.getAnnotation(UseBrowserConfig.class).value());
3132
Path outputDir = config.getOutputDirectory();
3233

34+
String testName = generateFileNameFromMethod(test);
3335
if (test.getName().endsWith("isCreated")) {
34-
assertThat(outputDir).isDirectoryContaining(getTraceFileName(test.getName()));
36+
assertThat(outputDir).isDirectoryContaining(getTraceFileName(testName));
3537
} else if (test.getName().endsWith("isNotCreated")) {
36-
assertThat(outputDir).isDirectoryNotContaining(getTraceFileName(test.getName()));
38+
assertThat(outputDir).isDirectoryNotContaining(getTraceFileName(testName));
3739
}
3840
}
3941
}
4042

43+
private String generateFileNameFromMethod(Method method) {
44+
StringBuilder testName = new StringBuilder(method.getName());
45+
testName.append("(");
46+
for(int i = 0; i < method.getParameterCount(); i++) {
47+
if(i > 0) {
48+
testName.append(", ");
49+
}
50+
testName.append(method.getParameters()[i].getType().getName());
51+
}
52+
testName.append(")");
53+
return testName.toString();
54+
}
55+
4156
private String getTraceFileName(String testName) {
4257
return "glob:**" + TraceTestCase.class.getName() + "." + testName + ".zip";
4358
}

0 commit comments

Comments
 (0)