Skip to content

Commit 253968f

Browse files
authored
Merge pull request #16 from ITArray/1.4.2-documentation
1.4.2 documentation
2 parents e001b57 + a4156a2 commit 253968f

File tree

8 files changed

+686
-19
lines changed

8 files changed

+686
-19
lines changed

readme.md

Lines changed: 146 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
[![Build Status](https://travis-ci.org/ITArray/Automotion.svg?branch=1.4.2-update)](https://travis-ci.org/ITArray/Automotion)
1+
[![Build Status](https://travis-ci.org/ITArray/Automotion.svg?branch=master)](https://travis-ci.org/ITArray/Automotion)
22

33
# Automotion #
4-
![alt tag](http://visual.itarray.net/images/Automotion.jpg)
4+
![alt tag](https://www.itarray.net/wp-content/uploads/2016/12/Automotion-2.jpg)
55

66
##### Example: https://github.com/ITArray/automotion-example
77
### Steps to connect ###
@@ -40,12 +40,12 @@
4040
* For Web local run:
4141

4242
IS_LOCAL=True
43-
BROWSER=Firefox|Chrome|IE|Safari
43+
BROWSER=Firefox|Chrome|IE|Safari|EDGE
4444

4545
* For Web remote run:
4646

4747
IS_REMOTE=True
48-
BROWSER=Firefox|Chrome|IE|Safari
48+
BROWSER=Firefox|Chrome|IE|Safari|EDGE
4949
EXECUTOR=http://{host}:{port}/wd/hub
5050
(optional available with Chrome only) MOBILE_DEVICE_EMULATION=Google Nexus 5|Apple iPhone 6|Samsung Galaxy S5
5151

@@ -79,10 +79,10 @@
7979
EXECUTOR=http://{host}:{port}/wd/hub
8080
DEVICE=Device name or ID
8181

82-
### Possibilities ###
82+
### Responsive UI Validation ###
8383
- Responsive UI Validator allows to validate UI on web or mobile page using lots of criterias. Also it allows tu build thr HTMl report after validation.
8484

85-
ResponsiveUIValidator uiValidator = new ResponsiveUIValidator(driver);
85+
ResponsiveUIValidator uiValidator = new ResponsiveUIValidator(driver);
8686

8787

8888
boolean result = uiValidator.init()
@@ -106,7 +106,146 @@
106106

107107

108108
uiValidator.generateReport();
109+
110+
- Description for each methods available in the framework:
111+
112+
* Init method:
113+
114+
init(); // Method that defines start of new validation. Needs to be called each time before calling findElement(), findElements()
115+
116+
init("Scenario name"); // Method that defines start of new validation with specified name of scenario. Needs to be called each time before calling findElement(), findElements()
117+
118+
setColorForRootElement(Color color); // Set color for main element. This color will be used for highlighting element in results
119+
120+
setColorForHighlightedElements(Color color); // Set color for compared elements. This color will be used for highlighting elements in results
121+
122+
setLinesColor(Color color); // Set color for grid lines. This color will be used for the lines of alignment grid in results
123+
124+
findElement(WebElement element, String readableNameOfElement); // Main method to specify which element we want to validate (can be called only findElement() OR findElements() for single validation)
125+
126+
findElements(List<WebElement> elements); // Main method to specify the list of elements that we want to validate (can be called only findElement() OR findElements() for single validation)
127+
128+
* For single element findElement({element}, "name"):
129+
130+
insideOf(WebElement containerElement, String readableContainerName); // Verify that element is located inside of specified element
131+
132+
withLeftElement(WebElement element); // Verify that element which located left to is correct
133+
134+
withLeftElement(WebElement element, int minMargin, int maxMargin); // Verify that element which located left to is correct with specified margins
135+
136+
withRightElement(WebElement element); // Verify that element which located right to is correct
137+
138+
withRightElement(WebElement element, int minMargin, int maxMargin); // Verify that element which located right to is correct with specified margins
139+
140+
withTopElement(WebElement element); // Verify that element which located top to is correct
141+
142+
withTopElement(WebElement element, int minMargin, int maxMargin); // Verify that element which located top to is correct with specified margins
143+
144+
withBottomElement(WebElement element); // Verify that element which located bottom to is correct
145+
146+
withBottomElement(WebElement element, int minMargin, int maxMargin); // Verify that element which located bottom to is correct with specified margins
147+
148+
notOverlapWith(WebElement element, String readableName); // Verify that element is NOT overlapped with specified element
149+
150+
overlapWith(WebElement element, String readableName); // Verify that element is overlapped with specified element
151+
152+
notOverlapWith(List<WebElement> elements); // Verify that element is NOT overlapped with every element is the list
153+
154+
sameOffsetLeftAs(WebElement element, String readableName); // Verify that element has the same left offset as specified element
155+
156+
sameOffsetLeftAs(List<WebElement> elements); // Verify that element has the same left offset as every element is the list
157+
158+
sameOffsetRightAs(WebElement element, String readableName); // Verify that element has the same right offset as specified element
159+
160+
sameOffsetRightAs(List<WebElement> elements); // Verify that element has the same right offset as every element is the list
161+
162+
sameOffsetTopAs(WebElement element, String readableName); // Verify that element has the same top offset as specified element
163+
164+
sameOffsetTopAs(List<WebElement> elements); // Verify that element has the same top offset as every element is the list
165+
166+
sameOffsetBottomAs(WebElement element, String readableName); // Verify that element has the same bottom offset as specified element
167+
168+
sameOffsetBottomAs(List<WebElement> elements); // Verify that element has the same bottom offset as every element is the list
169+
170+
sameWidthAs(WebElement element, String readableName); // Verify that element has the same width as specified element
171+
172+
sameWidthAs(List<WebElement> elements); // Verify that element has the same width as every element in the list
173+
174+
minWidth(int width); // Verify that width of element is not less than specified
175+
176+
maxWidth(int width); // Verify that width of element is not bigger than specified
177+
178+
widthBetween(int min, int max); // Verify that width of element is in range
179+
180+
sameHeightAs(WebElement element, String readableName); // Verify that element has the same height as specified element
181+
182+
sameHeightAs(List<WebElement> elements); // Verify that element has the same height as every element in the list
183+
184+
minHeight(int height); // Verify that height of element is not less than specified
185+
186+
maxHeight(int height); // Verify that height of element is not bigger than specified
187+
188+
sameSizeAs(WebElement element, String readableName); // Verify that element has the same size as specified element
189+
190+
sameSizeAs(List<WebElement> elements); // Verify that element has the same size as every element in the list
191+
192+
heightBetween(int min, int max); // Verify that height of element is in range
193+
194+
minOffset(int top, int right, int bottom, int left); // Verify that min offset of element is not less than (min value is -10000)
195+
196+
maxOffset(int top, int right, int bottom, int left); // Verify that max offset of element is not bigger than (min value is -10000)
197+
198+
withCssValue(String cssProperty, String... args); // Verify that element has correct CSS values
199+
200+
withoutCssValue(String cssProperty, String... args); // Verify that concrete CSS values are absent for specified element
201+
202+
equalLeftRightOffset(); // Verify that element has equal left and right offsets (e.g. Bootstrap container)
203+
204+
equalTopBottomOffset(); // Verify that element has equal top and bottom offset (aligned vertically in center)
205+
206+
changeMetricsUnitsTo(ResponsiveUIValidator.Units units); // Change units to Pixels or % (Units.PX, Units.PERCENT)
207+
208+
* For list of elements findElements({element}):
209+
210+
insideOf(WebElement containerElement, String readableContainerName); // Verify that elements are located inside of specified element
211+
212+
alignedAsGrid(int horizontalGridSize); // Verify that elements are aligned in a grid view width specified amount of columns
213+
214+
alignedAsGrid(int horizontalGridSize, int verticalGridSize); // Verify that elements are aligned in a grid view width specified amount of columns and rows
215+
216+
areNotOverlappedWithEachOther(); // Verify that every element in the list is not overlapped with another element from this list
217+
218+
withSameSize(); // Verify that elements in the list have the same size
219+
220+
withSameWidth(); // Verify that elements in the list have the same width
221+
222+
withSameHeight(); // Verify that elements in the list have the same height
223+
224+
sameRightOffset(); // Verify that elements in the list have the right offset
225+
226+
sameLeftOffset(); // Verify that elements in the list have the same left offset
227+
228+
sameTopOffset(); // Verify that elements in the list have the same top offset
229+
230+
sameBottomOffset(); // Verify that elements in the list have the same bottom offset
231+
232+
equalLeftRightOffset(); // Verify that every element in the list have equal right and left offset (aligned horizontally in center)
233+
234+
equalTopBottomOffset(); // Verify that every element in the list have equal top and bottom offset (aligned vertically in center)
235+
236+
changeMetricsUnitsTo(ResponsiveUIValidator.Units units); // Change units to Pixels or % (Units.PX, Units.PERCENT)
237+
238+
* Generating results:
239+
240+
drawMap(); // Methods needs to be called to collect all the results in JSON file and screenshots
241+
242+
validate(); // Call method to summarize and validate the results (can be called with drawMap(). In this case result will be only True or False)
243+
244+
generateReport(); // Call method to generate HTML report
245+
246+
generateReport("file report name"); // Call method to generate HTML report with specified file report name
109247

248+
### Possibilities ###
110249
- Verification that elements are aligned correctly on the web or mobile page
111250
* Elements horizontally are aligned correctly:
112251

@@ -177,6 +316,7 @@
177316
DriverHelper.scrollUpMobileElement(AppiumDriver driver, MobileElement element)
178317
DriverHelper.scrollDownMobileElement(AppiumDriver driver, MobileElement element, int duration) - duration not less than 500ms
179318
DriverHelper.scrollUpMobileElement(AppiumDriver driver, MobileElement element, int duration) - duration not less than 500ms
319+
DriverHelper.zoomInOutPage(WebDriver driver, int zoomPercent) - zoom In/Out the page
180320

181321
DriverHelper.hideKeyboard(AppiumDriver driver) - super method that perform hiding of keyboard for Android and iOS
182322

src/main/java/http/helpers/TextFinder.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ public class TextFinder {
1010

1111
private static double DERIVATION = 0.3;
1212

13+
/**
14+
* Smart Text finder that allows to fins piece of corrupted text
15+
*
16+
* @param pattern
17+
* @param text
18+
* @return
19+
*/
1320
public static boolean textIsFound(String pattern, String text) {
1421
pattern = pattern.toLowerCase();
1522
text = text.toLowerCase();
@@ -81,10 +88,15 @@ public static boolean textIsFound(String pattern, String text) {
8188
}
8289
}
8390

84-
public static void setDerivation(int derivation){
85-
if (derivation > 1){
91+
/**
92+
* Set derivation for text searching
93+
*
94+
* @param derivation
95+
*/
96+
public static void setDerivation(int derivation) {
97+
if (derivation > 1) {
8698
derivation = 1;
87-
}else if (derivation < 0){
99+
} else if (derivation < 0) {
88100
derivation = 0;
89101
}
90102
DERIVATION = derivation;

0 commit comments

Comments
 (0)