Skip to content

Commit 493840c

Browse files
committed
Add match timeout option
1 parent 8a7fc7f commit 493840c

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ The tool build in java and requires minimal set of parameters the minimal comman
8686
+ `-id` - Ignore displacement of shifting elements.
8787
+ `-pn` - Prompt new tests, new tests will not be saved automatically, the user will have to review and save manually.
8888
+ `-dv` - Disable SSL certificate validation. !!!Unsecured!!!
89-
+ `-lo` - Use legacy files order to comply with baselines that were created with versions below 2.0
89+
+ `-lo` - Use legacy files order complying with baselines that were created with versions below 2.0
9090
+ `-ac [Level:GuidelineVer]` - Set accessibility validation and optionally it's arguments split by semicolons ':' default: "AA:WCAG_2_0", available options: [AA|AAA:WCAG_2_0|WCAG_2_1]
9191
+ `-dcb` - ImageTester will not automatically close batch(es) when test is complete.
9292
+ `-mp` - ImageTester will read from and execute tests based on the batch mapper CSV.
9393
+ `-te` - ImageTester will throw an exception if Eyes detects a mismatch or failure. <br>
94+
+ `-mt` - Sets match timeout and retry timeout (default=500). <br>
9495
+ `-ir` - Ignore regions will be applied to all pages. <br>
9596
**Example:** `-ir "300,300,500,100|500,500,200,200"` will create ignored regions at <br>
9697
+ x:300, y:300, with width:500, height:100 and <br>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.applitools.imagetester</groupId>
66
<artifactId>ImageTester</artifactId>
7-
<version>3.2.0</version>
7+
<version>3.2.1</version>
88
<packaging>jar</packaging>
99
<properties>
1010
<maven.compiler.source>1.8</maven.compiler.source>

src/main/java/com/applitools/imagetester/ImageTester.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public static void main(String[] args) {
115115
config.setAccessibilityBoldTextRegions(cmd.getOptionValue("arb", null));
116116
config.setAccessibilityGraphicsRegions(cmd.getOptionValue("arg", null));
117117
config.setCaptureRegion(cmd.getOptionValue("rc", null));
118+
config.setMatchTimeout(cmd.getOptionValue("mt", null));
118119

119120
// Full page for ac regions capability
120121
if (cmd.hasOption("arr") && config.accessibilityRegularTextRegions == null) {
@@ -219,6 +220,7 @@ private static void runTestWithBatchMapper(final Logger logger, final CommandLin
219220
currentConfiguration.dontCloseBatches = cmd.hasOption("dcb");
220221
currentConfiguration.shouldThrowException = cmd.hasOption("te");
221222
currentConfiguration.setCaptureRegion(cmd.getOptionValue("rc", null));
223+
currentConfiguration.setMatchTimeout(cmd.getOptionValue("mt", null));
222224

223225
try {
224226
File root = new File(currentBatch.filePath);
@@ -510,6 +512,13 @@ private static Options getOptions() {
510512
.hasArgs()
511513
.optionalArg(false)
512514
.build());
515+
options.addOption(Option.builder("mt")
516+
.longOpt("matchTimeout")
517+
.desc("Set value for match timeout and retry timeout in ms(minimum 500).\nexample: `-mt 2000`")
518+
.hasArgs()
519+
.optionalArg(false)
520+
.build());
521+
513522

514523
EyesUtilitiesConfig.injectOptions(options);
515524
return options;

src/main/java/com/applitools/imagetester/lib/Config.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class Config {
5050
public boolean accessibilityBoldTextFullPage = false;
5151
public boolean accessibilityGraphicsFullPage = false;
5252
public Region captureRegion;
53+
public String matchTimeout;
5354

5455
public void setViewport(String viewport) {
5556
if (viewport == null) return;
@@ -239,4 +240,12 @@ public void setAccessibilityGraphicsRegions(String accessibilityGraphicsRegions)
239240
}
240241
}
241242
}
243+
244+
public void setMatchTimeout(String matchTimeout) {
245+
this.matchTimeout = matchTimeout;
246+
}
247+
248+
public String getMatchTimeout() {
249+
return this.matchTimeout;
250+
}
242251
}

src/main/java/com/applitools/imagetester/lib/TestExecutor.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public void enqueue(TestBase test, BatchInfo overrideBatch) {
3131
Eyes eyes = thEyes_.get();
3232
//set batch
3333
setBatch(eyes, overrideBatch, config_);
34+
setTimeout(eyes, config_);
3435
TestResults result = test.runSafe(eyes);
3536
eyes.abortIfNotClosed();
3637

@@ -98,4 +99,12 @@ public void setBatch(Eyes eyes, BatchInfo overrideBatch, Config config) {
9899
if (config_.sequenceName != null && !StringUtils.isEmpty(config_.sequenceName))
99100
eyes.getBatch().setSequenceName(config_.sequenceName);
100101
}
102+
103+
//set eyes correct batch
104+
public void setTimeout(Eyes eyes, Config config) {
105+
if (config.getMatchTimeout() != null) {
106+
int matchTimeoutValue = Integer.parseInt(config.getMatchTimeout());
107+
if (matchTimeoutValue >= 500) eyes.setMatchTimeout(matchTimeoutValue);
108+
}
109+
}
101110
}

0 commit comments

Comments
 (0)