All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.salesforceiq.augmenteddriver.web.AugmentedWebDriverProvider Maven / Gradle / Ivy

package com.salesforceiq.augmenteddriver.web;

import com.google.common.base.Preconditions;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.salesforceiq.augmenteddriver.util.AugmentedProvider;

/**
 * Ugly hack
 *
 * Reasoning:
 * 

* We cannot define the driver as Singleton for performance reasons. One driver is created synchronously after the other. * When we run in parallel, all the tests queue up, and for example, an android takes 50 seconds to be created on SLabs. *

*

* We create the first Driver at the beginning of the set up and we assign it with the setter here. Since this class * is Singleton, all the other classes gets this provider, and since the very first thing the test does on the setup * is to set the driver her, all the rests providers will get this one. *

*/ @Singleton public class AugmentedWebDriverProvider implements AugmentedProvider { private AugmentedWebDriver driver; @Override public AugmentedWebDriver get() { return Preconditions.checkNotNull(driver, "AugmentedWebDriver not initialized, call initialize first"); } @Override public void initialize(AugmentedWebDriver driver) { this.driver = driver; } @Override public boolean isInitialized() { return driver != null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy