Skip to content

Commit

Permalink
Implementing ability to run only tests that need local environment. F…
Browse files Browse the repository at this point in the history
…ixes issue 2884
  • Loading branch information
barancev committed Nov 9, 2014
1 parent 42d2e2c commit cd74512
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.openqa.selenium.environment.webserver.AppServer;
import org.openqa.selenium.internal.WrapsDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.Wait;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.testing.drivers.WebDriverBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,17 @@ private static Platform getEffectivePlatform() {
}

private boolean isIgnoredDueToBeingOnSauce(FrameworkMethod method, Object test) {
return SauceDriver.shouldUseSauce() &&
(method.getMethod().getAnnotation(NeedsLocalEnvironment.class) != null ||
test.getClass().getAnnotation(NeedsLocalEnvironment.class) != null);
boolean isLocal = method.getMethod().getAnnotation(NeedsLocalEnvironment.class) != null
|| test.getClass().getAnnotation(NeedsLocalEnvironment.class) != null;
if (SauceDriver.shouldUseSauce()) {
return isLocal;
} else {
return Boolean.getBoolean("local_only") && !isLocal;
}
}

private boolean isIgnoredDueToJavascript(JavascriptEnabled enabled) {
return enabled != null && !browser.isJavascriptEnabled();

}

private boolean isIgnoredDueToEnvironmentVariables(FrameworkMethod method, Object test) {
Expand Down
9 changes: 9 additions & 0 deletions rake-tasks/crazy_fun/mappings/java.rb
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ def handle(fun, dir, args)
ant.sysproperty :key => 'ignored_only', :value => 'true'
end

if local_only?
ant.sysproperty :key => 'local_only', :value => 'true'
end

# Log levels can be any of {'DEBUG', 'INFO', 'WARNING', 'ERROR'}
levels = Array.[]("INFO", "DEBUG", "WARNING", "ERROR")
if log_level
Expand Down Expand Up @@ -651,6 +655,11 @@ def ignored_only?
!([nil, 'false'].include? ENV['ignoredonly'])
end

def local_only?
# we set local_only true if the commandline argument is set and it is not 'false'
!([nil, 'false'].include? ENV['localonly'])
end

def leave_running?
# we set leaverunning true if the commandline argument is set and it is not 'false'
!([nil, 'false'].include? ENV['leaverunning'])
Expand Down

0 comments on commit cd74512

Please sign in to comment.