Skip to content

Commit cf5f1ec

Browse files
authored
Merge pull request #162 from xdev-software/develop
Release
2 parents cba0590 + 0305994 commit cf5f1ec

File tree

6 files changed

+73
-66
lines changed

6 files changed

+73
-66
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
needs: [check-code]
5252
timeout-minutes: 10
5353
outputs:
54-
upload_url: ${{ steps.create_release.outputs.upload_url }}
54+
upload_url: ${{ steps.create-release.outputs.upload_url }}
5555
steps:
5656
- uses: actions/checkout@v4
5757

@@ -88,7 +88,7 @@ jobs:
8888
git push origin --tags
8989
9090
- name: Create Release
91-
id: create_release
91+
id: create-release
9292
uses: shogo82148/actions-create-release@4661dc54f7b4b564074e9fbf73884d960de569a3 # v1
9393
with:
9494
tag_name: v${{ steps.version.outputs.release }}

.gitignore

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,37 @@
11
# Maven
22
target/
3-
pom.xml.tag
4-
pom.xml.releaseBackup
5-
pom.xml.versionsBackup
6-
pom.xml.next
7-
release.properties
83
dependency-reduced-pom.xml
9-
buildNumber.properties
10-
.mvn/timing.properties
11-
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
4+
5+
# Maven Wrapper
126
.mvn/wrapper/maven-wrapper.jar
137

8+
# Maven Flatten Plugin
9+
.flattened-pom.xml
1410

1511
# Compiled class file
1612
*.class
1713

1814
# Log file
1915
*.log
2016

21-
# BlueJ files
22-
*.ctxt
23-
24-
# Mobile Tools for Java (J2ME)
25-
.mtj.tmp/
26-
2717
# Package/Binary Files don't belong into a git repo
2818
*.jar
2919
*.war
30-
*.nar
3120
*.ear
3221
*.zip
3322
*.tar.gz
34-
*.rar
3523
*.dll
3624
*.exe
3725
*.bin
3826

3927
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
4028
hs_err_pid*
4129

42-
# JRebel
43-
**/resources/rebel.xml
44-
**/resources/rebel-remote.xml
45-
46-
# eclispe stuff for root
47-
/.settings/
48-
/.classpath
49-
/.project
50-
51-
52-
# eclispe stuff for modules
53-
/*/.metadata/
54-
/*/.apt_generated_tests/
55-
/*/.settings/
56-
/*/.classpath
57-
/*/.project
58-
/*/RemoteSystemsTempFiles/
59-
60-
#custom
61-
.flattened-pom.xml
62-
.tern-project
30+
# Eclipse
31+
.metadata
32+
.settings
33+
.classpath
34+
.project
6335

