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']/span[2]/input") |
---|
23 | private WebElement filterSaveRules; |
---|
24 | |
---|
25 | @FindBy(id = "field1") |
---|
26 | private WebElement filterRecepient; |
---|
27 | |
---|
28 | @FindBy(id = "field2") |
---|
29 | private WebElement filterTo; |
---|
30 | |
---|
31 | @FindBy(id = "field3") |
---|
32 | private WebElement filterSubject; |
---|
33 | |
---|
34 | @FindBy(id = "field4") |
---|
35 | private WebElement filterSize; |
---|
36 | |
---|
37 | @FindBy(id = "select_size") |
---|
38 | private WebElement filterSelectSize; |
---|
39 | |
---|
40 | @FindBy(id = "radio1") |
---|
41 | private WebElement filterArchieveIn; |
---|
42 | |
---|
43 | @FindBy(id = "select_mailboxes") |
---|
44 | private WebElement filterMailBoxes; |
---|
45 | |
---|
46 | @FindBy(id = "radio2") |
---|
47 | private WebElement filterForwardMessage; |
---|
48 | |
---|
49 | @FindBy(id = "radio3") |
---|
50 | private WebElement filterRejectMessage; |
---|
51 | |
---|
52 | @FindBy(id = "field6") |
---|
53 | private WebElement filterRejectMessageText; |
---|
54 | |
---|
55 | @FindBy(id = "radio4") |
---|
56 | private WebElement filterDeleteMessage; |
---|
57 | |
---|
58 | @FindBy(id = "radio5") |
---|
59 | private WebElement filterApplyImportantFilter; |
---|
60 | |
---|
61 | public MailFilterPage(WebDriver driver) { |
---|
62 | super(driver); |
---|
63 | } |
---|
64 | |
---|
65 | public void newFilterRule() { |
---|
66 | this.filterNewRule.click(); |
---|
67 | } |
---|
68 | |
---|
69 | public void editFilterRule(String id) { |
---|
70 | driver.findElement( |
---|
71 | By.xpath("//div[@id='window_ffilter_ccform']/div[@id='form_body']/div[@id='set_rules']/a[" |
---|
72 | + id + "]")).click(); |
---|
73 | } |
---|
74 | |
---|
75 | public String getFilterRuleText(String id) { |
---|
76 | return driver |
---|
77 | .findElement( |
---|
78 | By.xpath("//div[@id='window_ffilter_ccform']/div[@id='form_body']/div[@id='set_rules']/a[" |
---|
79 | + id + "]")).getText(); |
---|
80 | } |
---|
81 | |
---|
82 | public void setFilterRecepient(String value) { |
---|
83 | this.filterRecepient.sendKeys(value); |
---|
84 | } |
---|
85 | |
---|
86 | public String getFilterRecepient() { |
---|
87 | return this.filterRecepient.getValue(); |
---|
88 | } |
---|
89 | |
---|
90 | public void setFilterTo(String value) { |
---|
91 | this.filterTo.sendKeys(value); |
---|
92 | } |
---|
93 | |
---|
94 | public String getFilterTo() { |
---|
95 | return this.filterTo.getValue(); |
---|
96 | } |
---|
97 | |
---|
98 | public void setFilterSubject(String value) { |
---|
99 | this.filterSubject.clear(); |
---|
100 | this.filterSubject.sendKeys(value); |
---|
101 | } |
---|
102 | |
---|
103 | public String getFilterSubject() { |
---|
104 | return this.filterSubject.getValue(); |
---|
105 | } |
---|
106 | |
---|
107 | public void setFilterSize(String value) { |
---|
108 | this.filterSize.clear(); |
---|
109 | this.filterSize.sendKeys(value); |
---|
110 | } |
---|
111 | |
---|
112 | public String getFilterSize() { |
---|
113 | return this.filterSize.getValue(); |
---|
114 | } |
---|
115 | |
---|
116 | public void setFilterArchieveIn() { |
---|
117 | this.filterArchieveIn.click(); |
---|
118 | } |
---|
119 | |
---|
120 | public WebElement getFilterArchieveIn() { |
---|
121 | return this.filterArchieveIn; |
---|
122 | } |
---|
123 | |
---|
124 | public void setFilterRejectMessage() { |
---|
125 | this.filterRejectMessage.click(); |
---|
126 | } |
---|
127 | |
---|
128 | public void setFilterRejectMessageText(String message) { |
---|
129 | this.filterRejectMessageText.sendKeys(message); |
---|
130 | } |
---|
131 | |
---|
132 | public void setFilterMailBox(String mailBox) { |
---|
133 | super.setComboValue(this.filterMailBoxes, mailBox); |
---|
134 | } |
---|
135 | |
---|
136 | public String getFilterMailBox() { |
---|
137 | return super.getComboValue(this.filterMailBoxes); |
---|
138 | } |
---|
139 | |
---|
140 | public void saveFilterRules() { |
---|
141 | this.filterSaveRules.click(); |
---|
142 | } |
---|
143 | |
---|
144 | /** |
---|
145 | * Apaga uma regra do filtro. |
---|
146 | * |
---|
147 | * @param id |
---|
148 | */ |
---|
149 | public void deleteFilterRule(int id) { |
---|
150 | selectFilterRule(id); |
---|
151 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[3]")) |
---|
152 | .click(); |
---|
153 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) |
---|
154 | .click(); |
---|
155 | } |
---|
156 | |
---|
157 | /** |
---|
158 | * Apaga filtros previamente selecionados. |
---|
159 | */ |
---|
160 | public void deleteFilters() { |
---|
161 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[3]")) |
---|
162 | .click(); |
---|
163 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) |
---|
164 | .click(); |
---|
165 | } |
---|
166 | |
---|
167 | /** |
---|
168 | * Desabilita uma regra do filtro. |
---|
169 | * |
---|
170 | * @param id |
---|
171 | */ |
---|
172 | public void disableFilterRule(int id) { |
---|
173 | selectFilterRule(id); |
---|
174 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[2]")) |
---|
175 | .click(); |
---|
176 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) |
---|
177 | .click(); |
---|
178 | } |
---|
179 | |
---|
180 | /** |
---|
181 | * Habilita uma regra do filtro. |
---|
182 | * |
---|
183 | * @param id |
---|
184 | */ |
---|
185 | public void enableFilterRule(int id) { |
---|
186 | selectFilterRule(id); |
---|
187 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[1]")) |
---|
188 | .click(); |
---|
189 | driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) |
---|
190 | .click(); |
---|
191 | } |
---|
192 | |
---|
193 | /** |
---|
194 | * Marca o checkbox do filtro selecionado. |
---|
195 | * |
---|
196 | * @param id |
---|
197 | * Id do filtro selecionado. |
---|
198 | */ |
---|
199 | public void selectFilterRule(int id) { |
---|
200 | this.waitForElement(By.id("rule_" + id)); |
---|
201 | driver.findElement(By.id("rule_" + id)).click(); |
---|
202 | } |
---|
203 | |
---|
204 | } |
---|