1 | package org.expressolivre.cte.calendar.pesquisar; |
---|
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.AppointmentSearchResultPage; |
---|
8 | import org.expressolivre.cte.pages.calendar.AppointmentViewPage; |
---|
9 | import org.testng.Assert; |
---|
10 | import org.testng.annotations.Parameters; |
---|
11 | import org.testng.annotations.Test; |
---|
12 | |
---|
13 | /** |
---|
14 | * Caso de Teste: EL-1266:Pesquisar pelo titulo e apagar um compromisso |
---|
15 | * |
---|
16 | * Link: http://testlink.expressolivre.org/linkto.php?tprojectPrefix=EL&item= |
---|
17 | * testcase&id=EL-1266 |
---|
18 | * |
---|
19 | * @author L.F.Estivalet (Serpro) |
---|
20 | * |
---|
21 | * Created on Aug 3, 2011 at 10:15:36 AM |
---|
22 | * |
---|
23 | */ |
---|
24 | public class PesquisarCompromissoPeloTituloEApagarTestCase extends |
---|
25 | BaseCalendarTestCase { |
---|
26 | |
---|
27 | /** |
---|
28 | * Pesquisa um compromisso que exista na agenda. |
---|
29 | * |
---|
30 | * @param titulo |
---|
31 | * Titulo a ser pesquisado. |
---|
32 | */ |
---|
33 | @Parameters({ "titulo", "descricao", "local", "horaInicio", "horaFim" }) |
---|
34 | @Test |
---|
35 | public void pesquisarCompromissoPeloTituloEApagar(String titulo, |
---|
36 | String descricao, String local, String horaInicio, String horaFim) { |
---|
37 | cp.setSearchText(titulo); |
---|
38 | AppointmentSearchResultPage asrp = cp.searchAppointment(); |
---|
39 | Assert.assertEquals(asrp.getResultsNumber(), "1 ocorrência encontrada."); |
---|
40 | |
---|
41 | Calendar cal = Calendar.getInstance(); |
---|
42 | SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/yyyy"); |
---|
43 | String data = sdf2.format(cal.getTime()); |
---|
44 | |
---|
45 | Assert.assertEquals(asrp.getAppointmentSchedule(1), data + " - " |
---|
46 | + horaInicio); |
---|
47 | String fullDescription = horaInicio + "-" + horaFim + " (A)\n" + titulo |
---|
48 | + "\n" + descricao + "\nLocal: " + local; |
---|
49 | Assert.assertEquals(asrp.getAppointmentDescription(1), fullDescription); |
---|
50 | |
---|
51 | AppointmentViewPage avp = asrp.viewAppointment(1); |
---|
52 | avp.removeAppointment(); |
---|
53 | } |
---|
54 | |
---|
55 | @Parameters({ "titulo", "descricao", "local", "data", "horaInicio", |
---|
56 | "horaFim" }) |
---|
57 | @Test |
---|
58 | public void pesquisarCompromissoPeloTituloEDataApagar(String titulo, |
---|
59 | String descricao, String local, String data, String horaInicio, |
---|
60 | String horaFim) { |
---|
61 | cp.setSearchText(titulo); |
---|
62 | AppointmentSearchResultPage asrp = cp.searchAppointment(); |
---|
63 | Assert.assertEquals(asrp.getResultsNumber(), "1 ocorrência encontrada."); |
---|
64 | |
---|
65 | Assert.assertEquals(asrp.getAppointmentSchedule(1), data + " - " |
---|
66 | + horaInicio); |
---|
67 | String fullDescription = horaInicio + "-" + horaFim + " (A)\n" + titulo |
---|
68 | + "\n" + descricao + "\nLocal: " + local; |
---|
69 | Assert.assertEquals(asrp.getAppointmentDescription(1), fullDescription); |
---|
70 | |
---|
71 | AppointmentViewPage avp = asrp.viewAppointment(1); |
---|
72 | avp.removeAppointment(); |
---|
73 | } |
---|
74 | |
---|
75 | } |
---|