public class EtsyDotComStories extends JUnitStories {
public EtsyDotComStories() {
PendingStepStrategy pendingStepStrategy = new FailingUponPendingStep();
CrossReference crossReference = new SauceContextOutput.SauceLabsCrossReference(new HashMap<String, String>())
.withJsonOnly().withOutputAfterEachStory(true).withPendingStepStrategy(pendingStepStrategy)
.excludingStoriesWithNoExecutedScenarios(true);
SeleniumContext seleniumContext = new SeleniumContext();
WebDriverProvider driverProvider;
Format[] formats;
ContextView contextView;
if (System.getProperty("SAUCE_USERNAME") != null) {
driverProvider = new SauceWebDriverProvider();
formats = new Format[] { new SeleniumContextOutput(seleniumContext), CONSOLE, WEB_DRIVER_HTML };
contextView = new SauceLabsContextView(driverProvider);
crossReference.withThreadSafeDelegateFormat(new SauceContextOutput(driverProvider, seleniumContext,
new HashMap<String, String>()));
} else if (System.getProperty("REMOTE") != null) {
driverProvider = new RemoteWebDriverProvider();
formats = new Format[] { CONSOLE, WEB_DRIVER_HTML };
contextView = new ContextView.NULL();
} else {
driverProvider = new FirefoxWebDriverProvider();
formats = new Format[] { new SeleniumContextOutput(seleniumContext), CONSOLE, WEB_DRIVER_HTML };
contextView = new LocalFrameContextView().sized(640, 120);
}
StoryReporterBuilder reporterBuilder = new StoryReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromClass(EtsyDotComStories.class)).withFailureTrace(true)
.withFailureTraceCompression(true).withDefaultFormats().withFormats(formats)
.withCrossReference(crossReference);
Configuration configuration = new SeleniumConfiguration().useWebDriverProvider(driverProvider)
.useSeleniumContext(seleniumContext).useFailureStrategy(new RethrowingFailure())
.usePendingStepStrategy(pendingStepStrategy)
.useStoryControls(new StoryControls().doResetStateBeforeScenario(false))
.useStepMonitor(new SeleniumStepMonitor(contextView, seleniumContext, crossReference.getStepMonitor()))
.useStoryLoader(new LoadFromClasspath(EtsyDotComStories.class))
.useStoryReporterBuilder(reporterBuilder);
useConfiguration(configuration);
final ThreadCaching primordialCaching = new ThreadCaching();