Ignore:
Timestamp:
09/02/11 14:27:19 (13 years ago)
Author:
luiz-fernando
Message:

Ticket #1771 - Adicionado testes automatizados para modulo da agenda

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/common/Page.java

    r4962 r5025  
    5353         */ 
    5454        public void waitForElement(By by) { 
    55                 isDisplayed(this.waitFindElement(by, 10000, 1000)); 
     55                isDisplayed(this.waitFindElement(by, 100000, 1000)); 
    5656        } 
    5757 
     
    200200        } 
    201201 
     202        public List<WebElement> getComboElements(WebElement element) { 
     203                return element.findElements(By.tagName("option")); 
     204        } 
     205 
     206        /** 
     207         * Seleciona todos os valores de um combo. 
     208         *  
     209         * @param element 
     210         */ 
     211        public void selectAllComboValue(WebElement element) { 
     212                List<WebElement> options = element.findElements(By.tagName("option")); 
     213                for (WebElement option : options) { 
     214                        option.setSelected(); 
     215                } 
     216        } 
     217 
     218        /** 
     219         * Verifica se o valor passado esta presente na combo box. 
     220         *  
     221         * @param element 
     222         *            Elemento a verificar. 
     223         * @param value 
     224         *            Valor a verificar. 
     225         * @param select 
     226         *            Se <code>true</code> seleciona o elemento. 
     227         * @return 
     228         */ 
     229        public boolean isValueInCombo(WebElement element, String value, 
     230                        Boolean select) { 
     231 
     232                boolean found = false; 
     233                try { 
     234                        List<WebElement> options = element.findElements(By 
     235                                        .tagName("option")); 
     236                        for (WebElement option : options) { 
     237                                if (option.getText().equals(value)) { 
     238                                        found = true; 
     239                                        if (select) { 
     240                                                option.setSelected(); 
     241                                        } 
     242 
     243                                } 
     244                        } 
     245                } catch (NoSuchElementException nsee) { 
     246                        System.out.println("Warning: ELEMENTO NAO ENCONTRADO!"); 
     247                        found = false; 
     248                } 
     249 
     250                // TODO Rever o tratamento da excecao quando um valor nao for encontrado 
     251                // na combobox. 
     252 
     253                try { 
     254                        throw new Exception("Valor " + value + " não encontrado em " 
     255                                        + element); 
     256                } catch (Exception e) { 
     257                        // TODO Auto-generated catch block 
     258                        e.printStackTrace(); 
     259                } 
     260                return found; 
     261        } 
     262 
    202263        /** 
    203264         * Verifica se um element esta presente na tela. 
Note: See TracChangeset for help on using the changeset viewer.