source: devel/testlink/automation2.0/src/test/java/br/gov/serpro/expresso/cte/common/BaseTestCase.java @ 3708

Revision 3708, 1.4 KB checked in by luiz-fernando, 13 years ago (diff)

Ticket #1402 - Novos casos de teste implementados usando WebDriver?

Line 
1package br.gov.serpro.expresso.cte.common;
2
3import org.openqa.selenium.WebDriver;
4import org.openqa.selenium.firefox.FirefoxDriver;
5import org.openqa.selenium.support.PageFactory;
6import org.testng.annotations.AfterClass;
7import org.testng.annotations.BeforeClass;
8
9import 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 */
17public 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.