[4962] | 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:23:45 AM |
---|
| 19 | * |
---|
| 20 | */ |
---|
| 21 | public class MarcarTentativaCompromissoTestCase extends BaseEmailTestCase { |
---|
| 22 | |
---|
| 23 | @Parameters({ "titulo", "dataInicial", "horaInicial", "minutoInicial" }) |
---|
| 24 | @Test |
---|
| 25 | public void marcarTentativaCompromisso(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.tentative(id); |
---|
[5025] | 44 | String message = asp.getMessage(); |
---|
[4962] | 45 | aep = asp.close(); |
---|
| 46 | |
---|
| 47 | // TODO espera um tempo ate a janela popup fechar. Rever essa |
---|
| 48 | // implementacao pois o close acima nao esta funcionando como deveria. |
---|
[5025] | 49 | // super.dummyWait(10); |
---|
[4962] | 50 | |
---|
| 51 | AppointmentViewPage avp = aep.viewAppointment(id); |
---|
[5025] | 52 | Assert.assertEquals(message, "O compromisso foi aceito com sucesso!"); |
---|
[4962] | 53 | } |
---|
| 54 | } |
---|