Line | |
---|
1 | package br.gov.serpro.expresso.cte.common; |
---|
2 | |
---|
3 | import org.openqa.selenium.WebDriver; |
---|
4 | import org.openqa.selenium.firefox.FirefoxDriver; |
---|
5 | import org.openqa.selenium.support.PageFactory; |
---|
6 | import org.testng.annotations.AfterClass; |
---|
7 | import org.testng.annotations.BeforeClass; |
---|
8 | |
---|
9 | import br.gov.serpro.expresso.cte.pages.email.LoginPage; |
---|
10 | |
---|
11 | /** |
---|
12 | * @author L.F.Estivalet (Serpro) |
---|
13 | * |
---|
14 | * Created on Jan 4, 2011 at 3:53:19 PM |
---|
15 | * |
---|
16 | */ |
---|
17 | public class BaseTestCase implements Constants { |
---|
18 | protected WebDriver driver; |
---|
19 | |
---|
20 | @BeforeClass |
---|
21 | public void beforeClass() { |
---|
22 | driver = new FirefoxDriver(); |
---|
23 | driver.get(URL); |
---|
24 | } |
---|
25 | |
---|
26 | public void login() { |
---|
27 | LoginPage page = PageFactory.initElements(driver, LoginPage.class); |
---|
28 | page.login(USER, PASS); |
---|
29 | } |
---|
30 | |
---|
31 | @AfterClass |
---|
32 | public void afterClass() { |
---|
33 | driver.close(); |
---|
34 | } |
---|
35 | |
---|
36 | /** |
---|
37 | * TODO Rever esse metodo. Foi o unico jeito que consegui fazer pegar o |
---|
38 | * numero total de mensagens importantes. O metodo apenas aguarda 5 segundos |
---|
39 | * antes de continuar a execucao. |
---|
40 | * |
---|
41 | * @throws Exception |
---|
42 | * |
---|
43 | * @see br.gov.serpro.cte.email.listar.ListarEmailsImportantesTestCase |
---|
44 | */ |
---|
45 | public void dummyWait() throws Exception { |
---|
46 | dummyWait(5); |
---|
47 | } |
---|
48 | |
---|
49 | /** |
---|
50 | * @param seconds |
---|
51 | * @throws Exception |
---|
52 | */ |
---|
53 | public void dummyWait(int seconds) throws Exception { |
---|
54 | for (int second = 0;; second++) { |
---|
55 | if (second >= seconds) { |
---|
56 | System.out.println("timeout"); |
---|
57 | return; |
---|
58 | } |
---|
59 | Thread.sleep(1000); |
---|
60 | } |
---|
61 | |
---|
62 | } |
---|
63 | |
---|
64 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.