com.atlassian.webdriver.testing.rule
Class WindowSizeRule
java.lang.Object
org.junit.rules.TestWatcher
com.atlassian.webdriver.testing.rule.WindowSizeRule
- All Implemented Interfaces:
- org.junit.rules.TestRule
public class WindowSizeRule
- extends org.junit.rules.TestWatcher
Implements support for the WindowSize annotation.
If this rule is used in a test and the WindowSize annotation is
not present on either the test method, or the test class, the window will be maximized by default.
Otherwise the directives present on the annotation found (with method-level annotation superseding the class-level
one) will be applied to the current driver's window in a following manner:
- if the maximize flag is set to
true, the window will be maximized
- otherwise the properties height and width will be used to set the window size. In such
case those properties must have positive integer value, or an exception will be raised
Example:
public class MyWebDriverTest
{
@Rule public WindowSizeRule windowSizeRule = //...
@Test
public void myTest()
{
// at this stage the window will be maximized
}
}
public class MyWebDriverTest
{
@Rule public WindowSizeRule windowSizeRule = //...
@Test
@WindowSize(width=1024,height=768)
public void myTest()
{
// at this stage the window will be set to 1024x768
}
}
- Since:
- 2.1
|
Method Summary |
protected void |
starting(org.junit.runner.Description description)
|
| Methods inherited from class org.junit.rules.TestWatcher |
apply, failed, finished, skipped, succeeded |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WindowSizeRule
@Inject
public WindowSizeRule(org.openqa.selenium.WebDriver webDriver)
WindowSizeRule
public WindowSizeRule(com.google.common.base.Supplier<? extends org.openqa.selenium.WebDriver> driverSupplier)
WindowSizeRule
public WindowSizeRule()
starting
protected void starting(org.junit.runner.Description description)
- Overrides:
starting in class org.junit.rules.TestWatcher
Copyright © 2014 Atlassian. All rights reserved.