[4962] | 1 | package org.expressolivre.cte.pages.calendar; |
---|
| 2 | |
---|
| 3 | import org.expressolivre.cte.pages.common.Page; |
---|
| 4 | import org.openqa.selenium.WebDriver; |
---|
| 5 | import org.openqa.selenium.WebElement; |
---|
| 6 | import org.openqa.selenium.support.FindBy; |
---|
| 7 | |
---|
| 8 | /** |
---|
| 9 | * @author L.F.Estivalet (Serpro) |
---|
| 10 | * |
---|
| 11 | * Created on Aug 17, 2011 at 10:14:23 AM |
---|
| 12 | * |
---|
| 13 | */ |
---|
| 14 | public class AgendaAddACLUserPage extends Page { |
---|
| 15 | |
---|
| 16 | /** Combo para selecao da organizacao. */ |
---|
| 17 | @FindBy(name = "select_organization") |
---|
| 18 | private WebElement organization; |
---|
| 19 | |
---|
| 20 | /** Combo para selecao do setor. */ |
---|
| 21 | @FindBy(name = "select_sector") |
---|
| 22 | private WebElement sector; |
---|
| 23 | |
---|
| 24 | /** Campo para pesquisar usuarios. */ |
---|
| 25 | @FindBy(name = "search_users") |
---|
| 26 | private WebElement searchUsers; |
---|
| 27 | |
---|
| 28 | /** Combo para selecao dos usuarios. */ |
---|
| 29 | @FindBy(id = "user_list_in") |
---|
| 30 | private WebElement userList; |
---|
| 31 | |
---|
| 32 | /** Botao para adicionar usuarios. */ |
---|
| 33 | @FindBy(xpath = "//div[@id='divAppbox']/table/tbody/tr[9]/td/center/input[1]") |
---|
| 34 | private WebElement addUser; |
---|
| 35 | |
---|
| 36 | /** Botao para fechar a pagina. */ |
---|
| 37 | @FindBy(xpath = "//div[@id='divAppbox']/table/tbody/tr[9]/td/center/input[2]") |
---|
| 38 | private WebElement close; |
---|
| 39 | |
---|
| 40 | /** |
---|
| 41 | * @param driver |
---|
| 42 | */ |
---|
| 43 | public AgendaAddACLUserPage(WebDriver driver) { |
---|
| 44 | super(driver); |
---|
| 45 | // TODO Auto-generated constructor stub |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | /** |
---|
| 49 | * Seta organizacao na combo. |
---|
| 50 | * |
---|
| 51 | * @param organizacao |
---|
| 52 | * Organizacao a setar. |
---|
| 53 | */ |
---|
| 54 | public void setOrganization(String organizacao) { |
---|
| 55 | super.setComboValue(this.organization, organizacao); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | /** |
---|
| 59 | * Seta setor na combo. |
---|
| 60 | * |
---|
| 61 | * @param setor |
---|
| 62 | * Setor a setar. |
---|
| 63 | */ |
---|
| 64 | public void setSector(String setor) { |
---|
| 65 | super.setComboValue(this.sector, setor); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | /** |
---|
| 69 | * Coloca texto para pesquisar por usuarios. |
---|
| 70 | * |
---|
| 71 | * @param text |
---|
| 72 | * Usuario a pesquisar. |
---|
| 73 | */ |
---|
| 74 | public void setSearchBox(String text) { |
---|
| 75 | this.searchUsers.clear(); |
---|
| 76 | this.searchUsers.sendKeys(text); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | /** |
---|
| 80 | * Seleciona usuarios para dar permissao na agenda. |
---|
| 81 | * |
---|
| 82 | * @param userName |
---|
| 83 | * Nome do usuario a selecionar. |
---|
| 84 | */ |
---|
| 85 | public void selectUser(String userName) { |
---|
| 86 | super.setComboValue(this.userList, userName); |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | /** |
---|
| 90 | * Adiciona usuario(s) previamente selecionado(s). |
---|
| 91 | */ |
---|
| 92 | public void addUser() { |
---|
| 93 | this.addUser.click(); |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | /** |
---|
| 97 | * Fecha pagina e retorna controle para a pagina anterior |
---|
| 98 | * (AgendaPermissionPage) |
---|
| 99 | * |
---|
| 100 | * TODO Rever a implementacao... nao esta funcionando! |
---|
| 101 | */ |
---|
| 102 | public void close() { |
---|
| 103 | |
---|
| 104 | this.close.click(); |
---|
| 105 | String w = ""; |
---|
| 106 | // TODO esse loop nao deveria existir... ver melhor forma de implementar |
---|
| 107 | // isso. |
---|
| 108 | for (String window : driver.getWindowHandles()) { |
---|
| 109 | System.out.println("window2 --> " + window); |
---|
| 110 | driver.switchTo().window(window); |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | } |
---|
| 114 | } |
---|