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

RevLine 
[4864]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;
[4902]8import org.openqa.selenium.support.PageFactory;
[4864]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
[4890]34        @FindBy(xpath = "//table[@id='calendar_viewevent_button_right']/tbody/tr/td[2]/nobr/form/div/input[@id='']")
35        private WebElement removeSeriesButton;
36
[4864]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        /**
[4902]46         * Edita o compromisso previamente selecionado
47         *
48         * @return Retorna pagina de edicao do compromisso.
[4864]49         */
[4902]50        public AppointmentEditPage editAppointment() {
51                this.editButton.click();
52                return PageFactory.initElements(driver, AppointmentEditPage.class);
[4864]53
54        }
55
56        /**
[4902]57         * Remove um compromisso.
[4864]58         */
[4902]59        public void removeAppointment() {
60                this.removeButton.click();
61                this.removeAlert();
[4864]62        }
63
64        /**
[4902]65         * Remove a serie de compromissos.
[4864]66         */
[4902]67        public void removeSeriesAppointment() {
68                this.removeSeriesButton.click();
69                this.removeAlert();
[4864]70        }
71
72        /**
[4902]73         * Exibe alerta ao tentar remover um compromisso.
[4864]74         */
[4902]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();
[4864]81        }
82
83        /**
[4902]84         * @return the title
[4864]85         */
[4902]86        public String getTitle() {
87                return title.getText();
[4864]88        }
89
90}
Note: See TracBrowser for help on using the repository browser.