|
24 | 24 |
|
25 | 25 | import com.google.common.base.Throwables; |
26 | 26 |
|
| 27 | +import org.junit.AssumptionViolatedException; |
27 | 28 | import org.junit.Before; |
28 | 29 | import org.junit.Rule; |
29 | 30 | import org.junit.rules.RuleChain; |
@@ -112,9 +113,7 @@ protected void starting(Description description) { |
112 | 113 | removeDriver(); |
113 | 114 | } |
114 | 115 | try { |
115 | | - driver = actuallyCreateDriver(); |
116 | | - wait = new WebDriverWait(driver, 30); |
117 | | - shortWait = new WebDriverWait(driver, 5); |
| 116 | + createDriver(); |
118 | 117 | } catch (Exception e) { |
119 | 118 | throw new RuntimeException("Exception creating driver", e); |
120 | 119 | } |
@@ -159,11 +158,11 @@ public void evaluate() throws Throwable { |
159 | 158 | } |
160 | 159 |
|
161 | 160 | private void dealWithSauceFailureIfNecessary(Throwable t) { |
162 | | - if (t.getMessage() != null |
| 161 | + if (!(t instanceof AssumptionViolatedException) && t.getMessage() != null |
163 | 162 | && (t.getMessage().contains("sauce") || t.getMessage().contains("Sauce"))) { |
164 | 163 | removeDriver(); |
165 | 164 | try { |
166 | | - actuallyCreateDriver(); |
| 165 | + createDriver(); |
167 | 166 | } catch (Exception e) { |
168 | 167 | throw new RuntimeException("Exception creating driver, after Sauce-detected exception", e); |
169 | 168 | } |
@@ -267,6 +266,12 @@ public WebDriver getWrappedDriver() { |
267 | 266 | return storedDriver.get(); |
268 | 267 | } |
269 | 268 |
|
| 269 | + private void createDriver() { |
| 270 | + driver = actuallyCreateDriver(); |
| 271 | + wait = new WebDriverWait(driver, 30); |
| 272 | + shortWait = new WebDriverWait(driver, 5); |
| 273 | + } |
| 274 | + |
270 | 275 | public static WebDriver actuallyCreateDriver() { |
271 | 276 | WebDriver driver = storedDriver.get(); |
272 | 277 |
|
|
0 commit comments