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

Revision 4902, 2.4 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        @FindBy(xpath = "//table[@id='calendar_viewevent_button_left']/tbody/tr/td[1]/nobr/form/div/input[@id='']")
20        private WebElement editButton;
21
22        @FindBy(xpath = "//table[@id='calendar_viewevent_button_left']/tbody/tr/td[2]/nobr/form/div/input[@id='']")
23        private WebElement readyButton;
24
25        @FindBy(xpath = "//table[@id='calendar_viewevent_button_center']/tbody/tr/td[1]/nobr/form/div/input[@id='']")
26        private WebElement alarmManagerButton;
27
28        @FindBy(xpath = "//table[@id='calendar_viewevent_button_center']/tbody/tr/td[2]/nobr/form/div/input[@id='']")
29        private WebElement exportButton;
30
31        @FindBy(xpath = "//table[@id='calendar_viewevent_button_right']/tbody/tr/td/nobr/form/div/input[@id='']")
32        private WebElement removeButton;
33
34        @FindBy(xpath = "//table[@id='calendar_viewevent_button_right']/tbody/tr/td[2]/nobr/form/div/input[@id='']")
35        private WebElement removeSeriesButton;
36
37        @FindBy(xpath = "//table[@id='calendar_view_event']/tbody/tr[1]/td[2]")
38        private WebElement title;
39
40        public AppointmentViewPage(WebDriver driver) {
41                super(driver);
42                // TODO Auto-generated constructor stub
43        }
44
45        /**
46         * Edita o compromisso previamente selecionado
47         *
48         * @return Retorna pagina de edicao do compromisso.
49         */
50        public AppointmentEditPage editAppointment() {
51                this.editButton.click();
52                return PageFactory.initElements(driver, AppointmentEditPage.class);
53
54        }
55
56        /**
57         * Remove um compromisso.
58         */
59        public void removeAppointment() {
60                this.removeButton.click();
61                this.removeAlert();
62        }
63
64        /**
65         * Remove a serie de compromissos.
66         */
67        public void removeSeriesAppointment() {
68                this.removeSeriesButton.click();
69                this.removeAlert();
70        }
71
72        /**
73         * Exibe alerta ao tentar remover um compromisso.
74         */
75        private void removeAlert() {
76                Alert alert = driver.switchTo().alert();
77                Assert.assertEquals(
78                                alert.getText(),
79                                "Tem certeza que deseja remover esta entrada?\nIsto irá remover esta entrada para todos usuários.");
80                alert.accept();
81        }
82
83        /**
84         * @return the title
85         */
86        public String getTitle() {
87                return title.getText();
88        }
89
90}
Note: See TracBrowser for help on using the repository browser.