1 | package org.expressolivre.cte.calendar.visualizar; |
---|
2 | |
---|
3 | import java.text.SimpleDateFormat; |
---|
4 | import java.util.Calendar; |
---|
5 | |
---|
6 | import org.expressolivre.cte.common.BaseEmailTestCase; |
---|
7 | import org.expressolivre.cte.pages.calendar.AppointmentEmailPage; |
---|
8 | import org.expressolivre.cte.pages.calendar.AppointmentStatusPage; |
---|
9 | import org.expressolivre.cte.pages.calendar.AppointmentViewPage; |
---|
10 | import org.testng.Assert; |
---|
11 | import org.testng.annotations.Optional; |
---|
12 | import org.testng.annotations.Parameters; |
---|
13 | import org.testng.annotations.Test; |
---|
14 | |
---|
15 | /** |
---|
16 | * @author L.F.Estivalet (Serpro) |
---|
17 | * |
---|
18 | * Created on Aug 19, 2011 at 11:19:45 AM |
---|
19 | * |
---|
20 | */ |
---|
21 | public class RejeitarCompromissoTestCase extends BaseEmailTestCase { |
---|
22 | |
---|
23 | @Parameters({ "titulo", "dataInicial", "horaInicial", "minutoInicial" }) |
---|
24 | @Test |
---|
25 | public void rejeitarCompromisso(String titulo, |
---|
26 | |
---|
27 | @Optional("") String dataInicial, String horaInicial, String minutoInicial) |
---|
28 | throws Exception { |
---|
29 | |
---|
30 | Calendar cal = Calendar.getInstance(); |
---|
31 | SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/yyyy"); |
---|
32 | |
---|
33 | // Se a data inicial nao for informada, pega data corrente. |
---|
34 | if ("".equals(dataInicial)) { |
---|
35 | dataInicial = sdf2.format(cal.getTime()); |
---|
36 | } |
---|
37 | |
---|
38 | String assunto = "Evento do Calendário - Adicionado: " + dataInicial |
---|
39 | + " - " + horaInicial + ":" + minutoInicial + " " + titulo; |
---|
40 | |
---|
41 | String id = mp.getEmailId(assunto); |
---|
42 | AppointmentEmailPage aep = mp.readAppointmentEmail(assunto); |
---|
43 | AppointmentStatusPage asp = aep.reject(id); |
---|
44 | Assert.assertEquals(asp.getMessage(), |
---|
45 | "O compromisso foi rejeitado com sucesso!"); |
---|
46 | aep = asp.close(); |
---|
47 | |
---|
48 | // TODO espera um tempo ate a janela popup fechar. Rever essa |
---|
49 | // implementacao pois o close acima nao esta funcionando como deveria. |
---|
50 | super.dummyWait(5); |
---|
51 | |
---|
52 | AppointmentViewPage avp = aep.viewAppointment(id); |
---|
53 | System.out.println(avp |
---|
54 | .getAppointmentInfo(AppointmentViewPage.PARTICIPANTS)); |
---|
55 | } |
---|
56 | } |
---|