[5099] | 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.BaseCalendarTestCase; |
---|
| 7 | import org.expressolivre.cte.pages.calendar.AppointmentViewPage; |
---|
| 8 | import org.expressolivre.cte.pages.calendar.CalendarTodayViewPage; |
---|
| 9 | import org.openqa.selenium.WebElement; |
---|
| 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 | * Caso de Teste: EL-1274:Exibir compromisso sem repeticao |
---|
| 17 | * |
---|
| 18 | * Link: http://testlink.expressolivre.org/linkto.php?tprojectPrefix=EL&item= |
---|
| 19 | * testcase&id=EL-1274 |
---|
| 20 | * |
---|
| 21 | * @author L.F.Estivalet (Serpro) |
---|
| 22 | * |
---|
| 23 | * Created on Set 6, 2011 at 4:12:43 PM |
---|
| 24 | * |
---|
| 25 | */ |
---|
| 26 | public class ExibirCompromissoSemRepeticaoTestCase extends BaseCalendarTestCase { |
---|
| 27 | |
---|
| 28 | @Parameters({ "tipo", "titulo", "descricao", "local", "dataInicial", |
---|
| 29 | "horaInicial", "minutoInicial", "dataFinal", "horaFinal", |
---|
| 30 | "minutoFinal", "prioridade" }) |
---|
| 31 | @Test |
---|
| 32 | public void exibirCompromissoSemRepeticao(@Optional("Normal") String tipo, |
---|
| 33 | String titulo, @Optional("") String descricao, |
---|
| 34 | @Optional("") String local, @Optional("") String dataInicial, |
---|
| 35 | String horaInicial, String minutoInicial, |
---|
| 36 | @Optional("") String dataFinal, String horaFinal, |
---|
| 37 | String minutoFinal, @Optional("Normal") String prioridade) { |
---|
| 38 | |
---|
| 39 | // Vai para visao diaria e pega o id do compromisso. |
---|
| 40 | CalendarTodayViewPage ctvp = super.openTodayView(); |
---|
| 41 | String id = ctvp.getAppointmentId(titulo); |
---|
| 42 | |
---|
| 43 | // Verifica se horario inicial esta aparecendo na lista. |
---|
| 44 | boolean foundTime = ctvp.isStartTimePresent(horaInicial + ":" |
---|
| 45 | + minutoInicial); |
---|
| 46 | |
---|
| 47 | // Procura o compromisso. |
---|
| 48 | WebElement e = ctvp.findAppointment(horaInicial + ":" + minutoInicial |
---|
| 49 | + " " + horaFinal + ":" + minutoFinal + " - " + titulo); |
---|
| 50 | boolean single = ctvp.isSingle(e); |
---|
| 51 | |
---|
| 52 | // Abre a pagina do compromisso e recupera as informacoes. |
---|
| 53 | AppointmentViewPage avp = cp.openAppointmentViewPage(id); |
---|
| 54 | String title = avp.getTitle(); |
---|
| 55 | String start = avp.getAppointmentInfo(AppointmentViewPage.START); |
---|
| 56 | String end = avp.getAppointmentInfo(AppointmentViewPage.END); |
---|
| 57 | String priority = avp.getAppointmentInfo(AppointmentViewPage.PRIORITY); |
---|
| 58 | String attachments = avp |
---|
| 59 | .getAppointmentInfo(AppointmentViewPage.ATTACHMENTS); |
---|
| 60 | avp.ready(); |
---|
| 61 | |
---|
| 62 | // Verifica que esta tudo de acordo. |
---|
| 63 | Calendar cal = Calendar.getInstance(); |
---|
| 64 | SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); |
---|
| 65 | String today = sdf.format(cal.getTime()); |
---|
| 66 | // Verifica se o horario aparece. |
---|
| 67 | Assert.assertTrue(foundTime); |
---|
| 68 | // Verifica se o compromisso eh individual. |
---|
| 69 | Assert.assertTrue(single); |
---|
| 70 | // Verifica o titulo na pagina de exibicao dos detalhes do compromisso. |
---|
| 71 | Assert.assertEquals(title, titulo); |
---|
| 72 | // Verifica hora inicial na pagina de exibicao dos detalhes do |
---|
| 73 | // compromisso. |
---|
| 74 | Assert.assertEquals(start, today + " - " + horaInicial + ":" |
---|
| 75 | + minutoInicial); |
---|
| 76 | // Verifica hora final na pagina de exibicao dos detalhes do |
---|
| 77 | // compromisso. |
---|
| 78 | Assert.assertEquals(end, today + " - " + horaFinal + ":" + minutoFinal); |
---|
| 79 | // Verifica prioridade na pagina de exibicao dos detalhes do |
---|
| 80 | // compromisso. |
---|
| 81 | Assert.assertEquals(priority, prioridade); |
---|
| 82 | // Verifica anexos na pagina de exibicao dos detalhes do compromisso. |
---|
| 83 | Assert.assertEquals(attachments, "Não há anexos"); |
---|
| 84 | |
---|
| 85 | } |
---|
| 86 | } |
---|