- Timestamp:
- 07/18/11 10:56:36 (13 years ago)
- Location:
- devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/common/Page.java
r4620 r4780 146 146 * Valor a ser selecionado. 147 147 */ 148 public void setComboValue(WebElement element, String value) { 149 List<WebElement> options = element.findElements(By.tagName("option")); 150 for (WebElement option : options) { 151 if (option.getText().equals(value)) { 152 option.setSelected(); 153 return; 154 } 148 public boolean setComboValue(WebElement element, String value) { 149 150 try { 151 List<WebElement> options = element.findElements(By 152 .tagName("option")); 153 for (WebElement option : options) { 154 if (option.getText().equals(value)) { 155 option.setSelected(); 156 return true; 157 } 158 } 159 } catch (NoSuchElementException nsee) { 160 System.out.println("Warning: ELEMENTO NAO ENCONTRADO!"); 161 return false; 155 162 } 156 163 … … 165 172 e.printStackTrace(); 166 173 } 174 return false; 167 175 } 168 176 … … 177 185 } 178 186 187 /** 188 * Verifica se um element esta presente na tela. 189 * 190 * @param by 191 * @return 192 */ 193 public Boolean isElementPresent(By by) { 194 boolean find = true; 195 try { 196 driver.findElement(by); 197 } catch (NoSuchElementException nsee) { 198 find = false; 199 } 200 return find; 201 } 202 179 203 } -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/email/MailFilterPage.java
r4620 r4780 20 20 private WebElement filterNewRule; 21 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 22 28 @FindBy(xpath = "//div[@id='window_ffilter_ccform']/div[@id='form_body']/span[2]/input") 23 29 private WebElement filterSaveRules; … … 65 71 public void newFilterRule() { 66 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(); 67 86 } 68 87 … … 71 90 By.xpath("//div[@id='window_ffilter_ccform']/div[@id='form_body']/div[@id='set_rules']/a[" 72 91 + id + "]")).click(); 92 } 93 94 public void editOutOfOfficeFilterRule() { 95 driver.findElement(By.xpath("//div[@id='set_out']/a/b")).click(); 73 96 } 74 97 … … 81 104 82 105 public void setFilterRecepient(String value) { 106 this.filterRecepient.clear(); 83 107 this.filterRecepient.sendKeys(value); 84 108 } … … 89 113 90 114 public void setFilterTo(String value) { 115 this.filterTo.clear(); 91 116 this.filterTo.sendKeys(value); 92 117 } … … 161 186 driver.findElement(By.xpath("//div[@id='form_buttons']/input[3]")) 162 187 .click(); 163 driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]"))164 188 // driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) 189 // .click(); 165 190 } 166 191 … … 202 227 } 203 228 229 public void selectOutOfOfficeFilterRule() { 230 this.waitForElement(By.id("out_0")); 231 driver.findElement(By.id("out_0")).click(); 232 } 233 204 234 } -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/email/MailPage.java
r4627 r4780 25 25 private WebElement newEmail; 26 26 27 /** Campo "Para:". */28 @FindBy(id = "to_1")29 private WebElement to;30 31 27 /** Campo "Assunto:". */ 32 28 @FindBy(id = "subject_1") 33 29 private WebElement subject; 34 30 35 /** Botao para enviar email. */36 @FindBy(id = "send_button_1")37 private WebElement send;38 39 31 /** Flag de importante no momento de compor um email. */ 40 32 @FindBy(id = "important_message_1") … … 114 106 private WebElement exportEmailLink; 115 107 108 @FindBy(xpath = "//div[@id='footer_menu']/table[@id='footer_box']/tbody/tr[@id='table_message']/td[@id='span_options']/span[5]/span") 109 private WebElement importEmailLink; 110 111 @FindBy(xpath = "//div[@id='win_import_window']/div[@id='win_import_window_clientArea']/div[@id='import_window']/div[@id='form_upload']/form/input[2]") 112 private WebElement importSelectFolderButton; 113 116 114 /** Link para pasta lixeira. */ 117 115 @FindBy(id = "lINBOX/Trashtree_folders") … … 268 266 */ 269 267 public void setBody(String body) { 268 this.setBody(1, body); 269 } 270 271 public void setBody(Integer id, String body) { 270 272 // Foi o unico jeito que consegui pegar o richtexteditor... 271 273 if (body != null) { … … 273 275 body = body.replaceAll("(\r\n|\r|\n|\n\r)", "<br>"); 274 276 ((JavascriptExecutor) driver) 275 .executeScript("document.getElementById('body_1').contentWindow.document.body.innerHTML='" 277 .executeScript("document.getElementById('body_" + id 278 + "').contentWindow.document.body.innerHTML='" 276 279 + body + "';"); 277 280 } … … 284 287 */ 285 288 public void composeEmail(String to, String subject, String body) { 289 this.composeEmail(1, to, subject, body); 290 } 291 292 /** 293 * @param id 294 * Corresponde ao id da aba de nova mensagem. 295 * @param to 296 * @param subject 297 * @param body 298 */ 299 public void composeEmail(Integer id, String to, String subject, String body) { 286 300 this.createNewEmail(); 287 this.to.sendKeys(to); 288 this.setSubject(subject); 289 this.setBody(body); 301 driver.findElement(By.id("to_" + id)).sendKeys(to); 302 driver.findElement(By.id("subject_" + id)).sendKeys(subject); 303 this.setBody(id, body); 304 } 305 306 public void quickContactSearch() { 307 driver.findElement( 308 By.xpath("//div[@id='exmail_main_body']/div[@id='content_id_1']/div[@id='div_message_scroll_1']/form/table/tbody/tr[4]/td[3]/img")) 309 .click(); 290 310 } 291 311 … … 363 383 } 364 384 365 p rotectedvoid waitLoading() {385 public void waitLoading() { 366 386 // Espera pelo "Carregando..." aparecer. 367 387 waitForElement(By.id("divProgressBar")); … … 443 463 // Espera pelo "Carregando..." aparecer. 444 464 waitForElement(By.id("divProgressBar")); 445 waitForElement(By.id("divScrollMain_0"));465 // waitForElement(By.id("divScrollMain_0")); 446 466 // Espera pelo "Carregando..." desaparecer. 447 467 isNotDisplayed(this … … 519 539 public void moveEmail(String folderName) { 520 540 this.moveEmailLink.click(); 521 super.findAndClickElement( "lINBOX/" + folderName + "wfolders_tree");541 super.findAndClickElement(folderName); 522 542 this.moveEmailButton.click(); 523 543 } … … 613 633 } 614 634 635 public void importEmail() { 636 this.importEmailLink.click(); 637 } 638 639 public void importSelectFolder() { 640 this.importSelectFolderButton.click(); 641 } 642 615 643 /** 616 644 * Seleciona todos emails da pasta corrente. … … 669 697 */ 670 698 public void sendMail() { 671 this.send.click(); 699 this.sendMail(1); 700 } 701 702 /** 703 * @param id 704 */ 705 public void sendMail(Integer id) { 706 driver.findElement(By.id("send_button_" + id)).click(); 672 707 } 673 708 … … 926 961 } 927 962 963 public WebElement getReturnReceipt() { 964 return returnReceipt; 965 } 928 966 } -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/email/MailPreferencesPage.java
r4627 r4780 5 5 import org.openqa.selenium.WebElement; 6 6 import org.openqa.selenium.support.FindBy; 7 8 7 9 8 /** … … 128 127 private WebElement autoSaveDraft; 129 128 129 /** Marcar confirmacao leitura automaticamente */ 130 @FindBy(name = "user[return_recipient_deafault]") 131 private WebElement returnRecipientDefault; 132 130 133 /** Qual o seu fuso-horário? */ 131 134 @FindBy(name = "user[timezone]") … … 293 296 * the removeAttachmentsFunction to set 294 297 */ 295 public voidsetRemoveAttachmentsFunction(String removeAttachmentsFunction) {296 super.setComboValue(this.removeAttachmentsFunction,298 public boolean setRemoveAttachmentsFunction(String removeAttachmentsFunction) { 299 return super.setComboValue(this.removeAttachmentsFunction, 297 300 removeAttachmentsFunction); 301 } 302 303 /** 304 * @param returnRecipientDefault 305 * @return 306 */ 307 public boolean setReturnRecipientDefault(String returnRecipientDefault) { 308 return super.setComboValue(this.returnRecipientDefault, 309 returnRecipientDefault); 298 310 } 299 311 … … 302 314 * the useImportantFlag to set 303 315 */ 304 public voidsetUseImportantFlag(String useImportantFlag) {305 super.setComboValue(this.useImportantFlag, useImportantFlag);316 public boolean setUseImportantFlag(String useImportantFlag) { 317 return super.setComboValue(this.useImportantFlag, useImportantFlag); 306 318 } 307 319 … … 310 322 * the useSpellChecker to set 311 323 */ 312 public voidsetUseSpellChecker(String useSpellChecker) {313 super.setComboValue(this.useSpellChecker, useSpellChecker);324 public boolean setUseSpellChecker(String useSpellChecker) { 325 return super.setComboValue(this.useSpellChecker, useSpellChecker); 314 326 } 315 327
Note: See TracChangeset
for help on using the changeset viewer.