View Javadoc

1   package com.atlassian.pageobjects.elements.test;
2   
3   import com.atlassian.pageobjects.TestedProductFactory;
4   import com.atlassian.pageobjects.elements.test.pageobjects.SampleTestedProduct;
5   import com.atlassian.webdriver.AtlassianWebDriver;
6   import com.atlassian.webdriver.testing.rule.IgnoreBrowserRule;
7   import com.atlassian.webdriver.testing.rule.WebDriverScreenshotRule;
8   import org.junit.AfterClass;
9   import org.junit.BeforeClass;
10  import org.junit.Rule;
11  
12  public abstract class AbstractFileBasedServerTest 
13  {
14      public static FileBasedServer server;
15      public static String rootUrl;
16      public static AtlassianWebDriver driver;
17      public static SampleTestedProduct product;
18  
19      @Rule public IgnoreBrowserRule ignoreRule = new IgnoreBrowserRule();
20      @Rule public WebDriverScreenshotRule webDriverScreenshotRule = new WebDriverScreenshotRule();
21  
22      @BeforeClass
23      public static void startServer() throws Exception
24      {
25          server = new FileBasedServer();
26          server.startServer();
27          int port = server.getPort();
28  
29          rootUrl = "http://localhost:" + port;
30  
31          System.setProperty("baseurl.testapp", rootUrl);
32          System.setProperty("http.testapp.port", String.valueOf(port));
33          System.setProperty("context.testapp.path", "/");
34  
35          product = TestedProductFactory.create(SampleTestedProduct.class);
36          driver = product.getTester().getDriver();
37      }
38  
39      @AfterClass
40      public static void stopServer() throws Exception
41      {
42          server.stopServer();
43      }
44  }