Skip to content

Commit f1b9c01

Browse files
author
Denys Zaiats
committed
[1.4.1-fix] - added FIX for building results. Fixed methods for validation of the same size and Grid.
1 parent ffaa175 commit f1b9c01

File tree

3 files changed

+84
-76
lines changed

3 files changed

+84
-76
lines changed

pom.xml

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -39,68 +39,68 @@
3939
<maven.compiler.target>1.8</maven.compiler.target>
4040
</properties>
4141

42-
<build>
43-
<plugins>
44-
<plugin>
45-
<groupId>org.apache.maven.plugins</groupId>
46-
<artifactId>maven-gpg-plugin</artifactId>
47-
<executions>
48-
<execution>
49-
<id>sign-artifacts</id>
50-
<phase>verify</phase>
51-
<goals>
52-
<goal>sign</goal>
53-
</goals>
54-
</execution>
55-
</executions>
56-
</plugin>
42+
<!--<build>-->
43+
<!--<plugins>-->
44+
<!--<plugin>-->
45+
<!--<groupId>org.apache.maven.plugins</groupId>-->
46+
<!--<artifactId>maven-gpg-plugin</artifactId>-->
47+
<!--<executions>-->
48+
<!--<execution>-->
49+
<!--<id>sign-artifacts</id>-->
50+
<!--<phase>verify</phase>-->
51+
<!--<goals>-->
52+
<!--<goal>sign</goal>-->
53+
<!--</goals>-->
54+
<!--</execution>-->
55+
<!--</executions>-->
56+
<!--</plugin>-->
5757

58-
<plugin>
59-
<groupId>org.sonatype.plugins</groupId>
60-
<artifactId>nexus-staging-maven-plugin</artifactId>
61-
<version>1.6.3</version>
62-
<extensions>true</extensions>
63-
<configuration>
64-
<serverId>ossrh</serverId>
65-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
66-
<stagingProfileId>22f8da536d8418</stagingProfileId> <!--Staging-->
67-
<!--<stagingProfileId>7edbe315063867</stagingProfileId> &lt;!&ndash;Central staging&ndash;&gt;-->
68-
<skipStagingRepositoryClose>true</skipStagingRepositoryClose>
69-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
70-
</configuration>
71-
</plugin>
58+
<!--<plugin>-->
59+
<!--<groupId>org.sonatype.plugins</groupId>-->
60+
<!--<artifactId>nexus-staging-maven-plugin</artifactId>-->
61+
<!--<version>1.6.3</version>-->
62+
<!--<extensions>true</extensions>-->
63+
<!--<configuration>-->
64+
<!--<serverId>ossrh</serverId>-->
65+
<!--<nexusUrl>https://oss.sonatype.org/</nexusUrl>-->
66+
<!--<stagingProfileId>22f8da536d8418</stagingProfileId> &lt;!&ndash;Staging&ndash;&gt;-->
67+
<!--&lt;!&ndash;<stagingProfileId>7edbe315063867</stagingProfileId> &lt;!&ndash;Central staging&ndash;&gt;&ndash;&gt;-->
68+
<!--<skipStagingRepositoryClose>true</skipStagingRepositoryClose>-->
69+
<!--<autoReleaseAfterClose>true</autoReleaseAfterClose>-->
70+
<!--</configuration>-->
71+
<!--</plugin>-->
7272

73-
<plugin>
74-
<groupId>org.apache.maven.plugins</groupId>
75-
<artifactId>maven-source-plugin</artifactId>
76-
<executions>
77-
<execution>
78-
<id>attach-sources</id>
79-
<goals>
80-
<goal>jar</goal>
81-
</goals>
82-
</execution>
83-
</executions>
84-
</plugin>
73+
<!--<plugin>-->
74+
<!--<groupId>org.apache.maven.plugins</groupId>-->
75+
<!--<artifactId>maven-source-plugin</artifactId>-->
76+
<!--<executions>-->
77+
<!--<execution>-->
78+
<!--<id>attach-sources</id>-->
79+
<!--<goals>-->
80+
<!--<goal>jar</goal>-->
81+
<!--</goals>-->
82+
<!--</execution>-->
83+
<!--</executions>-->
84+
<!--</plugin>-->
8585

86-
<plugin>
87-
<groupId>org.apache.maven.plugins</groupId>
88-
<artifactId>maven-javadoc-plugin</artifactId>
89-
<executions>
90-
<execution>
91-
<id>attach-javadocs</id>
92-
<goals>
93-
<goal>jar</goal>
94-
</goals>
95-
</execution>
96-
</executions>
97-
<configuration>
98-
<additionalparam>-Xdoclint:none</additionalparam>
99-
</configuration>
100-
</plugin>
86+
<!--<plugin>-->
87+
<!--<groupId>org.apache.maven.plugins</groupId>-->
88+
<!--<artifactId>maven-javadoc-plugin</artifactId>-->
89+
<!--<executions>-->
90+
<!--<execution>-->
91+
<!--<id>attach-javadocs</id>-->
92+
<!--<goals>-->
93+
<!--<goal>jar</goal>-->
94+
<!--</goals>-->
95+
<!--</execution>-->
96+
<!--</executions>-->
97+
<!--<configuration>-->
98+
<!--<additionalparam>-Xdoclint:none</additionalparam>-->
99+
<!--</configuration>-->
100+
<!--</plugin>-->
101101

