Skip to content

Commit b09ef0c

Browse files
author
Denys Zaiats
committed
[responsive-validator] - added verification for absences of CSS values
1 parent 296693a commit b09ef0c

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void buildReport() throws IOException, ParseException, InterruptedExcepti
7676
new Img(this,
7777
new Src("img/" + jsonObject.get(SCREENSHOT)),
7878
new Alt("screenshot"),
79-
new Style("width: 90%; margin-left:5%"));
79+
new Style("width: 96%; margin-left:2%"));
8080
}};
8181
}
8282
}

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,24 @@ public ResponsiveUIValidator withCssValue(String cssProperty, String... args) {
321321
for (String val : args) {
322322
val = !val.startsWith("#") ? val : SystemHelper.hexStringToARGB(val);
323323
if (!TextFinder.textIsFound(val, cssValue)) {
324-
putJsonDetailsWithoutElement(String.format("Expected value of '%s' is '%s'. Actual is '%s'", cssProperty, val, cssValue));
324+
putJsonDetailsWithoutElement(String.format("Expected value of '%s' is '%s'. Actual value is '%s'", cssProperty, val, cssValue));
325+
}
326+
}
327+
}else{
328+
putJsonDetailsWithoutElement(String.format("Element '%s' does not have css property '%s'", rootElementReadableName, cssProperty));
329+
}
330+
return this;
331+
}
332+
333+
@Override
334+
public ResponsiveUIValidator withoutCssValue(String cssProperty, String... args) {
335+
String cssValue = rootElement.getCssValue(cssProperty);
336+
337+
if (!cssValue.equals("")) {
338+
for (String val : args) {
339+
val = !val.startsWith("#") ? val : SystemHelper.hexStringToARGB(val);
340+
if (TextFinder.textIsFound(val, cssValue)) {
341+
putJsonDetailsWithoutElement(String.format("CSS property '%s' should not contain value '%s'. Actual value is '%s'", cssProperty, val, cssValue));
325342
}
326343
}
327344
}else{

src/main/java/util/validator/Validator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ interface Validator {
7979

8080
ResponsiveUIValidator withCssValue(String cssProperty, String... args);
8181

82+
ResponsiveUIValidator withoutCssValue(String cssProperty, String... args);
83+
8284
ResponsiveUIValidator drawMap();
8385

8486
boolean validate();

0 commit comments

Comments
 (0)