Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 7d7648c

Browse files
committed
Rerun failed tests
Chromedriver on Travis got crazy lately for no obvious reason. This should help us keeping stability of the builds.
1 parent 26e96ef commit 7d7648c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/functional/WebDriverTestCase.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use Facebook\WebDriver\Chrome\ChromeOptions;
1919
use Facebook\WebDriver\Exception\NoSuchWindowException;
20+
use Facebook\WebDriver\Exception\WebDriverException;
2021
use Facebook\WebDriver\Remote\DesiredCapabilities;
2122
use Facebook\WebDriver\Remote\RemoteWebDriver;
2223
use Facebook\WebDriver\Remote\WebDriverBrowserType;
@@ -133,6 +134,30 @@ public static function skipForJsonWireProtocol($message = 'Not supported by Json
133134
}
134135
}
135136

137+
/**
138+
* Rerun failed tests.
139+
* @TODO Replace with PHPUnit 7.3+ builtin functionality once upgraded to PHP 7.1+
140+
*/
141+
public function runBare()
142+
{
143+
$e = null;
144+
$numberOfRetires = 3;
145+
146+
for ($i = 0; $i < $numberOfRetires; ++$i) {
147+
try {
148+
parent::runBare();
149+
150+
return;
151+
} catch (WebDriverException $e) {
152+
// repeat
153+
}
154+
}
155+
156+
if ($e !== null) {
157+
throw $e;
158+
}
159+
}
160+
136161
/**
137162
* Get the URL of given test HTML on running webserver.
138163
*

0 commit comments

Comments
 (0)