[4864] | 1 | package org.expressolivre.cte.pages.calendar; |
---|
| 2 | |
---|
| 3 | import org.expressolivre.cte.pages.common.Page; |
---|
| 4 | import org.openqa.selenium.Alert; |
---|
| 5 | import org.openqa.selenium.WebDriver; |
---|
| 6 | import org.openqa.selenium.WebElement; |
---|
| 7 | import org.openqa.selenium.support.FindBy; |
---|
[4902] | 8 | import org.openqa.selenium.support.PageFactory; |
---|
[4864] | 9 | import org.testng.Assert; |
---|
| 10 | |
---|
| 11 | /** |
---|
| 12 | * @author L.F.Estivalet (Serpro) |
---|
| 13 | * |
---|
| 14 | * Created on Jul 25, 2011 at 2:25:28 PM |
---|
| 15 | * |
---|
| 16 | */ |
---|
| 17 | public class AppointmentViewPage extends Page { |
---|
| 18 | |
---|
[4917] | 19 | /** Botao para editar um compromisso. */ |
---|
[4864] | 20 | @FindBy(xpath = "//table[@id='calendar_viewevent_button_left']/tbody/tr/td[1]/nobr/form/div/input[@id='']") |
---|
| 21 | private WebElement editButton; |
---|
| 22 | |
---|
[4917] | 23 | /** Botao para editar serie de compromissos. */ |
---|
[4864] | 24 | @FindBy(xpath = "//table[@id='calendar_viewevent_button_left']/tbody/tr/td[2]/nobr/form/div/input[@id='']") |
---|
[4917] | 25 | private WebElement editSeriesButton; |
---|
[4864] | 26 | |
---|
| 27 | @FindBy(xpath = "//table[@id='calendar_viewevent_button_right']/tbody/tr/td/nobr/form/div/input[@id='']") |
---|
| 28 | private WebElement removeButton; |
---|
| 29 | |
---|
[4890] | 30 | @FindBy(xpath = "//table[@id='calendar_viewevent_button_right']/tbody/tr/td[2]/nobr/form/div/input[@id='']") |
---|
| 31 | private WebElement removeSeriesButton; |
---|
| 32 | |
---|
[4864] | 33 | @FindBy(xpath = "//table[@id='calendar_view_event']/tbody/tr[1]/td[2]") |
---|
| 34 | private WebElement title; |
---|
| 35 | |
---|
| 36 | public AppointmentViewPage(WebDriver driver) { |
---|
| 37 | super(driver); |
---|
| 38 | // TODO Auto-generated constructor stub |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | /** |
---|
[4917] | 42 | * Edita o compromisso previamente selecionado. |
---|
[4902] | 43 | * |
---|
| 44 | * @return Retorna pagina de edicao do compromisso. |
---|
[4864] | 45 | */ |
---|
[4902] | 46 | public AppointmentEditPage editAppointment() { |
---|
| 47 | this.editButton.click(); |
---|
| 48 | return PageFactory.initElements(driver, AppointmentEditPage.class); |
---|
[4864] | 49 | |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | /** |
---|
[4917] | 53 | * Edita a serie de compromissos previamente selecionado. |
---|
| 54 | * |
---|
| 55 | * @return Retorna pagina de edicao do compromisso. |
---|
| 56 | */ |
---|
| 57 | public AppointmentEditPage editAppointmentSeries() { |
---|
| 58 | this.editSeriesButton.click(); |
---|
| 59 | return PageFactory.initElements(driver, AppointmentEditPage.class); |
---|
| 60 | |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | /** |
---|
[4902] | 64 | * Remove um compromisso. |
---|
[4864] | 65 | */ |
---|
[4902] | 66 | public void removeAppointment() { |
---|
| 67 | this.removeButton.click(); |
---|
| 68 | this.removeAlert(); |
---|
[4864] | 69 | } |
---|
| 70 | |
---|
| 71 | /** |
---|
[4902] | 72 | * Remove a serie de compromissos. |
---|
[4864] | 73 | */ |
---|
[4902] | 74 | public void removeSeriesAppointment() { |
---|
| 75 | this.removeSeriesButton.click(); |
---|
| 76 | this.removeAlert(); |
---|
[4864] | 77 | } |
---|
| 78 | |
---|
| 79 | /** |
---|
[4902] | 80 | * Exibe alerta ao tentar remover um compromisso. |
---|
[4864] | 81 | */ |
---|
[4902] | 82 | private void removeAlert() { |
---|
| 83 | Alert alert = driver.switchTo().alert(); |
---|
| 84 | Assert.assertEquals( |
---|
| 85 | alert.getText(), |
---|
| 86 | "Tem certeza que deseja remover esta entrada?\nIsto irá remover esta entrada para todos usuários."); |
---|
| 87 | alert.accept(); |
---|
[4864] | 88 | } |
---|
| 89 | |
---|
| 90 | /** |
---|
[4902] | 91 | * @return the title |
---|
[4864] | 92 | */ |
---|
[4902] | 93 | public String getTitle() { |
---|
| 94 | return title.getText(); |
---|
[4864] | 95 | } |
---|
| 96 | } |
---|