;
; Simulates @RunLocally with the given value on all test classes without a @RunLocally annotation.
+; Use simple browser name (phantomjs, chrome, firefox, ie8, ie9, ie10, ie11)
; com.vaadin.testbench.runLocally=firefox
+; By default using @RunLocally annotation in Framework tests is not allowed.
+; Running tests locally can be done with com.vaadin.testbench.runLocally parameter above.
+; Uncomment the following line if you want to be able to use @RunLocally annotation
+; com.vaadin.testbench.allowRunLocally=true
;
; For only TestBench 2
import java.util.Enumeration;
import java.util.Properties;
+import org.junit.Assert;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.annotations.BrowserFactory;
+import com.vaadin.testbench.annotations.RunLocally;
import com.vaadin.testbench.annotations.RunOnHub;
import com.vaadin.testbench.parallel.Browser;
*
*/
public static final String SCREENSHOT_DIRECTORY = "com.vaadin.testbench.screenshot.directory";
- private static final String RUN_LOCALLY_PROPERTY = "com.vaadin.testbench.runLocally";
private static final String HOSTNAME_PROPERTY = "com.vaadin.testbench.deployment.hostname";
+ private static final String RUN_LOCALLY_PROPERTY = "com.vaadin.testbench.runLocally";
+ private static final String ALLOW_RUN_LOCALLY_PROPERTY = "com.vaadin.testbench.allowRunLocally";
private static final String PORT_PROPERTY = "com.vaadin.testbench.deployment.port";
private static final String DEPLOYMENT_PROPERTY = "com.vaadin.testbench.deployment.url";
private static final String HUB_URL = "com.vaadin.testbench.hub.url";
}
}
+ @Override
+ public void setup() throws Exception {
+ String allowRunLocally = getProperty(ALLOW_RUN_LOCALLY_PROPERTY);
+ if ((allowRunLocally == null || !allowRunLocally.equals("" + true))
+ && getClass().getAnnotation(RunLocally.class) != null) {
+ Assert.fail("@RunLocally annotation is not allowed by default in framework tests. "
+ + "See file uitest/eclipse-run-selected-test.properties for more information.");
+ }
+
+ super.setup();
+ }
+
private static DesiredCapabilities getRunLocallyCapabilities() {
Browser localBrowser;
try {
*/
@After
public void checkCompareFailures() throws IOException {
- if (!screenshotFailures.isEmpty()) {
+ if (screenshotFailures != null && !screenshotFailures.isEmpty()) {
throw new IOException(
"The following screenshots did not match the reference: "
+ screenshotFailures.toString());