Ignore:
Timestamp:
07/18/11 10:56:36 (13 years ago)
Author:
luiz-fernando
Message:

Ticket #1771 - Refactoring, criadas novas classes para Pasta, Filtro, Pesquisa

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  
    146146         *            Valor a ser selecionado. 
    147147         */ 
    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; 
    155162                } 
    156163 
     
    165172                        e.printStackTrace(); 
    166173                } 
     174                return false; 
    167175        } 
    168176 
     
    177185        } 
    178186 
     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 
    179203} 
  • devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/email/MailFilterPage.java

    r4620 r4780  
    2020        private WebElement filterNewRule; 
    2121 
     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 
    2228        @FindBy(xpath = "//div[@id='window_ffilter_ccform']/div[@id='form_body']/span[2]/input") 
    2329        private WebElement filterSaveRules; 
     
    6571        public void newFilterRule() { 
    6672                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(); 
    6786        } 
    6887 
     
    7190                                By.xpath("//div[@id='window_ffilter_ccform']/div[@id='form_body']/div[@id='set_rules']/a[" 
    7291                                                + id + "]")).click(); 
     92        } 
     93 
     94        public void editOutOfOfficeFilterRule() { 
     95                driver.findElement(By.xpath("//div[@id='set_out']/a/b")).click(); 
    7396        } 
    7497 
     
    81104 
    82105        public void setFilterRecepient(String value) { 
     106                this.filterRecepient.clear(); 
    83107                this.filterRecepient.sendKeys(value); 
    84108        } 
     
    89113 
    90114        public void setFilterTo(String value) { 
     115                this.filterTo.clear(); 
    91116                this.filterTo.sendKeys(value); 
    92117        } 
     
    161186                driver.findElement(By.xpath("//div[@id='form_buttons']/input[3]")) 
    162187                                .click(); 
    163                 driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) 
    164                                 .click(); 
     188                // driver.findElement(By.xpath("//div[@id='form_buttons']/input[4]")) 
     189                // .click(); 
    165190        } 
    166191 
     
    202227        } 
    203228 
     229        public void selectOutOfOfficeFilterRule() { 
     230                this.waitForElement(By.id("out_0")); 
     231                driver.findElement(By.id("out_0")).click(); 
     232        } 
     233 
    204234} 
  • devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/email/MailPage.java

    r4627 r4780  
    2525        private WebElement newEmail; 
    2626 
    27         /** Campo "Para:". */ 
    28         @FindBy(id = "to_1") 
    29         private WebElement to; 
    30  
    3127        /** Campo "Assunto:". */ 
    3228        @FindBy(id = "subject_1") 
    3329        private WebElement subject; 
    3430 
    35         /** Botao para enviar email. */ 
    36         @FindBy(id = "send_button_1") 
    37         private WebElement send; 
    38  
    3931        /** Flag de importante no momento de compor um email. */ 
    4032        @FindBy(id = "important_message_1") 
     
    114106        private WebElement exportEmailLink; 
    115107 
     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 
    116114        /** Link para pasta lixeira. */ 
    117115        @FindBy(id = "lINBOX/Trashtree_folders") 
     
    268266         */ 
    269267        public void setBody(String body) { 
     268                this.setBody(1, body); 
     269        } 
     270 
     271        public void setBody(Integer id, String body) { 
    270272                // Foi o unico jeito que consegui pegar o richtexteditor... 
    271273                if (body != null) { 
     
    273275                        body = body.replaceAll("(\r\n|\r|\n|\n\r)", "<br>"); 
    274276                        ((JavascriptExecutor) driver) 
    275                                         .executeScript("document.getElementById('body_1').contentWindow.document.body.innerHTML='" 
     277                                        .executeScript("document.getElementById('body_" + id 
     278                                                        + "').contentWindow.document.body.innerHTML='" 
    276279                                                        + body + "';"); 
    277280                } 
     
    284287         */ 
    285288        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) { 
    286300                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(); 
    290310        } 
    291311 
     
    363383        } 
    364384 
    365         protected void waitLoading() { 
     385        public void waitLoading() { 
    366386                // Espera pelo "Carregando..." aparecer. 
    367387                waitForElement(By.id("divProgressBar")); 
     
    443463                // Espera pelo "Carregando..." aparecer. 
    444464                waitForElement(By.id("divProgressBar")); 
    445                 waitForElement(By.id("divScrollMain_0")); 
     465                // waitForElement(By.id("divScrollMain_0")); 
    446466                // Espera pelo "Carregando..." desaparecer. 
    447467                isNotDisplayed(this 
     
    519539        public void moveEmail(String folderName) { 
    520540                this.moveEmailLink.click(); 
    521                 super.findAndClickElement("lINBOX/" + folderName + "wfolders_tree"); 
     541                super.findAndClickElement(folderName); 
    522542                this.moveEmailButton.click(); 
    523543        } 
     
    613633        } 
    614634 
     635        public void importEmail() { 
     636                this.importEmailLink.click(); 
     637        } 
     638 
     639        public void importSelectFolder() { 
     640                this.importSelectFolderButton.click(); 
     641        } 
     642 
    615643        /** 
    616644         * Seleciona todos emails da pasta corrente. 
     
    669697         */ 
    670698        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(); 
    672707        } 
    673708 
     
    926961        } 
    927962 
     963        public WebElement getReturnReceipt() { 
     964                return returnReceipt; 
     965        } 
    928966} 
  • devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/email/MailPreferencesPage.java

    r4627 r4780  
    55import org.openqa.selenium.WebElement; 
    66import org.openqa.selenium.support.FindBy; 
    7  
    87 
    98/** 
     
    128127        private WebElement autoSaveDraft; 
    129128 
     129        /** Marcar confirmacao leitura automaticamente */ 
     130        @FindBy(name = "user[return_recipient_deafault]") 
     131        private WebElement returnRecipientDefault; 
     132 
    130133        /** Qual o seu fuso-horário? */ 
    131134        @FindBy(name = "user[timezone]") 
     
    293296         *            the removeAttachmentsFunction to set 
    294297         */ 
    295         public void setRemoveAttachmentsFunction(String removeAttachmentsFunction) { 
    296                 super.setComboValue(this.removeAttachmentsFunction, 
     298        public boolean setRemoveAttachmentsFunction(String removeAttachmentsFunction) { 
     299                return super.setComboValue(this.removeAttachmentsFunction, 
    297300                                removeAttachmentsFunction); 
     301        } 
     302 
     303        /** 
     304         * @param returnRecipientDefault 
     305         * @return 
     306         */ 
     307        public boolean setReturnRecipientDefault(String returnRecipientDefault) { 
     308                return super.setComboValue(this.returnRecipientDefault, 
     309                                returnRecipientDefault); 
    298310        } 
    299311 
     
    302314         *            the useImportantFlag to set 
    303315         */ 
    304         public void setUseImportantFlag(String useImportantFlag) { 
    305                 super.setComboValue(this.useImportantFlag, useImportantFlag); 
     316        public boolean setUseImportantFlag(String useImportantFlag) { 
     317                return super.setComboValue(this.useImportantFlag, useImportantFlag); 
    306318        } 
    307319 
     
    310322         *            the useSpellChecker to set 
    311323         */ 
    312         public void setUseSpellChecker(String useSpellChecker) { 
    313                 super.setComboValue(this.useSpellChecker, useSpellChecker); 
     324        public boolean setUseSpellChecker(String useSpellChecker) { 
     325                return super.setComboValue(this.useSpellChecker, useSpellChecker); 
    314326        } 
    315327 
Note: See TracChangeset for help on using the changeset viewer.