1 | /** |
---|
2 | * Autor : Alexandre Correia - alexandrecorreia@celepar.pr.gov.br |
---|
3 | * Data : 00/00/0000 |
---|
4 | * Caso de Teste : EL-938:Adicionar compromisso |
---|
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 entra com o nome de um participante do compromisso; |
---|
11 | ***** P03. Sistema apresenta participantes encontrados para escolha; |
---|
12 | ***** P04. Usuário seleciona participante e o adiciona ao grupo de participantes do compromisso; |
---|
13 | ***** P05. Sistema atualiza lista de participantes do compromisso; |
---|
14 | ***** P06. Usuário retorna ao passo P02 para adicionar novos participantes. Depois de adicionar no mínimo 2 participantes passar ao próximo passo; |
---|
15 | * P07. Usuário seleciona opção para adicionar participantes externos ao compromisso; |
---|
16 | * P08. Sistema apresenta campo para entrar e-mails de participantes externos; |
---|
17 | * P09. Usuário informa e-mails válidos dos participantes, separados por vírgula; |
---|
18 | * P10. Usuário clica na opção para salvar o compromisso; |
---|
19 | * P11. 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 |
---|
20 | * P12. Sistema exibe o compromisso no dia selecionado pelo usuário mostrando o horário inicial e final, o título do compromisso e local |
---|
21 | * P13. Sistema envia uma mensagem aos participantes do compromisso informando a data e local do compromisso; |
---|
22 | **/ |
---|
23 | |
---|
24 | package br.gov.serpro.cte.agenda.casoteste; |
---|
25 | |
---|
26 | import java.util.GregorianCalendar; |
---|
27 | |
---|
28 | import org.junit.After; |
---|
29 | import org.junit.Before; |
---|
30 | import org.junit.Test; |
---|
31 | |
---|
32 | import br.gov.serpro.cte.agenda.Objetos.AdicionarCompromissoEL951.Campo; |
---|
33 | import br.gov.serpro.cte.agenda.Objetos.AdicionarCompromissoEL951.Valor; |
---|
34 | import br.gov.serpro.cte.connection.DAOSelenium; |
---|
35 | import br.gov.serpro.cte.connection.LoginExpresso; |
---|
36 | |
---|
37 | import com.thoughtworks.selenium.SeleneseTestCase; |
---|
38 | |
---|
39 | public class Test_EL_951_AdicionarCompromissoComParticipantesExternos extends SeleneseTestCase |
---|
40 | { |
---|
41 | @Before |
---|
42 | public void setUp() throws Exception |
---|
43 | { |
---|
44 | String url = "https://cte.serpro.gov.br"; |
---|
45 | DAOSelenium conn = new DAOSelenium( "localhost", 4444, "*pifirefox", url); |
---|
46 | selenium = conn.newConnection(); |
---|
47 | } |
---|
48 | @Test |
---|
49 | public void testa() |
---|
50 | { |
---|
51 | // Logando No Expresso |
---|
52 | selenium.open("/login.php"); |
---|
53 | selenium.type("user", LoginExpresso.USER_EXPRESSO.getValue()); |
---|
54 | selenium.type("passwd", LoginExpresso.PASSWORD_EXPRESSO.getValue()); |
---|
55 | selenium.click("submitit"); |
---|
56 | selenium.waitForPageToLoad("30000"); |
---|
57 | selenium.click("//html/body/div[@id='toolbar']/table/tbody/tr/td[2]/table/tbody/tr/td[3]/a/img[@id='calendarid']"); |
---|
58 | |
---|
59 | // Data |
---|
60 | GregorianCalendar gc = new GregorianCalendar(); |
---|
61 | String Dia = String.valueOf( gc.get( gc.DAY_OF_MONTH ) ); |
---|
62 | Dia = ( Dia.length() > 1 ) ? Dia : "0"+Dia; |
---|
63 | |
---|
64 | String Mes = String.valueOf( gc.get( gc.MONTH ) + 1 ); |
---|
65 | |
---|
66 | String Ano = String.valueOf( gc.get( gc.YEAR ) ); |
---|
67 | |
---|
68 | //Adicionando um Evento |
---|
69 | selenium.open("/index.php?date=" + Ano + Mes + Dia + "&menuaction=calendar.uicalendar.week"); |
---|
70 | selenium.click("//img[@title='Nova Entrada']"); |
---|
71 | selenium.waitForPageToLoad("30000"); |
---|
72 | |
---|
73 | for( Campo cmp : Campo.values() ) |
---|
74 | { |
---|
75 | String cmpName = cmp.name(); |
---|
76 | |
---|
77 | if( cmp.getValue().indexOf("addSelection:") > -1 ) |
---|
78 | { |
---|
79 | AddSelection( cmp.getValue(), getValor( cmp.name() ) ); |
---|
80 | } |
---|
81 | |
---|
82 | if( cmp.getValue().indexOf("click:") > -1 ) |
---|
83 | { |
---|
84 | Click( cmp.getValue() ); |
---|
85 | } |
---|
86 | |
---|
87 | if( cmp.getValue().indexOf("select:") > -1 ) |
---|
88 | { |
---|
89 | Select( cmp.getValue(), getValor( cmp.name() ) ); |
---|
90 | } |
---|
91 | |
---|
92 | if( cmp.getValue().indexOf("type:") > -1 ) |
---|
93 | { |
---|
94 | Type( cmp.getValue(), getValor( cmp.name() ) ); |
---|
95 | } |
---|
96 | } |
---|
97 | |
---|
98 | selenium.waitForPageToLoad("15000"); |
---|
99 | |
---|
100 | // Volta a Página Inicial do Módulo |
---|
101 | assertTrue(selenium.getHtmlSource().contains("<div id=\"divAppboxHeader\">Agenda de Eventos</div>")); |
---|
102 | |
---|
103 | // Verifica a hora Inicial e final do Compromisso |
---|
104 | assertTrue( selenium.isTextPresent(Valor.HORA_INICIO.getValue() + ":" + Valor.MINUTO_INICIO.getValue() + |
---|
105 | "-" + Valor.HORA_FINAL.getValue() + ":" + Valor.MINUTO_FINAL.getValue())); |
---|
106 | |
---|
107 | // Verifica o Titulo do Compromisso |
---|
108 | assertTrue( selenium.isTextPresent(Valor.TITULO.getValue()) ); |
---|
109 | |
---|
110 | // Verifica Local do Compromisso |
---|
111 | assertTrue( selenium.isTextPresent(Valor.LOCALIZACAO.getValue()) ); |
---|
112 | |
---|
113 | } |
---|
114 | |
---|
115 | public String getValor(String cmpName) |
---|
116 | { |
---|
117 | String _return = ""; |
---|
118 | |
---|
119 | for( Valor vlr : Valor.values() ) |
---|
120 | { |
---|
121 | String vlrName = vlr.name(); |
---|
122 | |
---|
123 | if( vlrName.equals( cmpName ) ) |
---|
124 | { |
---|
125 | _return = vlr.getValue(); |
---|
126 | } |
---|
127 | } |
---|
128 | |
---|
129 | return _return; |
---|
130 | } |
---|
131 | |
---|
132 | public void AddSelection( String locator, String optionLocator ) |
---|
133 | { |
---|
134 | selenium.addSelection( locator.substring( 13 , locator.length() ), optionLocator ); |
---|
135 | } |
---|
136 | |
---|
137 | public void Click( String locator ) |
---|
138 | { |
---|
139 | selenium.click( locator.substring( 6 , locator.length() ) ); |
---|
140 | } |
---|
141 | |
---|
142 | public void Select( String selectLocator, String optionLocator ) |
---|
143 | { |
---|
144 | selenium.select( selectLocator.substring( 7 , selectLocator.length() ), optionLocator ); |
---|
145 | } |
---|
146 | |
---|
147 | public void Type( String locator, String value ) |
---|
148 | { |
---|
149 | selenium.type( locator.substring( 5 , locator.length() ), value ); |
---|
150 | } |
---|
151 | |
---|
152 | @After |
---|
153 | public void tearDown() throws Exception |
---|
154 | { |
---|
155 | selenium.close(); |
---|
156 | } |
---|
157 | } |
---|