mirror of
https://github.com/google/nomulus.git
synced 2025-06-10 14:34:43 +02:00
Use Docker Java API to manage container for WebDriver
Previously we had a few customized Gradle build task to manage the Docker container for provisioning browser and ChromeDriverService used by WebDriver tests. This CL changed to use a java library from testcontainers.org to achieve the same purpose. The main benefit of it is that we can expect to run the WebDriver tests from IDE going forward. Also, this CL refactored the structure of WebDriver related classes to have JUnit rule to manage the lifecycle of WebDriver instance, this is also compatible with the API from testcontainers library. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=241539861
This commit is contained in:
parent
f7dbaf1f81
commit
aae1e42da8
29 changed files with 376 additions and 177 deletions
|
@ -20,7 +20,7 @@ import com.google.common.flogger.FluentLogger;
|
|||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||
import org.junit.runners.BlockJUnit4ClassRunner;
|
||||
import org.junit.runners.model.FrameworkMethod;
|
||||
import org.junit.runners.model.InitializationError;
|
||||
|
@ -68,7 +68,7 @@ public class RepeatableRunner extends BlockJUnit4ClassRunner {
|
|||
|
||||
private Field getAttemptNumberField() {
|
||||
List<Field> attemptNumberFields =
|
||||
Stream.of(getTestClass().getJavaClass().getDeclaredFields())
|
||||
FieldUtils.getAllFieldsList(getTestClass().getJavaClass()).stream()
|
||||
.filter(declaredField -> declaredField.getType().equals(AttemptNumber.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
@ -163,7 +163,11 @@ public class RepeatableRunner extends BlockJUnit4ClassRunner {
|
|||
if (numSuccess == 0) {
|
||||
logger.atSevere().log(
|
||||
"[%s] didn't pass after all %d attempts failed!\n", method.getName(), MAX_ATTEMPTS);
|
||||
throw lastException;
|
||||
// In most cases, setting RUN_ALL_ATTEMPTS to true is to find the golden image, so we should
|
||||
// not throw an exception to reduce confusion
|
||||
if (!RUN_ALL_ATTEMPTS) {
|
||||
throw lastException;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue