source: devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/calendar/AppointmentPage.java @ 4890

Revision 4890, 5.9 KB checked in by luiz-fernando, 13 years ago (diff)

Ticket #1771 - Adicionado testes automatizados para modulo da agenda

Line 
1package org.expressolivre.cte.pages.calendar;
2
3import java.util.List;
4
5import org.expressolivre.cte.pages.common.Page;
6import org.openqa.selenium.By;
7import org.openqa.selenium.WebDriver;
8import org.openqa.selenium.WebElement;
9import org.openqa.selenium.support.FindBy;
10
11/**
12 * @author L.F.Estivalet (Serpro)
13 *
14 *         Created on Feb 8, 2011 at 9:19:20 AM
15 *
16 */
17public class AppointmentPage extends Page {
18
19        /** Mensagens de validacao do formulario. */
20        @FindBy(id = "formStatus")
21        private WebElement formStatus;
22
23        /** Tipo do evento. */
24        @FindBy(id = "cal[type]")
25        private WebElement type;
26
27        /** Titulo do evento. */
28        @FindBy(name = "cal[title]")
29        private WebElement title;
30
31        /** Descrição completa do evento. */
32        @FindBy(name = "cal[description]")
33        private WebElement description;
34
35        /** Categorias do evento. */
36        @FindBy(name = "categories[]")
37        private WebElement categories;
38
39        /** Localização do evento. */
40        @FindBy(name = "cal[location]")
41        private WebElement location;
42
43        /** Data inicial do evento. */
44        @FindBy(name = "start[str]")
45        private WebElement startDate;
46
47        /** Hora inicial do evento. */
48        @FindBy(id = "start_hour")
49        private WebElement startHour;
50
51        /** Minuto inicial do evento; */
52        @FindBy(id = "start_minute")
53        private WebElement startMinute;
54
55        /** Data final do evento. */
56        @FindBy(name = "end[str]")
57        private WebElement endDate;
58
59        /** Hora final do evento. */
60        @FindBy(id = "end_hour")
61        private WebElement endHour;
62
63        /** Minuto final do evento; */
64        @FindBy(id = "end_minute")
65        private WebElement endMinute;
66
67        /** Prioridade do evento. */
68        @FindBy(name = "cal[priority]")
69        private WebElement priority;
70
71        /** Alarme dia. */
72        @FindBy(name = "cal[alarmdays]")
73        private WebElement alarmDays;
74
75        /** Alarme hora. */
76        @FindBy(name = "cal[alarmhours]")
77        private WebElement alarmHours;
78
79        /** Alarme minuto. */
80        @FindBy(name = "cal[alarmminutes]")
81        private WebElement alarmMinutes;
82
83        /** Tipo recursao. */
84        @FindBy(name = "cal[recur_type]")
85        private WebElement recurType;
86
87        @FindBy(name = "cal[rpt_use_end]")
88        private WebElement rptUseEnd;
89
90        @FindBy(name = "recur_enddate[str]")
91        private WebElement recurEndDate;
92
93        @FindBy(name = "cal[recur_interval]")
94        private WebElement recurInterval;
95
96        /** Observacao. */
97        @FindBy(name = "cal[#Observação]")
98        private WebElement notes;
99
100        /** Salvar. */
101        @FindBy(id = "submit_button")
102        private WebElement save;
103
104        public AppointmentPage(WebDriver driver) {
105                super(driver);
106                // TODO Auto-generated constructor stub
107        }
108
109        /**
110         * @return Retorna o texto de validacao do formulario.
111         */
112        public String getFormStatus() {
113                return this.formStatus.getText();
114        }
115
116        /**
117         * @param type
118         *            the type to set
119         */
120        public void setType(String type) {
121                super.setComboValue(this.type, type);
122        }
123
124        /**
125         * @param title
126         *            the title to set
127         */
128        public void setTitle(String title) {
129                this.title.sendKeys(title);
130        }
131
132        /**
133         * @param description
134         *            the description to set
135         */
136        public void setDescription(String description) {
137                this.description.sendKeys(description);
138        }
139
140        /**
141         * @param categories
142         *            the categories to set
143         */
144        public void setCategories(String categories) {
145                this.categories.sendKeys(categories);
146        }
147
148        /**
149         * @param location
150         *            the location to set
151         */
152        public void setLocation(String location) {
153                this.location.sendKeys(location);
154        }
155
156        /**
157         * @param startDate
158         *            the start to set
159         */
160        public void setStartDate(String startDate) {
161                this.startDate.clear();
162                this.startDate.sendKeys(startDate);
163        }
164
165        /**
166         * @param startHour
167         *            the startHour to set
168         */
169        public void setStartHour(String startHour) {
170                this.startHour.clear();
171                this.startHour.sendKeys(startHour);
172        }
173
174        /**
175         * @param startMinute
176         *            the startMinute to set
177         */
178        public void setStartMinute(String startMinute) {
179                this.startMinute.clear();
180                this.startMinute.sendKeys(startMinute);
181        }
182
183        /**
184         * @param endDate
185         *            the end to set
186         */
187        public void setEndDate(String endDate) {
188                this.endDate.clear();
189                this.endDate.sendKeys(endDate);
190        }
191
192        /**
193         * @param endHour
194         *            the endHour to set
195         */
196        public void setEndHour(String endHour) {
197                this.endHour.clear();
198                this.endHour.sendKeys(endHour);
199        }
200
201        /**
202         * @param endMinute
203         *            the endMinute to set
204         */
205        public void setEndMinute(String endMinute) {
206                this.endMinute.clear();
207                this.endMinute.sendKeys(endMinute);
208        }
209
210        /**
211         * @param priority
212         *            the priority to set
213         */
214        public void setPriority(String priority) {
215                super.setComboValue(this.priority, priority);
216        }
217
218        /**
219         * @param notes
220         *            the notes to set
221         */
222        public void setNotes(String notes) {
223                this.notes.sendKeys(notes);
224        }
225
226        /**
227         * @param alarmDays
228         *            the alarmDays to set
229         */
230        public void setAlarmDays(String alarmDays) {
231                super.setComboValue(this.alarmDays, alarmDays);
232        }
233
234        /**
235         * @param alarmHours
236         *            the alarmHours to set
237         */
238        public void setAlarmHours(String alarmHours) {
239                super.setComboValue(this.alarmHours, alarmHours);
240        }
241
242        /**
243         * @param alarmMinutes
244         *            the alarmMinutes to set
245         */
246        public void setAlarmMinutes(String alarmMinutes) {
247                super.setComboValue(this.alarmMinutes, alarmMinutes);
248        }
249
250        /**
251         * @param recurType
252         *            the recurType to set
253         */
254        public void setRecurType(String recurType) {
255                super.setComboValue(this.recurType, recurType);
256        }
257
258        public void setRptUseEnd(String finalDate) {
259                this.rptUseEnd.click();
260                this.recurEndDate.clear();
261                this.recurEndDate.sendKeys(finalDate);
262        }
263
264        /**
265         * Valores para os dias da semana:
266         *
267         * <pre>
268         * 1 - Domingo
269         * 2 - Segunda
270         * 4 - Terça
271         * 8 - Quarta
272         * 16 - Quinta
273         * 32 - Sexta
274         * 64 - Sabado
275         * </pre>
276         *
277         * @param values
278         */
279        public void setRecurDays(List<String> values) {
280                List<WebElement> elements = driver.findElements(By
281                                .name("cal[rpt_day][]"));
282
283                for (WebElement e : elements) {
284                        if (values.contains(e.getValue())) {
285                                e.click();
286                        }
287                }
288        }
289
290        public void saveAppointment() {
291                this.save.click();
292        }
293}
Note: See TracBrowser for help on using the repository browser.