[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.testng.Assert; |
---|
| 10 | import org.testng.annotations.Optional; |
---|
| 11 | import org.testng.annotations.Parameters; |
---|
| 12 | import org.testng.annotations.Test; |
---|
| 13 | |
---|
| 14 | /** |
---|
| 15 | * @author L.F.Estivalet (Serpro) |
---|
| 16 | * |
---|
| 17 | * Created on Aug 18, 2011 at 2:52:45 PM |
---|
| 18 | * |
---|
| 19 | */ |
---|
| 20 | public class AceitarCompromissoTestCase extends BaseEmailTestCase { |
---|
| 21 | |
---|
| 22 | @Parameters({ "titulo", "dataInicial", "horaInicial", "minutoInicial" }) |
---|
| 23 | @Test |
---|
| 24 | public void aceitarCompromisso(String titulo, |
---|
| 25 | |
---|
[5025] | 26 | @Optional("") String dataInicial, String horaInicial, String minutoInicial) |
---|
| 27 | throws Exception { |
---|
[4962] | 28 | |
---|
| 29 | Calendar cal = Calendar.getInstance(); |
---|
| 30 | SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/yyyy"); |
---|
| 31 | |
---|
| 32 | // Se a data inicial nao for informada, pega data corrente. |
---|
| 33 | if ("".equals(dataInicial)) { |
---|
| 34 | dataInicial = sdf2.format(cal.getTime()); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | String assunto = "Evento do Calendário - Adicionado: " + dataInicial |
---|
| 38 | + " - " + horaInicial + ":" + minutoInicial + " " + titulo; |
---|
| 39 | |
---|
| 40 | String id = mp.getEmailId(assunto); |
---|
| 41 | AppointmentEmailPage aep = mp.readAppointmentEmail(assunto); |
---|
| 42 | AppointmentStatusPage asp = aep.accept(id); |
---|
[5025] | 43 | System.out.println("antes assert"); |
---|
| 44 | String message = asp.getMessage(); |
---|
| 45 | |
---|
| 46 | System.out.println("depois assert"); |
---|
| 47 | aep = asp.close(); |
---|
| 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 | Assert.assertEquals(message, "O compromisso foi aceito com sucesso!"); |
---|
[4962] | 52 | } |
---|
| 53 | } |
---|