6436
# == IntelliJ ==
6537
*.iml

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 1.2.4
2+
* New option ``beforeRecordingSaveWaitTime`` in ``BrowserWebDriverContainer``
3+
* If not ``null``: Waits the amount of specified time before saving the recording
4+
* This way no frames that may show the problem are accidentally lost
5+
* Default value is set to ``70ms`` which is 1 full frame when recording at the default 15 FPS
6+
* Only compute name for recording when required
7+
18
# 1.2.3
29
* Make some constants externally accessible
310
* Provide chromium image (Chrome doesn't work on ARM64)

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<dependency>
4646
<groupId>com.puppycrawl.tools</groupId>
4747
<artifactId>checkstyle</artifactId>
48-
<version>10.25.0</version>
48+
<version>10.26.0</version>
4949
</dependency>
5050
</dependencies>
5151
<configuration>
@@ -70,7 +70,7 @@
7070
<plugin>
7171
<groupId>org.apache.maven.plugins</groupId>
7272
<artifactId>maven-pmd-plugin</artifactId>
73-
<version>3.26.0</version>
73+
<version>3.27.0</version>
7474
<configuration>
7575
<includeTests>true</includeTests>
7676
<printFailingErrors>true</printFailingErrors>

testcontainers-selenium/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<dependency>
5757
<groupId>org.testcontainers</groupId>
5858
<artifactId>testcontainers</artifactId>
59-
<version>1.21.1</version>
59+
<version>1.21.2</version>
6060
<exclusions>
6161
<!-- No JUnit 4 -->
6262
<exclusion>
@@ -90,7 +90,7 @@
9090
<dependency>
9191
<groupId>org.junit.jupiter</groupId>
9292
<artifactId>junit-jupiter</artifactId>
93-
<version>5.13.1</version>
93+
<version>5.13.2</version>
9494
<scope>test</scope>
9595
</dependency>
9696
<dependency>
@@ -264,7 +264,7 @@
264264
<plugin>
265265
<groupId>org.codehaus.mojo</groupId>
266266
<artifactId>flatten-maven-plugin</artifactId>
267-
<version>1.7.0</version>
267+
<version>1.7.1</version>
268268
<configuration>
269269
<flattenMode>ossrh</flattenMode>
270270
</configuration>
@@ -304,7 +304,7 @@
304304
<plugin>
305305
<groupId>org.sonatype.central</groupId>
306306
<artifactId>central-publishing-maven-plugin</artifactId>
307-
<version>0.7.0</version>
307+
<version>0.8.0</version>
308308
<extensions>true</extensions>
309309
<configuration>
310310
<publishingServerId>sonatype-central-portal</publishingServerId>
@@ -326,7 +326,7 @@
326326
<dependency>
327327
<groupId>com.puppycrawl.tools</groupId>
328328
<artifactId>checkstyle</artifactId>
329-
<version>10.25.0</version>
329+
<version>10.26.0</version>
330330
</dependency>
331331
</dependencies>
332332
<configuration>
@@ -351,7 +351,7 @@
351351
<plugin>
352352
<groupId>org.apache.maven.plugins</groupId>
353353
<artifactId>maven-pmd-plugin</artifactId>
354-
<version>3.26.0</version>
354+
<version>3.27.0</version>
355355
<configuration>
356356
<includeTests>true</includeTests>
357357
<printFailingErrors>true</printFailingErrors>

testcontainers-selenium/src/main/java/software/xdev/testcontainers/selenium/containers/browser/BrowserWebDriverContainer.java

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.util.Optional;
3636
import java.util.concurrent.TimeUnit;
3737
import java.util.function.Function;
38+
import java.util.function.Supplier;
3839
import java.util.stream.Collectors;
3940
import java.util.stream.IntStream;
4041

@@ -114,6 +115,8 @@ public class BrowserWebDriverContainer<SELF extends BrowserWebDriverContainer<SE
114115
protected Path recordingDirectory;
115116
protected TestRecordingFileNameFactory testRecordingFileNameFactory = new DefaultTestRecordingFileNameFactory();
116117
protected Duration recordingSaveTimeout = Duration.ofMinutes(3);
118+
// Ensure that the current frame will be fully recorded (default record FPS = 15 -> 67ms per Frame)
119+
protected Duration beforeRecordingSaveWaitTime = Duration.ofMillis(70);
117120

118121
public BrowserWebDriverContainer(final String dockerImageName)
119122
{
@@ -211,6 +214,13 @@ public SELF withRecordingSaveTimeout(final Duration recordingSaveTimeout)
211214
this.recordingSaveTimeout = recordingSaveTimeout;
212215
return this.self();
213216
}
217+
218+
public SELF withBeforeRecordingSaveWaitTime(final Duration beforeRecordingSaveWaitTime)
219+
{
220+
this.beforeRecordingSaveWaitTime = beforeRecordingSaveWaitTime;
221+
return this.self();
222+
}
223+
214224
// endregion
215225

216226
// endregion
@@ -441,38 +451,56 @@ public void stop()
441451
@Override
442452
public void afterTest(final TestDescription description, final Optional<Throwable> throwable)
443453
{
444-
this.retainRecordingIfNeeded(description.getFilesystemFriendlyName(), throwable.isEmpty());
454+
this.retainRecordingIfNeeded(description::getFilesystemFriendlyName, throwable.isEmpty());
445455
}
446456

447-
protected void retainRecordingIfNeeded(final String testName, final boolean succeeded)
457+
protected void retainRecordingIfNeeded(final Supplier<String> testNameSupplier, final boolean succeeded)
448458
{
459+
// Should recording be retained?
449460
if(switch(this.recordingMode)
450461
{
451-
case RECORD_ALL -> true;
452-
case RECORD_FAILING -> !succeeded;
453-
default -> false;
462+
case RECORD_ALL -> false;
463+
case RECORD_FAILING -> succeeded;
464+
default -> true;
454465
})
466+
{
467+
return;
468+
}
469+
470+
if(this.beforeRecordingSaveWaitTime != null)
455471
{
456472
try
457473
{
458-
final Path recording = Timeouts.getWithTimeout(
459-
(int)this.recordingSaveTimeout.toSeconds(),
460-
TimeUnit.SECONDS,
461-
() -> this.recordingContainer.saveRecordingToFile(
462-
this.recordingDirectory,
463-
this.testRecordingFileNameFactory.buildNameWithoutExtension(testName, succeeded))
464-
);
465-
LOG.info("Screen recordings for test {} will be stored at: {}", testName, recording);
466-
}
467-
catch(final org.rnorth.ducttape.TimeoutException te)
468-
{
469-
LOG.warn("Timed out while saving recording for test {}", testName, te);
474+
Thread.sleep(this.beforeRecordingSaveWaitTime.toMillis());
470475
}
471-
catch(final Exception ex)
476+
catch(final InterruptedException e)
472477
{
473-
LOG.warn("Failed to save recording for test {}", testName, ex);
478+
Thread.currentThread().interrupt();
479+
throw new IllegalStateException("Got interrupted", e);
474480
}
475481
}
482+
483+
// Get testname only when required to improve performance
484+
final String testName = testNameSupplier.get();
485+
try
486+
{
487+
final Path recording = Timeouts.getWithTimeout(
488+
(int)this.recordingSaveTimeout.toSeconds(),
489+
TimeUnit.SECONDS,
490+
() -> this.recordingContainer.saveRecordingToFile(
491+
this.recordingDirectory,
492+
this.testRecordingFileNameFactory.buildNameWithoutExtension(testName, succeeded))
493+
);
494+
LOG.info("Screen recordings for test {} will be stored at: {}", testName, recording);
495+
}
496+
catch(final org.rnorth.ducttape.TimeoutException te)
497+
{
498+
LOG.warn("Timed out while saving recording for test {}", testName, te);
499+
}
500+
catch(final Exception ex)
501+
{
502+
LOG.warn("Failed to save recording for test {}", testName, ex);
503+
}
476504
}
477505

478506
@Override

0 commit comments

Comments
 (0)