com.atlassian.webdriver.testing.rule
Class WindowSizeRule

java.lang.Object
  extended by org.junit.rules.TestWatcher
      extended by 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:

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

Constructor Summary
WindowSizeRule()
           
WindowSizeRule(com.google.common.base.Supplier<? extends org.openqa.selenium.WebDriver> driverSupplier)
           
WindowSizeRule(org.openqa.selenium.WebDriver webDriver)
           
 
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
 

Constructor Detail

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()
Method Detail

starting

protected void starting(org.junit.runner.Description description)
Overrides:
starting in class org.junit.rules.TestWatcher


Copyright © 2014 Atlassian. All rights reserved.