source: devel/testlink/calendar/FUN03.2/src/test/java/br/gov/serpro/cte/agenda/casoteste/Test_EL_942_AdicionarCompromissoComRepeticaoDiaria.java @ 3479

Revision 3479, 4.6 KB checked in by alexandrecorreia, 13 years ago (diff)

Ticket #1394 - Caso de Teste EL-942 ( Adicionar compromisso Com Repeticao Diaria )

Line 
1/**
2 * Autor                        : Alexandre Correia - alexandrecorreia@celepar.pr.gov.br
3 * Data                         : 00/00/0000
4 * Caso de Teste        : EL-942 : Adicionar Compromisso Com Repeticao Diaria
5 *
6 * Descrição do Processo de Teste Cadastro no TestLink - http://testlink.expressolivre.org/
7 *
8 * AÇÕES DO PASSO
9 * P01. Usuário informa um título para o compromisso;
10 * P02. Usuário seleciona opção para repetição diária do compromisso;
11 * P03. Usuário marca opção de data final para a repetição do compromisso;
12 * P04. Usuário seleciona uma data final de repetição do compromisso, essa data deve ser superior a data de início;
13 * P05. Usuário clica na opção para salvar o compromisso;
14 * P06. Sistema salva o compromisso e retorna para a tela da agenda de eventos utilizando a visualização padrão configurada nas preferências do Usuário
15 * P07. Sistema exibe o mesmo compromisso em todos os dias selecionados pelo usuário mostrando o horário inicial e final, o título do compromisso e local e com um ícone especial indicando que se trata de um compromisso recorrente
16 */
17
18package br.gov.serpro.cte.agenda.casoteste;
19
20import java.util.GregorianCalendar;
21
22import org.junit.After;
23import org.junit.Before;
24import org.junit.Test;
25
26import br.gov.serpro.cte.agenda.Objetos.AdicionarCompromissoEL942.*;
27import br.gov.serpro.cte.connection.DAOSelenium;
28import br.gov.serpro.cte.connection.LoginExpresso;
29
30import com.thoughtworks.selenium.SeleneseTestCase;
31
32public class Test_EL_942_AdicionarCompromissoComRepeticaoDiaria extends SeleneseTestCase
33{
34        @Before
35        public void setUp() throws Exception
36        {
37                String url                      = "https://cte.serpro.gov.br";
38                DAOSelenium conn        = new DAOSelenium( "localhost", 4444, "*pifirefox", url);
39                selenium                        = conn.newConnection();
40        }
41        @Test
42        public void testa()
43        {
44                // Logando No Expresso
45                selenium.open("/login.php");
46                selenium.type("user", LoginExpresso.USER_EXPRESSO.getValue());
47                selenium.type("passwd", LoginExpresso.PASSWORD_EXPRESSO.getValue());
48                selenium.click("submitit");
49                selenium.waitForPageToLoad("30000");
50                selenium.click("//html/body/div[@id='toolbar']/table/tbody/tr/td[2]/table/tbody/tr/td[3]/a/img[@id='calendarid']");
51
52                // Data
53                GregorianCalendar gc = new GregorianCalendar();
54                String  Dia = String.valueOf( gc.get( gc.DAY_OF_MONTH ) );
55                                Dia = ( Dia.length() > 1 ) ? Dia : "0"+Dia;
56               
57                String  Mes = String.valueOf( gc.get( gc.MONTH ) + 1 );
58               
59                String  Ano = String.valueOf( gc.get( gc.YEAR ) );
60               
61                //Adicionando um Evento
62                selenium.open("/index.php?date=" + Ano + Mes + Dia + "&menuaction=calendar.uicalendar.week");
63                selenium.click("//img[@title='Nova Entrada']");
64                selenium.waitForPageToLoad("30000");
65               
66                for( Campo cmp : Campo.values() )
67                {
68                        String cmpName = cmp.name();
69                                 
70                        if( cmp.getValue().indexOf("addSelection:") > -1 )
71                        {       
72                                AddSelection( cmp.getValue(), getValor( cmp.name() ) );
73                        }
74                       
75                        if( cmp.getValue().indexOf("click:") > -1 )
76                        {
77                                Click( cmp.getValue() );
78                        }
79                       
80                        if( cmp.getValue().indexOf("select:") > -1 )
81                        {
82                                Select( cmp.getValue(), getValor( cmp.name() ) );
83                        }
84                       
85                        if( cmp.getValue().indexOf("type:") > -1 )
86                        {
87                                Type( cmp.getValue(), getValor( cmp.name() ) );
88                        }
89                }
90               
91                selenium.waitForPageToLoad("15000");
92               
93                // Verifica a hora Inicial e final do Compromisso
94                assertTrue( selenium.isTextPresent(Valor.HORA_INICIO.getValue() + ":" + Valor.MINUTO_INICIO.getValue() +
95                                 "-" + Valor.HORA_FINAL.getValue() + ":" + Valor.MINUTO_FINAL.getValue()));
96
97                // Verifica o Titulo do Compromisso
98                assertTrue( selenium.isTextPresent(Valor.TITULO.getValue()) );
99               
100                // Verifica Local do Compromisso
101                assertTrue( selenium.isTextPresent(Valor.LOCALIZACAO.getValue()) );
102
103                // Verifica ícone de compromisso recorrente
104                assertTrue( selenium.getHtmlSource().contains("/calendar/templates/default/images/recur.png"));
105               
106        }
107       
108        public String getValor(String cmpName)
109        {
110                String _return = "";
111               
112                for( Valor vlr : Valor.values() )
113                {
114                         String vlrName = vlr.name();
115                         
116                         if( vlrName.equals( cmpName ) )
117                         {
118                                 _return = vlr.getValue();
119                         }
120                }
121               
122                return _return;
123        }
124       
125        public void AddSelection( String locator, String optionLocator )
126        {
127                selenium.addSelection( locator.substring( 13 , locator.length() ), optionLocator );
128        }
129       
130        public void Click( String locator )
131        {
132                selenium.click( locator.substring( 6 , locator.length() ) );
133        }
134
135        public void Select( String selectLocator, String optionLocator )
136        {
137                selenium.select( selectLocator.substring( 7 , selectLocator.length() ), optionLocator );
138        }
139
140        public void Type( String locator, String value )
141        {
142                selenium.type( locator.substring( 5 , locator.length() ), value );
143        }
144       
145        @After
146        public void tearDown() throws Exception
147        {
148                selenium.close();
149        }
150}
Note: See TracBrowser for help on using the repository browser.