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

Revision 4917, 2.6 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.WebDriver;
5import org.openqa.selenium.WebElement;
6import org.openqa.selenium.support.FindBy;
7
8/**
9 * @author L.F.Estivalet (Serpro)
10 *
11 *         Created on Aug 10, 2011 at 1:56:27 PM
12 *
13 */
14public class AddAppointmentCategoryPage extends Page {
15
16        /** Combo para escolher categoria pai. */
17        @FindBy(name = "new_parent")
18        private WebElement parentCategory;
19
20        /** Nome da categoria. */
21        @FindBy(name = "cat_name")
22        private WebElement categoryName;
23
24        /** Descricao da categoria. */
25        @FindBy(name = "cat_description")
26        private WebElement categoryDescription;
27
28        /** Categoria privada. */
29        @FindBy(name = "cat_access")
30        private WebElement privateCategory;
31
32        /** Botao para salvar a categoria. */
33        @FindBy(name = "save")
34        private WebElement saveCategory;
35
36        /** Mensagem de erro ao tentar salvar uma categoria. */
37        @FindBy(xpath = "//table[@id='tableDivAppbox']/tbody/tr/td/center/table[1]/tbody/tr/td[2]")
38        private WebElement errorMessage;
39
40        /**
41         * @param driver
42         */
43        public AddAppointmentCategoryPage(WebDriver driver) {
44                super(driver);
45                // TODO Auto-generated constructor stub
46        }
47
48        /**
49         * @param parent
50         */
51        public void setParentCategory(String parent) {
52                super.setComboValue(parentCategory, parent);
53        }
54
55        /**
56         * Seta o nome da categoria.
57         *
58         * @param name
59         *            Nome da categoria a setar.
60         */
61        public void setCategoryName(String name) {
62                this.categoryName.clear();
63                this.categoryName.sendKeys(name);
64        }
65
66        /**
67         * @return
68         */
69        public String getCategoryName() {
70                return this.categoryName.getValue();
71        }
72
73        /**
74         * Seta a descricao da categoria.
75         *
76         * @param description
77         *            Descricao da categoria a setar.
78         */
79        public void setCategoryDescription(String description) {
80                this.categoryDescription.clear();
81                this.categoryDescription.sendKeys(description);
82        }
83
84        /**
85         * @return
86         */
87        public String getCategoryDescription() {
88                return this.categoryDescription.getValue();
89        }
90
91        /**
92         * Torna a categoria privada ou nao.
93         */
94        public void setPrivateAccess(Boolean privateCategory) {
95                if (privateCategory && !this.privateCategory.isSelected()) {
96                        this.privateCategory.click();
97                } else if (!privateCategory && this.privateCategory.isSelected()) {
98                        this.privateCategory.click();
99                }
100        }
101
102        /**
103         * @return
104         */
105        public Boolean getPrivateAccess() {
106                return this.privateCategory.isSelected();
107        }
108
109        /**
110         * Salva a categoria.
111         */
112        public void saveCategory() {
113                this.saveCategory.click();
114        }
115
116        /**
117         * @return
118         */
119        public String getErrorMessage() {
120                return this.errorMessage.getText();
121        }
122}
Note: See TracBrowser for help on using the repository browser.