Skip to content

Commit 634be69

Browse files
committed
[master] - added time of execution to the report
1 parent d20a4c7 commit 634be69

File tree

7 files changed

+12
-4
lines changed

7 files changed

+12
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
.idea/libraries
2323
*.iml
2424
.idea
25+
drivers
2526

2627
# Mongo Explorer plugin:
2728
.idea/mongoSettings.xml

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>net.itarray</groupId>
88
<artifactId>automotion</artifactId>
9-
<version>1.4.0.1</version>
9+
<version>1.4.0</version>
1010
<name>Automotion</name>
1111
<description>Library for automation testing</description>
1212
<url>https://www.itarray.net</url>

src/main/java/util/general/HtmlReportBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public void buildReport() throws IOException, ParseException, InterruptedExcepti
7272
}};
7373
}
7474
}};
75+
new H4(this,
76+
new Style("color: rgb(105,105,105)")) {{
77+
new NoTag(this, "Time execution: " + jsonObject.get(TIME_EXECUTION));
78+
}};
7579
new P(this) {{
7680
new Img(this,
7781
new Src("img/" + jsonObject.get(SCREENSHOT)),

src/main/java/util/general/SystemHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static boolean isRetinaDisplay(Graphics2D g) {
2121
} catch (Exception e) {
2222
e.printStackTrace();
2323
}
24-
}catch (Exception e){
24+
} catch (Exception e) {
2525
e.printStackTrace();
2626
}
2727
return isRetina;
@@ -43,7 +43,7 @@ public static String hexStringToARGB(String hexARGB) throws IllegalArgumentExcep
4343
intARGB[2] = Integer.valueOf(hexARGB.substring(5, 7), 16); // green
4444
intARGB[3] = Integer.valueOf(hexARGB.substring(7), 16); // blue
4545

46-
return String.format("rgba(%d,%d,%d,%.1f)", intARGB[1], intARGB[2], intARGB[3], (float)Math.round((((float)intARGB[0]/255) * 100)) / 100.f);
46+
return String.format("rgba(%d,%d,%d,%.1f)", intARGB[1], intARGB[2], intARGB[3], (float) Math.round((((float) intARGB[0] / 255) * 100)) / 100.f);
4747
} else {
4848
intARGB = new int[3];
4949
intARGB[0] = Integer.valueOf(hexARGB.substring(1, 3), 16); // red

src/main/java/util/validator/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class Constants {
1313
public static final String SCREENSHOT = "screenshot";
1414
public static final String ELEMENT_NAME = "elementName";
1515
public static final String ROOT_ELEMENT = "rootElement";
16+
public static final String TIME_EXECUTION = "timeExecution";
1617
public static final String TARGET_AUTOMOTION_JSON = "target/automotion/json/";
1718
public static final String TARGET_AUTOMOTION_IMG = "target/automotion/img/";
1819
public static final String TARGET_AUTOMOTION = "target/automotion/";

src/main/java/util/validator/ResponsiveUIValidator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class ResponsiveUIValidator implements Validator {
5151
private boolean drawTopOffsetLine = false;
5252
private boolean drawBottomOffsetLine = false;
5353
private Units units = PX;
54+
private long startTime;
5455

5556
public ResponsiveUIValidator(WebDriver driver) {
5657
this.driver = driver;
@@ -74,6 +75,7 @@ public ResponsiveUIValidator findElement(WebElement element, String readableName
7475
pageHeight = driver.manage().window().getSize().getHeight();
7576
rootElementRightOffset = pageWidth - xRoot + widthRoot;
7677
rootElementBottomOffset = pageHeight - yRoot + heightRoot;
78+
startTime = System.currentTimeMillis();
7779
return this;
7880
}
7981

@@ -406,6 +408,7 @@ public boolean validate() {
406408
rootDetails.put(HEIGHT, heightRoot);
407409

408410
jsonResults.put(ROOT_ELEMENT, rootDetails);
411+
jsonResults.put(TIME_EXECUTION, String.valueOf(System.currentTimeMillis() - startTime) + " milliseconds");
409412
jsonResults.put(ELEMENT_NAME, rootElementReadableName);
410413
jsonResults.put(SCREENSHOT, rootElementReadableName.replace(" ", "") + "-" + screenshot.getName());
411414
}

src/test/java/ResponsiveValidatorTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,4 @@ public void testThatResponsiveValidatorWorks() {
5858

5959
driver.quit();
6060
}
61-
6261
}

0 commit comments

Comments
 (0)