Skip to content

Commit 4975a33

Browse files
committed
[improve-html-report] - commit 12
1 parent be21192 commit 4975a33

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
<plugin>
130130
<groupId>net.itarray</groupId>
131131
<artifactId>automotion-maven-plugin</artifactId>
132-
<version>1.0.0</version>
132+
<version>1.0.1</version>
133133
</plugin>
134134
</plugins>
135135
</build>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class DrawableScreenshot {
2424
public DrawableScreenshot(Vector extend, SimpleTransform transform, DrawingConfiguration drawingConfiguration, String rootElementReadableName, File screenshotName) {
2525
this.drawingConfiguration = drawingConfiguration;
2626
this.screenshotName = screenshotName;
27-
drawingsOutput = new File(TARGET_AUTOMOTION_IMG + rootElementReadableName.replace(" ", "") + "-draw-" + System.currentTimeMillis() + Helper.getGeneratedStringWithLength(7) + ".png");
27+
drawingsOutput = new File(TARGET_AUTOMOTION_IMG + rootElementReadableName.replaceAll("[\\W]|_", "") + "-draw-" + System.currentTimeMillis() + Helper.getGeneratedStringWithLength(7) + ".png");
2828

2929
try {
3030
this.extend = extend;
@@ -41,7 +41,7 @@ public DrawableScreenshot(Vector extend, SimpleTransform transform, DrawingConfi
4141
}
4242

4343
public static File takeScreenshot(DriverFacade driver, String rootElementReadableName) {
44-
File screenshotName = new File(TARGET_AUTOMOTION_IMG + rootElementReadableName.replace(" ", "") + "-" + System.currentTimeMillis() + Helper.getGeneratedStringWithLength(7) + ".png");
44+
File screenshotName = new File(TARGET_AUTOMOTION_IMG + rootElementReadableName.replaceAll("[\\W]|_", "") + "-" + System.currentTimeMillis() + Helper.getGeneratedStringWithLength(7) + ".png");
4545
driver.takeScreenshot(screenshotName);
4646
return screenshotName;
4747
}

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.json.simple.parser.JSONParser;
2323
import org.json.simple.parser.ParseException;
2424

25+
import java.awt.*;
2526
import java.io.*;
2627
import java.nio.charset.StandardCharsets;
2728
import java.text.SimpleDateFormat;
@@ -200,10 +201,21 @@ private Html buildHtml() throws IOException, ParseException {
200201
new Div(this,
201202
new ClassAttribute("row")) {{
202203
new Div(this,
203-
new Style("background-color: rgb(0,191,255); color: white; padding: 10px;")) {{
204-
new H1(this, new Style("font-size:22px; font-weight: 200;")) {{
204+
new Style("background-color: rgb(0,191,255); color: white; padding: 10px; height: 90px")) {{
205+
new H1(this, new Style("font-size:22px; font-weight: 200;"),
206+
new ClassAttribute("col-md-10")) {{
205207
new NoTag(this, String.format("Results from: %s", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
206208
}};
209+
// new com.webfirmframework.wffweb.tag.html.formsandinputs.Button(this,
210+
// new Style("margin: 10px"),
211+
// new ClassAttribute("col-md-1 btn btn-success")){{
212+
// new NoTag(this, "Passed");
213+
// }};
214+
// new com.webfirmframework.wffweb.tag.html.formsandinputs.Button(this,
215+
// new Style("margin: 10px"),
216+
// new ClassAttribute("col-md-1 btn btn-danger")){{
217+
// new NoTag(this, "Failed");
218+
// }};
207219
}};
208220
}};
209221

@@ -233,15 +245,18 @@ private Html buildHtml() throws IOException, ParseException {
233245
boolean isFailed = (Boolean) jsonObject.get("error");
234246

235247
counter++;
236-
248+
String className;
237249
if (isFailed) {
238250
failuresCounter++;
251+
className = "failed";
239252
} else {
240253
successCounter++;
254+
className = "passed";
241255
}
242256

243257
barDuration += String.format("%s, ", ((String) jsonObject.get(TIME_EXECUTION)).split(" ")[0]);
244258
barScenariosNames += String.format("'%d. %s', ", counter, jsonObject.get(SCENARIO));
259+
String finalClassName = className;
245260
new Div(this,
246261
new ClassAttribute("row")) {
247262
{
@@ -251,7 +266,7 @@ private Html buildHtml() throws IOException, ParseException {
251266
}
252267
new Div(this,
253268
new Style("margin-top:2px;" + bgColor),
254-
new ClassAttribute("accordion")) {{
269+
new ClassAttribute("accordion " + finalClassName)) {{
255270
new H1(this,
256271
new Style("color: rgb(47,79,79); font-size:24px; font-size:18px; font-weight: 300; text-decoration: underline;")) {{
257272
new NoTag(this, String.format("Scenario: \"%s\"", jsonObject.get(SCENARIO)));

src/test/java/ResponsiveValidatorNewDSLTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import net.itarray.automotion.internal.FinalReportBuilder;
12
import net.itarray.automotion.tools.driver.WebDriverFactory;
23
import net.itarray.automotion.tools.helpers.EnvironmentHelper;
34
import net.itarray.automotion.validation.ResponsiveUIValidator;
@@ -149,14 +150,14 @@ public void testThatResponsiveValidatorWorks() {
149150
responsiveUIValidator.generateReport("Home Page");
150151
time("-9-");
151152

152-
// try {
153-
// new FinalReportBuilder().execute();
154-
// } catch (MojoExecutionException e) {
155-
// e.printStackTrace();
156-
// }
157153
softly.assertAll();
158154
}
159155

156+
@Test
157+
public void testFinalReport() {
158+
new FinalReportBuilder().execute();
159+
}
160+
160161
@After
161162
public void tearDown() {
162163
if (driver != null) {

0 commit comments

Comments
 (0)