Ignore:
Timestamp:
02/10/11 14:58:57 (14 years ago)
Author:
luiz-fernando
Message:

Ticket #1402 - Novos casos de teste implementados usando WebDriver?

Location:
devel/testlink/automation2.0/src/test/java/br/gov/serpro/expresso/cte/pages
Files:
6 added
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • devel/testlink/automation2.0/src/test/java/br/gov/serpro/expresso/cte/pages/common/HomePage.java

    r3663 r3745  
    1 package br.gov.serpro.expresso.cte.pages.email; 
     1package br.gov.serpro.expresso.cte.pages.common; 
    22 
    33import org.openqa.selenium.WebDriver; 
    44import org.openqa.selenium.WebElement; 
    55import org.openqa.selenium.support.FindBy; 
    6  
    7 import br.gov.serpro.expresso.cte.pages.common.Page; 
    86 
    97/** 
     
    1614        @FindBy(xpath = "//a/img[@id='expressoMail12id']") 
    1715        private WebElement mail; 
     16 
     17        @FindBy(id = "calendarid") 
     18        private WebElement calendar; 
    1819 
    1920        /** 
     
    2829                waitForElementByXpath("//table[@id='folders_tbl']/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span"); 
    2930        } 
     31 
     32        public void enterCalendar() { 
     33                calendar.click(); 
     34                waitForElementById("divAppbox"); 
     35        } 
    3036} 
  • devel/testlink/automation2.0/src/test/java/br/gov/serpro/expresso/cte/pages/common/LoginPage.java

    r3663 r3745  
    1 package br.gov.serpro.expresso.cte.pages.email; 
     1package br.gov.serpro.expresso.cte.pages.common; 
    22 
    33import org.openqa.selenium.WebDriver; 
     
    55import org.openqa.selenium.support.FindBy; 
    66 
    7 import br.gov.serpro.expresso.cte.pages.common.Page; 
    87 
    98/** 
  • devel/testlink/automation2.0/src/test/java/br/gov/serpro/expresso/cte/pages/common/Page.java

    r3708 r3745  
    11package br.gov.serpro.expresso.cte.pages.common; 
    22 
     3import java.util.List; 
    34import java.util.concurrent.TimeUnit; 
    45 
     
    78import org.openqa.selenium.RenderedWebElement; 
    89import org.openqa.selenium.WebDriver; 
     10import org.openqa.selenium.WebElement; 
    911 
    10 /** 
    11  * @author L.F.Estivalet (Serpro) 
    12  *  
    13  *         Created on Jan 4, 2011 at 3:50:44 PM 
    14  *  
    15  */ 
    1612/** 
    1713 * @author L.F.Estivalet (Serpro) 
     
    4036        public void clickElement(String id) { 
    4137                driver.findElement(By.id(id)).click(); 
     38        } 
     39 
     40        public void clickElement(By by) { 
     41                driver.findElement(by).click(); 
    4242        } 
    4343 
     
    141141        } 
    142142 
     143        /** 
     144         * @param element 
     145         * @param value 
     146         */ 
     147        public void setComboValue(WebElement element, String value) { 
     148                List<WebElement> options = element.findElements(By.tagName("option")); 
     149                for (WebElement option : options) { 
     150                        if (option.getText().equals(value)) { 
     151                                option.setSelected(); 
     152                                break; 
     153                        } 
     154                } 
     155        } 
    143156} 
  • devel/testlink/automation2.0/src/test/java/br/gov/serpro/expresso/cte/pages/email/MailPage.java

    r3708 r3745  
    120120        private WebElement forwardEmail; 
    121121 
     122        @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[1]/td[3]/span[5]") 
     123        private WebElement replyEmail; 
     124 
     125        @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span[1]") 
     126        private WebElement replyAllEmail; 
     127 
     128        @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span[2]") 
     129        private WebElement replyEmailWithoutHistory; 
     130 
     131        @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span[3]") 
     132        private WebElement replyAllEmailWithoutHistory; 
     133 
     134        @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr/td[2]/span[2]/span[1]") 
     135        private WebElement editEmail; 
     136 
    122137        /** 
    123138         * @param driver 
     
    164179        } 
    165180 
     181        public void editEmail() { 
     182                super.waitForElementByXpath("//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr/td[2]/span[2]/span[1]"); 
     183                this.editEmail.click(); 
     184        } 
     185 
    166186        /** 
    167187         * Encaminha uma mensagem. 
     
    178198                driver.findElement(By.id("to_" + id)).sendKeys(to); 
    179199                driver.findElement(By.id("send_button_" + id)).click(); 
     200        } 
     201 
     202        private void reply(String id) { 
     203                super.waitForElementById("to_" + id); 
     204                driver.findElement(By.id("send_button_" + id)).click(); 
     205        } 
     206 
     207        /** 
     208         * Responde uma mensagem. 
     209         *  
     210         * @param id 
     211         *            Id da mensagem a ser respondida 
     212         */ 
     213        public void replyEmail(String id) { 
     214                super.waitForElementByXpath("//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[1]/td[3]/span[5]"); 
     215                this.replyEmail.click(); 
     216                this.reply(id); 
     217        } 
     218 
     219        /** 
     220         * Responde uma mensagem. 
     221         *  
     222         * @param id 
     223         *            Id da mensagem a ser respondida 
     224         */ 
     225        public void replyAllEmailWithoutHistory(String id) { 
     226                super.findAndClickElement("msg_opt_reply_options_" + id + "_r"); 
     227                super.waitForElementByXpath("//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span[3]"); 
     228                this.replyAllEmailWithoutHistory.click(); 
     229                this.reply(id); 
     230        } 
     231 
     232        /** 
     233         * Responde uma mensagem. 
     234         *  
     235         * @param id 
     236         *            Id da mensagem a ser respondida 
     237         */ 
     238        public void replyEmailWithoutHistory(String id) { 
     239                super.findAndClickElement("msg_opt_reply_options_" + id + "_r"); 
     240                super.waitForElementByXpath("//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span[2]"); 
     241                this.replyEmailWithoutHistory.click(); 
     242                this.reply(id); 
     243        } 
     244 
     245        /** 
     246         * Responde uma mensagem. 
     247         *  
     248         * @param id 
     249         *            Id da mensagem a ser respondida 
     250         */ 
     251        public void replyAllEmail(String id) { 
     252                super.findAndClickElement("msg_opt_reply_options_" + id + "_r"); 
     253                super.waitForElementByXpath("//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span[1]"); 
     254                this.replyAllEmail.click(); 
     255                this.reply(id); 
    180256        } 
    181257 
     
    346422        public void sendMail() { 
    347423                this.send.click(); 
     424        } 
     425 
     426        public void sendMail(String id) { 
     427                super.findAndClickElement("send_button_" + id); 
    348428        } 
    349429 
Note: See TracChangeset for help on using the changeset viewer.