Skip to content

Commit 8200c9a

Browse files
committed
[master] - show results on hover
1 parent 06d5483 commit 8200c9a

File tree

7 files changed

+31
-14
lines changed

7 files changed

+31
-14
lines changed

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>2.0.5</version>
9+
<version>2.0.6</version>
1010
<name>Automotion</name>
1111
<description>Library for smart visual automation testing</description>
1212
<url>https://automotion.itarray.net</url>

src/main/java/net/itarray/automotion/internal/HtmlReportBuilder.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import com.webfirmframework.wffweb.tag.html.*;
44
import com.webfirmframework.wffweb.tag.html.attribute.Alt;
55
import com.webfirmframework.wffweb.tag.html.attribute.Src;
6+
import com.webfirmframework.wffweb.tag.html.attribute.event.mouse.OnMouseOut;
7+
import com.webfirmframework.wffweb.tag.html.attribute.event.mouse.OnMouseOver;
8+
import com.webfirmframework.wffweb.tag.html.attribute.global.ClassAttribute;
9+
import com.webfirmframework.wffweb.tag.html.attribute.global.Id;
610
import com.webfirmframework.wffweb.tag.html.attribute.global.Style;
711
import com.webfirmframework.wffweb.tag.html.images.Img;
812
import com.webfirmframework.wffweb.tag.html.lists.Li;
@@ -110,15 +114,18 @@ private Html buildHtml() throws IOException, ParseException {
110114
}};
111115
new P(this) {{
112116
new Div(this,
117+
new OnMouseOver("document.getElementById('" + jsonObject.get(DRAWINGS).toString()+ "').style.display = 'block'"),
118+
new OnMouseOut("document.getElementById('" + jsonObject.get(DRAWINGS).toString()+ "').style.display = 'none'"),
113119
new Style("position:relative; left: 0; top:0; width: 96%; margin-left:2%")) {{
114120
new Img(this,
115121
new Style("position:relative; left: 0; top:0"),
116122
new Src(String.format("img/%s", jsonObject.get(SCREENSHOT))),
117123
new Alt("screenshot"));
118124
new Img(this,
119-
new Style("position:absolute; left: 0; top:0"),
125+
new Id(jsonObject.get(DRAWINGS).toString()),
126+
new Style("position:absolute; left: 0; top:0; display:none;"),
120127
new Src(String.format("img/%s", jsonObject.get(DRAWINGS))),
121-
new Alt("screenshot"));
128+
new Alt("screenshot-overlay"));
122129
}};
123130

124131
}};

src/main/java/net/itarray/automotion/internal/ResponsiveUIChunkValidatorBase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public ResponsiveUIChunkValidatorBase(UISnapshot snapshot, List<WebElement> webE
3131
try {
3232
((JavascriptExecutor) getDriver().getDriver()).executeScript("arguments[0].scrollIntoView();", webElements.get(0));
3333
((JavascriptExecutor) getDriver().getDriver()).executeScript("javascript:window.scrollBy(0,250);");
34+
((JavascriptExecutor) getDriver().getDriver()).executeScript("document.documentElement.style.overflow = 'hidden'");
3435
} catch (Exception e) {}
3536
}
3637
}

src/main/java/net/itarray/automotion/internal/UIValidatorBase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public UIValidatorBase(UISnapshot snapshot, WebElement webElement, String readab
4040
try {
4141
((JavascriptExecutor) getDriver().getDriver()).executeScript("arguments[0].scrollIntoView();", webElement);
4242
((JavascriptExecutor) getDriver().getDriver()).executeScript("javascript:window.scrollBy(0,250);");
43+
((JavascriptExecutor) getDriver().getDriver()).executeScript("document.documentElement.style.overflow = 'hidden'");
4344
} catch (Exception e) {}
4445
}
4546
}

src/main/java/net/itarray/automotion/tools/general/SystemHelper.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.itarray.automotion.tools.general;
22

3+
import javafx.stage.Screen;
4+
35
import java.awt.*;
46
import java.io.File;
57
import java.lang.reflect.Field;
@@ -28,14 +30,22 @@ public static boolean isRetinaDisplay() {
2830
}
2931
}
3032
} catch (Exception e) {
31-
e.printStackTrace();
33+
isRetina = getDisplayScaleFactor() > 140;
3234
}
3335
} catch (Exception e) {
34-
e.printStackTrace();
36+
isRetina = getDisplayScaleFactor() > 140;
3537
}
3638
return isRetina;
3739
}
3840

41+
private static double getDisplayScaleFactor() {
42+
double screenHeight = Toolkit.getDefaultToolkit().getScreenSize().getHeight();
43+
double screenWidth = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
44+
int screenResolution = Toolkit.getDefaultToolkit().getScreenResolution();
45+
46+
return screenResolution;
47+
}
48+
3949
/**
4050
* Convert hex color to rgb or rgba
4151
*

src/test/java/ResponsiveValidatorCompatibleTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import http.helpers.EnvironmentHelper;
1+
import net.itarray.automotion.tools.driver.DriverHelper;
2+
import net.itarray.automotion.tools.driver.WebDriverFactory;
3+
import net.itarray.automotion.tools.helpers.EnvironmentHelper;
24
import net.itarray.automotion.validation.ResponsiveUIValidator;
35
import net.itarray.automotion.validation.properties.Padding;
46
import org.assertj.core.api.SoftAssertions;
@@ -9,8 +11,6 @@
911
import org.openqa.selenium.WebDriver;
1012
import org.openqa.selenium.WebElement;
1113
import org.openqa.selenium.phantomjs.PhantomJSDriverService;
12-
import util.driver.DriverHelper;
13-
import util.driver.WebDriverFactory;
1414

1515
import java.awt.*;
1616
import java.util.HashMap;

src/test/java/ResponsiveValidatorTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import http.helpers.EnvironmentHelper;
1+
import net.itarray.automotion.tools.driver.DriverHelper;
2+
import net.itarray.automotion.tools.driver.WebDriverFactory;
3+
import net.itarray.automotion.tools.helpers.EnvironmentHelper;
4+
import net.itarray.automotion.validation.ResponsiveUIValidator;
25
import org.assertj.core.api.SoftAssertions;
36
import org.junit.After;
47
import org.junit.Ignore;
@@ -7,18 +10,13 @@
710
import org.openqa.selenium.WebDriver;
811
import org.openqa.selenium.WebElement;
912
import org.openqa.selenium.phantomjs.PhantomJSDriverService;
10-
import util.driver.DriverHelper;
11-
import util.driver.WebDriverFactory;
12-
import util.validator.ResponsiveUIValidator;
1313
import util.validator.properties.Padding;
1414

1515
import java.awt.*;
1616
import java.util.HashMap;
1717
import java.util.Map;
1818

19-
import static net.itarray.automotion.validation.properties.Expression.percentOrPixels;
2019
import static net.itarray.automotion.validation.properties.Condition.between;
21-
import static net.itarray.automotion.validation.properties.Expression.percent;
2220

2321
@Ignore
2422
public class ResponsiveValidatorTest {

0 commit comments

Comments
 (0)