source: devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/calendar/AppointmentViewPage.java @ 4917

Revision 4917, 2.5 KB checked in by luiz-fernando, 13 years ago (diff)

Ticket #1771 - Adicionado testes automatizados para modulo da agenda

Line 
1package org.expressolivre.cte.pages.calendar;
2
3import org.expressolivre.cte.pages.common.Page;
4import org.openqa.selenium.Alert;
5import org.openqa.selenium.WebDriver;
6import org.openqa.selenium.WebElement;
7import org.openqa.selenium.support.FindBy;
8import org.openqa.selenium.support.PageFactory;
9import 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 */
17public class AppointmentViewPage extends Page {
18
19        /** Botao para editar um compromisso. */
20        @FindBy(xpath = "//table[@id='calendar_viewevent_button_left']/tbody/tr/td[1]/nobr/form/div/input[@id='']")
21        private WebElement editButton;
22
23        /** Botao para editar serie de compromissos. */
24        @FindBy(xpath = "//table[@id='calendar_viewevent_button_left']/tbody/tr/td[2]/nobr/form/div/input[@id='']")
25        private WebElement editSeriesButton;
26
27        @FindBy(xpath = "//table[@id='calendar_viewevent_button_right']/tbody/tr/td/nobr/form/div/input[@id='']")
28        private WebElement removeButton;
29
30        @FindBy(xpath = "//table[@id='calendar_viewevent_button_right']/tbody/tr/td[2]/nobr/form/div/input[@id='']")
31        private WebElement removeSeriesButton;
32
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        /**
42         * Edita o compromisso previamente selecionado.
43         *
44         * @return Retorna pagina de edicao do compromisso.
45         */
46        public AppointmentEditPage editAppointment() {
47                this.editButton.click();
48                return PageFactory.initElements(driver, AppointmentEditPage.class);
49
50        }
51
52        /**
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        /**
64         * Remove um compromisso.
65         */
66        public void removeAppointment() {
67                this.removeButton.click();
68                this.removeAlert();
69        }
70
71        /**
72         * Remove a serie de compromissos.
73         */
74        public void removeSeriesAppointment() {
75                this.removeSeriesButton.click();
76                this.removeAlert();
77        }
78
79        /**
80         * Exibe alerta ao tentar remover um compromisso.
81         */
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();
88        }
89
90        /**
91         * @return the title
92         */
93        public String getTitle() {
94                return title.getText();
95        }
96}
Note: See TracBrowser for help on using the repository browser.