Skip to content

Commit 40f3ada

Browse files
committed
Allow core tests to have speed set
1 parent 9c84654 commit 40f3ada

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

java/server/src/org/openqa/selenium/server/htmlrunner/CoreTestCase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public void run(Results results, WebDriver driver, Selenium selenium) {
6868
} else {
6969
stepResults.add(new StepResult(step, null));
7070
}
71+
state.sleepTight();
7172
}
7273

7374
results.addTest(rawSource, stepResults);

java/server/src/org/openqa/selenium/server/htmlrunner/TestState.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,26 @@
2020
import static java.util.regex.Pattern.MULTILINE;
2121

2222
import com.google.common.base.Preconditions;
23+
import com.google.common.base.Throwables;
2324

2425
import java.util.HashMap;
2526
import java.util.Map;
27+
import java.util.concurrent.TimeUnit;
2628
import java.util.regex.Matcher;
2729
import java.util.regex.Pattern;
2830

2931
class TestState {
3032
private static Map<String, Object> storedValues = new HashMap<>();
33+
private long commandTimeOut = TimeUnit.SECONDS.toMillis(30);
34+
private long speed = 0;
35+
36+
public void sleepTight() {
37+
try {
38+
Thread.sleep(speed);
39+
} catch (InterruptedException e) {
40+
throw new RuntimeException("Unlikely: " + Throwables.getStackTraceAsString(e));
41+
}
42+
}
3143

3244
public void store(String key, Object value) {
3345
storedValues.put(key, value);
@@ -63,8 +75,6 @@ public String expand(String toExpand) {
6375
}
6476
return stringResult;
6577
};
66-
67-
6878
*/
6979
Pattern toMatch = Pattern.compile("\\$\\{(\\w+)\\}", MULTILINE);
7080
Matcher matcher = toMatch.matcher(toExpand);

0 commit comments

Comments
 (0)