View Javadoc
1   /*
2    * Copyright (C) 2010-2014 Hamburg Sud and the contributors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.aludratest.service.gui;
17  
18  import org.aludratest.impl.log4testing.ElementName;
19  import org.aludratest.impl.log4testing.ElementType;
20  import org.aludratest.impl.log4testing.TechnicalArgument;
21  import org.aludratest.impl.log4testing.TechnicalLocator;
22  import org.aludratest.service.Condition;
23  import org.aludratest.service.locator.element.GUIElementLocator;
24  import org.aludratest.service.locator.window.WindowLocator;
25  
26  /**
27   * Extends the {@link Condition} interface providing
28   * GUI related features.
29   * @author Marcel Malitz
30   * @author Volker Bergmann
31   */
32  public interface GUICondition extends Condition {
33      /**
34       * Determines that the specified element is somewhere on the page in a given timeout
35       */
36      boolean isElementPresent(
37              @ElementType String elementType,
38              @ElementName String elementName,
39              @TechnicalLocator GUIElementLocator locator);
40  
41      /**
42       * Determines if the specified element is visible.
43       */
44      boolean isElementVisible(
45              @ElementType String elementType,
46              @ElementName String elementName,
47              @TechnicalLocator GUIElementLocator locator);
48  
49      /** Determines whether the specified input element is enabled, ie hasn't been disabled. */
50      boolean isElementEnabled(
51              @ElementType String elementType,
52              @ElementName String elementName,
53              @TechnicalLocator GUIElementLocator locator);
54  
55      /** Determines whether the specified input element is editable, i.e. is not disabled and would accept user text input.
56       * @param elementType Type of the element, depending on the implementation.
57       * @param elementName Name of the element.
58       * @param locator Locator of the element.
59       * @return <code>true</code> if the element is editable, <code>false</code> otherwise. */
60      boolean isElementEditable(@ElementType String elementType, @ElementName String elementName,
61              @TechnicalLocator GUIElementLocator locator);
62  
63      /** Determines whether the specified input element is editable within the given timeout, i.e. is not disabled and would accept
64       * user text input.
65       * @param elementType Type of the element, depending on the implementation.
66       * @param elementName Name of the element.
67       * @param locator Locator of the element.
68       * @param timeout Timeout to use.
69       * @return <code>true</code> if the element is editable, <code>false</code> otherwise. */
70      boolean isElementEditable(@ElementType String elementType, @ElementName String elementName,
71              @TechnicalLocator GUIElementLocator locator, @TechnicalArgument long timeout);
72  
73      /**
74       * Determines that the specified element is not on the page
75       */
76      boolean isElementNotPresent(
77              @ElementType String elementType,
78              @ElementName String elementName,
79              @TechnicalLocator GUIElementLocator locator);
80  
81      /**
82       * Determines that the specified element is somewhere on the page in a given timeout
83       */
84      boolean isElementPresent(
85              @ElementType String elementType,
86              @ElementName String elementName,
87              @TechnicalLocator GUIElementLocator locator,
88              @TechnicalArgument long timeout);
89  
90      /**
91       * Determines if the specified element is visible within timeout
92       */
93      boolean isElementVisible(
94              @ElementType String elementType,
95              @ElementName String elementName,
96              @TechnicalLocator GUIElementLocator locator,
97              @TechnicalArgument long timeout);
98  
99      /** Determines whether the specified input element is enabled in the over given timeout, ie hasn't been disabled. */
100     boolean isElementEnabled(
101             @ElementType String elementType,
102             @ElementName String elementName,
103             @TechnicalLocator GUIElementLocator locator,
104             @TechnicalArgument long timeout);
105 
106     /**
107      *  Determines that the specified element is not on the page within timeout
108      */
109     boolean isElementNotPresent(
110             @ElementType String elementType,
111             @ElementName String elementName,
112             @TechnicalLocator GUIElementLocator locator,
113             @TechnicalArgument long timeout);
114 
115     /**
116      * Determines if a specified window is open
117      */
118     boolean isWindowOpen(@ElementType String elementType, @ElementName String elementName, @TechnicalLocator WindowLocator locator);
119 
120     /**
121      * Determines that the specified element is somewhere on the page and in foreground
122      */
123     boolean isElementPresentandInForeground(
124             @ElementType String elementType,
125             @ElementName String elementName,
126             @TechnicalLocator GUIElementLocator locator);
127 
128     /** Determines if the specified element is checked. This normally only applies to checkboxes.
129      * 
130      * @param elementType Type of the element.
131      * @param elementName Name of the element.
132      * @param locator Locator of the element.
133      * 
134      * @return <code>true</code> if the element is checked, <code>false</code> otherwise. */
135     boolean isElementChecked(@ElementType String elementType, @ElementName String elementName,
136             @TechnicalLocator GUIElementLocator locator);
137 
138     /**
139      * Determines if the speficied element contains the given labels (and possibly more).
140      * 
141      * @param elementType Type of the element.
142      * @param elementName Name of the element.
143      * @param locator Locator of the element.
144      * @param labels Labels which are expected in the element.
145      * 
146      * @return <code>true</code> if the labels were found in the element, <code>false</code> otherwise.
147      */
148     boolean containsLabels(@ElementType String elementType, @ElementName String elementName,
149             @TechnicalLocator GUIElementLocator locator,
150             @TechnicalArgument String... labels);
151 
152     /** Determines if the speficied element contains the given labels (and only these), in the same order as specified.
153      * 
154      * @param elementType Type of the element.
155      * @param elementName Name of the element.
156      * @param locator Locator of the element.
157      * @param labels Labels which are expected in the element.
158      * 
159      * @return <code>true</code> if the labels equal all labels found in the element, <code>false</code> otherwise. */
160     boolean equalsLabels(@ElementType String elementType, @ElementName String elementName,
161             @TechnicalLocator GUIElementLocator locator,
162             @TechnicalArgument String... labels);
163 
164 }