Skip to content

Commit 6f563f4

Browse files
committed
[issue-24] - fix drawing and parallel execution
1 parent 5bc4aeb commit 6f563f4

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ public class ResponsiveUIValidator {
3535
protected static WebDriver driver;
3636
static WebElement rootElement;
3737
static long startTime;
38-
static boolean drawLeftOffsetLine = false;
39-
static boolean drawRightOffsetLine = false;
40-
static boolean drawTopOffsetLine = false;
41-
static boolean drawBottomOffsetLine = false;
4238
private static boolean isMobileTopBar = false;
4339
private static boolean withReport = false;
4440
private static String scenarioName = "Default";
4541
private static Color rootColor = new Color(255, 0, 0, 255);
4642
private static Color highlightedElementsColor = new Color(255, 0, 255, 255);
4743
private static Color linesColor = Color.ORANGE;
4844
private static String currentZoom = "100%";
45+
private static List<String> jsonFiles = new ArrayList<>();
4946
private static File screenshot;
5047
private static BufferedImage img;
5148
private static Graphics2D g;
5249
private static JSONArray errorMessage;
53-
private static List<String> jsonFiles = new ArrayList<>();
50+
boolean drawLeftOffsetLine = false;
51+
boolean drawRightOffsetLine = false;
52+
boolean drawTopOffsetLine = false;
53+
boolean drawBottomOffsetLine = false;
5454
String rootElementReadableName = "Root Element";
5555
List<WebElement> rootElements;
5656
ResponsiveUIValidator.Units units = PX;
@@ -861,7 +861,7 @@ private boolean elementsAreOverlapped(WebElement elementOverlapWith) {
861861
return ((xRoot >= elLoc.x && yRoot > elLoc.y && xRoot < elLoc.x + elSize.width && yRoot < elLoc.y + elSize.height)
862862
|| (xRoot + widthRoot > elLoc.x && yRoot > elLoc.y && xRoot + widthRoot < elLoc.x + elSize.width && yRoot < elLoc.y + elSize.height)
863863
|| (xRoot > elLoc.x && yRoot + heightRoot > elLoc.y && xRoot < elLoc.x + elSize.width && yRoot + heightRoot < elLoc.y + elSize.height)
864-
|| (xRoot + widthRoot > elLoc.x && yRoot + heightRoot > elLoc.y && xRoot + widthRoot < elLoc.x + elSize.width && yRoot + widthRoot < elLoc.y + elSize.height))
864+
|| (xRoot + widthRoot > elLoc.x && yRoot + heightRoot > elLoc.y && xRoot + widthRoot < elLoc.x + elSize.width && yRoot + heightRoot < elLoc.y + elSize.height))
865865

866866
|| ((elLoc.x > xRoot && elLoc.y > yRoot && elLoc.x + elSize.width < xRoot && elLoc.y + elSize.height < yRoot)
867867
|| (elLoc.x > xRoot + widthRoot && elLoc.y > yRoot && elLoc.x + elSize.width < xRoot + widthRoot && elLoc.y + elSize.height < yRoot)
@@ -882,7 +882,7 @@ private boolean elementsAreOverlapped(WebElement rootElement, WebElement element
882882
return ((xRoot > elLoc.x && yRoot > elLoc.y && xRoot < elLoc.x + elSize.width && yRoot < elLoc.y + elSize.height)
883883
|| (xRoot + widthRoot > elLoc.x && yRoot > elLoc.y && xRoot + widthRoot < elLoc.x + elSize.width && yRoot < elLoc.y + elSize.height)
884884
|| (xRoot > elLoc.x && yRoot + heightRoot > elLoc.y && xRoot < elLoc.x + elSize.width && yRoot + heightRoot < elLoc.y + elSize.height)
885-
|| (xRoot + widthRoot > elLoc.x && yRoot + heightRoot > elLoc.y && xRoot + widthRoot < elLoc.x + elSize.width && yRoot + widthRoot < elLoc.y + elSize.height))
885+
|| (xRoot + widthRoot > elLoc.x && yRoot + heightRoot > elLoc.y && xRoot + widthRoot < elLoc.x + elSize.width && yRoot + heightRoot < elLoc.y + elSize.height))
886886

887887
|| ((elLoc.x > xRoot && elLoc.y > yRoot && elLoc.x + elSize.width < xRoot && elLoc.y + elSize.height < yRoot)
888888
|| (elLoc.x > xRoot + widthRoot && elLoc.y > yRoot && elLoc.x + elSize.width < xRoot + widthRoot && elLoc.y + elSize.height < yRoot)

src/test/java/ResponsiveValidatorTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ public class ResponsiveValidatorTest {
2323
@Test
2424
public void testThatResponsiveValidatorWorks() {
2525
Map<String, String> sysProp = new HashMap<>();
26-
//sysProp.put("BROWSER", "phantomjs");
27-
//sysProp.put("IS_HEADLESS", "true");
26+
//sysProp.put("BROWSER", "Chrome");
27+
//sysProp.put("IS_LOCAL", "true");
2828
sysProp.put("IS_HEADLESS", "true");
29-
sysProp.put("BROWSER", "phantomjs");
3029
sysProp.put(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "/Users/ZayCo/Downloads/phantomjs-2.1.1-macosx/bin/phantomjs");
3130
EnvironmentHelper.setEnv(sysProp);
3231
WebDriverFactory driverFactory = new WebDriverFactory();

0 commit comments

Comments
 (0)