1 | package org.expressolivre.cte.pages.email; |
---|
2 | |
---|
3 | import org.expressolivre.cte.pages.common.Page; |
---|
4 | import org.openqa.selenium.By; |
---|
5 | import org.openqa.selenium.WebDriver; |
---|
6 | import org.openqa.selenium.WebElement; |
---|
7 | import org.openqa.selenium.support.FindBy; |
---|
8 | |
---|
9 | /** |
---|
10 | * Pagina de administracao de filtros. |
---|
11 | * |
---|
12 | * @author L.F.Estivalet (Serpro) |
---|
13 | * |
---|
14 | * Created on Jun 16, 2011 at 3:47:18 PM |
---|
15 | * |
---|
16 | */ |
---|
17 | public class MailFilterPage extends Page { |
---|
18 | |
---|
19 | @FindBy(xpath = "//div[@id='window_ffilter_ccform']/div[@id='form_body']/a[1]") |
---|
20 | private WebElement filterNewRule; |
---|
21 | |
---|
22 | @FindBy(xpath = "//div[@id='window_ffilter_ccform']/div[@id='form_body']/a[2]") |
---|
23 | private WebElement filterNewOutOfOfficeRule; |
---|
24 | |
---|
25 | @FindBy(id = "field8") |
---|
26 | private WebElement filterOutOfOfficeText; |
---|
27 | |
---|
28 | @FindBy(xpath = "//div[@id='window_ffilter_ccform']/div[@id='form_body']/span[2]/input") |
---|
29 | private WebElement filterSaveRules; |
---|
30 | |
---|
31 | @FindBy(id = "field1") |
---|
32 | private WebElement filterRecepient; |
---|
33 | |
---|
34 | @FindBy(id = "field2") |
---|
35 | private WebElement filterTo; |
---|
36 | |
---|
37 | @FindBy(id = "field3") |
---|
38 | private WebElement filterSubject; |
---|
39 | |
---|
40 | @FindBy(id = "field4") |
---|
41 | private WebElement filterSize; |
---|
42 | |
---|
43 | @FindBy(id = "select_size") |
---|
44 | private WebElement filterSelectSize; |
---|
45 | |
---|
46 | @FindBy(id = "radio1") |
---|
47 | private WebElement filterArchieveIn; |
---|
48 | |
---|
49 | @FindBy(id = "select_mailboxes") |
---|
50 | private WebElement filterMailBoxes; |
---|
51 | |
---|
52 | @FindBy(id = "radio2") |
---|
53 | private WebElement filterForwardMessage; |
---|
54 | |
---|
55 | @FindBy(id = "radio3") |
---|
56 | private WebElement filterRejectMessage; |
---|
57 | |
---|
58 | @FindBy(id = "field6") |
---|
59 | private WebElement filterRejectMessageText; |
---|
60 | |
---|
61 | @FindBy(id = "radio4") |
---|
62 | private WebElement filterDeleteMessage; |
---|
63 | |
---|
64 | @FindBy(id = "radio5") |
---|
65 | private WebElement filterApplyImportantFilter; |
---|
66 | |
---|
67 | public MailFilterPage(WebDriver driver) { |
---|
68 | super(driver); |
---|
69 | } |
---|
70 | |
---|
71 | public void newFilterRule() { |
---|
72 | this.filterNewRule.click(); |
---|
73 | } |
---|
74 | |
---|
75 | public void newFilterOutOfOfficeRule() { |
---|
76 | this.filterNewOutOfOfficeRule.click(); |
---|
77 | } |
---|
78 | |
---|
79 | public void setFilterOutOfOfficeText(String text) { |
---|
80 | this.filterOutOfOfficeText.clear(); |
---|
81 | this.filterOutOfOfficeText.sendKeys(text); |
---|
82 | } |
---|
83 | |
---|
84 | public String getFilterOutOfOfficeText() { |
---|
85 | return this.filterOutOfOfficeText.getValue(); |
---|
86 | } |
---|
87 | |
---|
88 | public void editFilterRule(String id) { |
---|
89 | driver.findElement( |
---|
90 | By.xpath("//div[@id='window_ffilter_ccform']/div[@id='form_body']/div[@id='set_rules']/a[" |
---|
91 | + id + "]")).click(); |
---|
92 | } |
---|
93 | |
---|
94 | public void editOutOfOfficeFilterRule() { |
---|
95 | driver.findElement(By.xpath("//div[@id='set_out']/a/b")).click(); |
---|
96 | } |
---|
97 | |
---|
98 | public String getFilterRuleText(String id) { |
---|
99 | return driver |
---|
100 | .findElement( |
---|
101 | By.xpath("//div[@id='window_ffilter_ccform']/div[@id='form_body']/div[@id='set_rules']/a[" |
---|
102 | + id + "]")).getText(); |
---|
103 | } |
---|
104 | |
---|
105 | public void setFilterRecepient(String value) { |
---|
106 | this.filterRecepient.clear(); |
---|
107 | this.filterRecepient.sendKeys(value); |
---|
108 | } |
---|
109 | |
---|
110 | public String getFilterRecepient() { |
---|
111 | return this.filterRecepient.getValue(); |
---|
112 | } |
---|
113 | |
---|
114 | public void setFilterTo(String value) { |
---|
115 | this.filterTo.clear(); |
---|
116 | this.filterTo.sendKeys(value); |
---|
117 | } |
---|
118 | |
---|
119 | public String getFilterTo() { |
---|
120 | return this.filterTo.getValue(); |
---|
121 | } |
---|
122 | |
---|
123 | public void setFilterSubject(String value) { |
---|
124 | this.filterSubject.clear(); |
---|
125 | this.filterSubject.sendKeys(value); |
---|
126 | } |
---|
127 | |
---|
128 | public String getFilterSubject() { |
---|
129 | return this.filterSubject.getValue(); |
---|
130 | } |
---|
131 | |
---|
132 | public void setFilterSize(String value) { |
---|
133 | this.filterSize.clear(); |
---|
134 | this.filterSize.sendKeys(value); |
---|
135 | } |
---|
136 | |
---|
137 | public String getFilterSize() { |
---|
138 | return this.filterSize.getValue(); |
---|
139 | } |
---|
140 | |
---|
141 | public void setFilterArchieveIn() { |
---|
142 | this.filterArchieveIn.click(); |
---|
143 | } |
---|
144 | |
---|
145 | public WebElement getFilterArchieveIn() { |
---|
146 | return this.filterArchieveIn; |
---|
147 | } |
---|
148 | |
---|
149 | public void setFilterRejectMessage() { |
---|
150 | this.filterRejectMessage.click(); |
---|
151 | } |
---|
152 | |
---|
153 | public void setFilterRejectMessageText(String message) { |
---|
154 | this.filterRejectMessageText.sendKeys(message); |
---|
155 | } |
---|
156 | |
---|
157 | public void setFilterMailBox(String mailBox) { |
---|
158 | super.setComboValue(this.filterMailBoxes, mailBox); |
---|
159 | } |
---|
160 | |
---|
161 | public String getFilterMailBox() { |
---|
162 | return super.getComboValue(this.filterMailBoxes); |
---|
163 | } |
---|
164 | |
---|
165 | public void saveFilterRules() { |
---|
166 | this.filterSaveRules.click(); |
---|
167 | } |
---|
168 | |
---|
169 | /** |
---|
170 | * Apaga uma regra do filtro. |
---|
171 | * |
---|
172 | * @param id |
---|
173 | */ |
---|
174 | public void deleteFilterRule(int id) { |
---|
175 | selectFilterRule(id); |
---|
176 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[3]")) |
---|
177 | .click(); |
---|
178 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) |
---|
179 | .click(); |
---|
180 | } |
---|
181 | |
---|
182 | /** |
---|
183 | * Apaga filtros previamente selecionados. |
---|
184 | */ |
---|
185 | public void deleteFilters() { |
---|
186 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[3]")) |
---|
187 | .click(); |
---|
188 | // driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) |
---|
189 | // .click(); |
---|
190 | } |
---|
191 | |
---|
192 | /** |
---|
193 | * Desabilita uma regra do filtro. |
---|
194 | * |
---|
195 | * @param id |
---|
196 | */ |
---|
197 | public void disableFilterRule(int id) { |
---|
198 | selectFilterRule(id); |
---|
199 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[2]")) |
---|
200 | .click(); |
---|
201 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) |
---|
202 | .click(); |
---|
203 | } |
---|
204 | |
---|
205 | /** |
---|
206 | * Habilita uma regra do filtro. |
---|
207 | * |
---|
208 | * @param id |
---|
209 | */ |
---|
210 | public void enableFilterRule(int id) { |
---|
211 | selectFilterRule(id); |
---|
212 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[1]")) |
---|
213 | .click(); |
---|
214 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) |
---|
215 | .click(); |
---|
216 | } |
---|
217 | |
---|
218 | /** |
---|
219 | * Marca o checkbox do filtro selecionado. |
---|
220 | * |
---|
221 | * @param id |
---|
222 | * Id do filtro selecionado. |
---|
223 | */ |
---|
224 | public void selectFilterRule(int id) { |
---|
225 | this.waitForElement(By.id("rule_" + id)); |
---|
226 | driver.findElement(By.id("rule_" + id)).click(); |
---|
227 | } |
---|
228 | |
---|
229 | public void selectOutOfOfficeFilterRule() { |
---|
230 | this.waitForElement(By.id("out_0")); |
---|
231 | driver.findElement(By.id("out_0")).click(); |
---|
232 | } |
---|
233 | |
---|
234 | } |
---|