102-
</plugins>
103-
</build>
102+
<!--</plugins>-->
103+
<!--</build>-->
104104

105105
<distributionManagement>
106106
<snapshotRepository>

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package util.general;
22

33
import java.awt.*;
4+
import java.io.File;
45
import java.lang.reflect.Field;
56

7+
import static util.validator.Constants.TARGET_AUTOMOTION_JSON;
8+
69
public class SystemHelper {
710
public static boolean isRetinaDisplay(Graphics2D g) {
811
boolean isRetina = false;
@@ -53,4 +56,10 @@ public static String hexStringToARGB(String hexARGB) throws IllegalArgumentExcep
5356
return String.format("rgb(%d,%d,%d)", intARGB[0], intARGB[1], intARGB[2]);
5457
}
5558
}
59+
60+
public static boolean isAutomotionFolderExists(){
61+
File file = new File(TARGET_AUTOMOTION_JSON);
62+
63+
return file != null && file.exists() && file.isDirectory() && file.list().length > 0;
64+
}
5665
}

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

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.concurrent.atomic.AtomicLong;
2626

2727
import static environment.EnvironmentFactory.isChrome;
28+
import static util.general.SystemHelper.isAutomotionFolderExists;
2829
import static util.validator.Constants.*;
2930
import static util.validator.ResponsiveUIValidator.Units.PX;
3031

@@ -473,7 +474,7 @@ public boolean validate() {
473474

474475
@Override
475476
public void generateReport() {
476-
if (withReport && (boolean) jsonResults.get(ERROR_KEY)) {
477+
if (withReport && isAutomotionFolderExists()) {
477478
try {
478479
new HtmlReportBuilder().buildReport();
479480
} catch (IOException | ParseException | InterruptedException e) {
@@ -484,7 +485,7 @@ public void generateReport() {
484485

485486
@Override
486487
public void generateReport(String name) {
487-
if (withReport && (boolean) jsonResults.get(ERROR_KEY)) {
488+
if (withReport && isAutomotionFolderExists()) {
488489
try {
489490
new HtmlReportBuilder().buildReport(name);
490491
} catch (IOException | ParseException | InterruptedException e) {
@@ -553,7 +554,7 @@ private void validateGridAlignment(int columns, int rows) {
553554

554555
if (rows > 0) {
555556
if (map.size() != rows) {
556-
putJsonDetailsWithoutElement("Elements in a grid are not aligned properly.");
557+
putJsonDetailsWithoutElement("Elements in a grid are not aligned properly. Looks like grid has wrong amount of rows. Expected is " + rows + ". Actual is " + map.size() + "");
557558
}
558559
}
559560

@@ -567,11 +568,12 @@ private void validateGridAlignment(int columns, int rows) {
567568
rowCount++;
568569
}
569570
}
570-
} else {
571-
if (map.size() == rootElements.size()) {
572-
putJsonDetailsWithoutElement("Elements are not aligned in a grid.");
573-
}
574571
}
572+
// else {
573+
// if (map.size() == rootElements.size()) {
574+
// putJsonDetailsWithoutElement("Elements are not aligned in a grid.");
575+
// }
576+
// }
575577
}
576578

577579
// List<WebElement> row = new ArrayList<>();
@@ -728,17 +730,14 @@ private void validateSameSize(WebElement element, String readableName) {
728730
}
729731

730732
private void validateSameSize(List<WebElement> elements) {
731-
for (WebElement el1 : elements) {
732-
for (WebElement el2 : elements) {
733-
if (!el1.equals(el2)) {
734-
int h1 = el1.getSize().getHeight();
735-
int w1 = el1.getSize().getWidth();
736-
int h2 = el2.getSize().getHeight();
737-
int w2 = el2.getSize().getWidth();
738-
if (h1 != h2 || w1 != w2) {
739-
putJsonDetailsWithElement("Elements in a grid have different size.", el1);
740-
}
741-
}
733+
for (int i = 0; i < elements.size() - 1; i ++){
734+
int h1 = elements.get(i).getSize().getHeight();
735+
int w1 = elements.get(i).getSize().getWidth();
736+
int h2 = elements.get(i + 1).getSize().getHeight();
737+
int w2 = elements.get(i + 1).getSize().getWidth();
738+
if (h1 != h2 || w1 != w2) {
739+
putJsonDetailsWithElement("Elements in a grid have different size.", elements.get(i));
740+
putJsonDetailsWithElement("Elements in a grid have different size.", elements.get(i + 1));
742741
}
743742
}
744743
}

0 commit comments

Comments
 (0)