- Timestamp:
- 09/02/11 14:27:19 (13 years ago)
- Location:
- devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/calendar/AgendaPermissionPage.java
r4962 r5025 1 1 package org.expressolivre.cte.pages.calendar; 2 2 3 import java.util.List; 3 4 import java.util.Set; 4 5 … … 60 61 61 62 /** 63 * Verifica se o usuario ja esta na lista de permissoes. 64 * 65 * @param userName 66 * @return 67 */ 68 public Boolean isUserInList(String userName) { 69 return super.isValueInCombo(this.userList, userName, true); 70 } 71 72 /** 73 * Remove todos os usuarios do compartilhamento. 74 */ 75 public void removeAllUsers() { 76 List<WebElement> users = super.getComboElements(this.userList); 77 for (WebElement user : users) { 78 user.setSelected(); 79 this.removeButton.click(); 80 } 81 } 82 83 /** 62 84 * Adaptacao da solucao para lidar com janelas popups obtida em <a 63 85 * href="http://groups.google.com/group … … 92 114 } 93 115 94 public void setReadPermission() { 95 this.read.click(); 116 public void setReadPermission(boolean read) { 117 if (read && !this.read.isSelected()) { 118 this.read.click(); 119 } else if (!read && this.read.isSelected()) { 120 this.read.click(); 121 } 122 } 123 124 public void setEditPermission(boolean edit) { 125 if (edit && !this.edit.isSelected()) { 126 this.edit.click(); 127 } else if (!edit && this.edit.isSelected()) { 128 this.edit.click(); 129 } 130 } 131 132 public void setAddPermission(boolean add) { 133 if (add && !this.add.isSelected()) { 134 this.add.click(); 135 } else if (!add && this.add.isSelected()) { 136 this.add.click(); 137 } 138 } 139 140 public void setRemovePermission(boolean remove) { 141 if (remove && !this.remove.isSelected()) { 142 this.remove.click(); 143 } else if (!remove && this.remove.isSelected()) { 144 this.remove.click(); 145 } 146 } 147 148 public void setRestrictPermission(boolean restrict) { 149 if (restrict && !this.restrict.isSelected()) { 150 this.restrict.click(); 151 } else if (!restrict && this.restrict.isSelected()) { 152 this.restrict.click(); 153 } 154 } 155 156 public void clearPemissions() { 157 this.setReadPermission(false); 158 this.setEditPermission(false); 159 this.setRemovePermission(false); 160 this.setAddPermission(false); 161 this.setRestrictPermission(false); 96 162 } 97 163 … … 99 165 this.cancelButton.click(); 100 166 } 167 168 public void apply() { 169 this.okButton.click(); 170 } 101 171 } -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/calendar/AppointmentEmailPage.java
r4962 r5025 42 42 43 43 // wait for the new window to open 44 new WebDriverWait(driver, 30) {44 new WebDriverWait(driver, 100) { 45 45 }.until(new ExpectedCondition<Boolean>() { 46 46 public Boolean apply(WebDriver driver) { … … 58 58 String newWindowHandle = afterHandles.iterator().next(); 59 59 driver.switchTo().window(newWindowHandle); 60 driver.switchTo().defaultContent(); 60 61 61 62 return PageFactory.initElements(driver, AppointmentStatusPage.class); … … 73 74 74 75 // wait for the new window to open 75 new WebDriverWait(driver, 30) {76 new WebDriverWait(driver, 100) { 76 77 }.until(new ExpectedCondition<Boolean>() { 77 78 public Boolean apply(WebDriver driver) { … … 89 90 String newWindowHandle = afterHandles.iterator().next(); 90 91 driver.switchTo().window(newWindowHandle); 92 driver.switchTo().defaultContent(); 91 93 92 94 return PageFactory.initElements(driver, AppointmentStatusPage.class); … … 104 106 105 107 // wait for the new window to open 106 new WebDriverWait(driver, 30) {108 new WebDriverWait(driver, 100) { 107 109 }.until(new ExpectedCondition<Boolean>() { 108 110 public Boolean apply(WebDriver driver) { … … 120 122 String newWindowHandle = afterHandles.iterator().next(); 121 123 driver.switchTo().window(newWindowHandle); 124 driver.switchTo().defaultContent(); 122 125 123 126 return PageFactory.initElements(driver, AppointmentStatusPage.class); -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/calendar/AppointmentStatusPage.java
r4962 r5025 4 4 5 5 import org.expressolivre.cte.pages.common.Page; 6 import org.openqa.selenium.By; 6 7 import org.openqa.selenium.WebDriver; 7 8 import org.openqa.selenium.WebElement; … … 34 35 35 36 public String getMessage() { 37 super.waitForElement(By 38 .xpath("/html/body/center[1]/table/tbody/tr[1]/td/b/font")); 36 39 return this.message.getText(); 37 40 } … … 49 52 50 53 // wait for the new window to close 51 new WebDriverWait(driver, 30) {54 new WebDriverWait(driver, 100) { 52 55 }.until(new ExpectedCondition<Boolean>() { 53 56 public Boolean apply(WebDriver driver) { … … 61 64 String newWindowHandle = afterHandles.iterator().next(); 62 65 driver.switchTo().window(newWindowHandle); 66 driver.switchTo().defaultContent(); 63 67 64 68 return PageFactory.initElements(driver, AppointmentEmailPage.class); -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/calendar/AppointmentViewPage.java
r4962 r5025 22 22 public static final String DESCRIPTION = "Descrição:"; 23 23 public static final String LOCAL = "Localização:"; 24 public static final String START = "InÃcio Data/ Hora:";24 public static final String START = "InÃcio Data/hora:"; 25 25 public static final String END = "Data/Hora de término:"; 26 26 public static final String PRIORITY = "Prioridade:"; … … 39 39 @FindBy(xpath = "//table[@id='calendar_viewevent_button_left']/tbody/tr/td[2]/nobr/form/div/input[@id='']") 40 40 private WebElement editSeriesButton; 41 42 @FindBy(xpath = "//table[@id='calendar_viewevent_button_left']/tbody/tr/td[2]/nobr/form/div/input[@id='']") 43 private WebElement readyButton; 41 44 42 45 @FindBy(xpath = "//table[@id='calendar_viewevent_button_right']/tbody/tr/td/nobr/form/div/input[@id='']") … … 82 85 this.removeButton.click(); 83 86 this.removeAlert(); 87 } 88 89 /** 90 * 91 */ 92 public void ready() { 93 this.readyButton.click(); 84 94 } 85 95 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/calendar/CalendarPage.java
r4962 r5025 174 174 175 175 /** 176 * Seleciona um usuario listar seus compromissos. 177 * 178 * @param user 179 * Usuario selecionado. 180 */ 181 public void setOwner(String user) { 182 super.setComboValue(this.owner, user); 183 } 184 185 /** 176 186 * Seleciona um mes para filtragem. 177 187 * -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/common/HomePage.java
r4917 r5025 28 28 */ 29 29 public void enterMail() { 30 mail.click();30 super.findAndClickElement(By.xpath("//a/img[@id='expressoMail12id']")); 31 31 waitForElement(By 32 32 .xpath("//table[@id='folders_tbl']/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span")); -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/common/Page.java
r4962 r5025 53 53 */ 54 54 public void waitForElement(By by) { 55 isDisplayed(this.waitFindElement(by, 10000 , 1000));55 isDisplayed(this.waitFindElement(by, 100000, 1000)); 56 56 } 57 57 … … 200 200 } 201 201 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 202 263 /** 203 264 * Verifica se um element esta presente na tela.
Note: See TracChangeset
for help on using the changeset viewer.