-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
384 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,314 @@ | ||
|
||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<title></title> | ||
<link rel="apple-touch-icon" href="https://cdn.jsdelivr.net/gh/extent-framework/extent-github-cdn@b00a2d0486596e73dd7326beacf352c639623a0e/commons/img/logo.png"> | ||
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/extent-framework/extent-github-cdn@b00a2d0486596e73dd7326beacf352c639623a0e/commons/img/logo.png"> | ||
<link href="https://cdn.jsdelivr.net/gh/extent-framework/extent-github-cdn@d6562a79075e061305ccfdb82f01e5e195e2d307/spark/css/spark-style.css" rel="stylesheet" /> | ||
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> | ||
<script src="https://cdn.jsdelivr.net/gh/extent-framework/extent-github-cdn@7cc78ce/spark/js/jsontree.js"></script> | ||
<style type="text/css"></style></head><body class="spa -report standard"> | ||
<div class="app"> | ||
<div class="layout"> | ||
<div class="header navbar"> | ||
<div class="vheader"> | ||
<div class="nav-logo"> | ||
<a href="#"> | ||
<div class="logo" style="background-image: url('https://cdn.jsdelivr.net/gh/extent-framework/extent-github-cdn@b00a2d0486596e73dd7326beacf352c639623a0e/commons/img/logo.png')"></div> | ||
</a> | ||
</div> | ||
<ul class="nav-left"> | ||
<li class="search-box"> | ||
<a class="search-toggle" href="#"> | ||
<i class="search-icon fa fa-search"></i> | ||
<i class="search-icon-close fa fa-close"></i> | ||
</a> | ||
</li> | ||
<li class="search-input"><input id="search-tests" class="form-control" type="text" placeholder="Search..."></li> | ||
</ul> | ||
<ul class="nav-right"> | ||
<li class="m-r-10"> | ||
<a href="#"><span class="badge badge-primary">Extent Report | Anh Tester</span></a> | ||
</li> | ||
<li class="m-r-10"> | ||
<a href="#"><span class="badge badge-primary">Mar 31, 2023 12:09:47 PM</span></a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div><div class="side-nav"> | ||
<div class="side-nav-inner"> | ||
<ul class="side-nav-menu"> | ||
<li class="nav-item dropdown" onclick="toggleView('test-view')"> | ||
<a id="nav-test" class="dropdown-toggle" href="#"> | ||
<span class="ico"><i class="fa fa-list"></i></span> | ||
</a> | ||
</li> | ||
<li class="nav-item dropdown" onclick="toggleView('dashboard-view')"> | ||
<a id="nav-dashboard" class="dropdown-toggle" href="#"> | ||
<span class="ico"><i class="fa fa-bar-chart"></i></span> | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> <div class="vcontainer"> | ||
<div class="main-content"> | ||
<div class="test-wrapper row view test-view"> | ||
<div class="test-list"> | ||
<div class="test-list-tools"> | ||
<ul class="tools pull-left"> | ||
<li><a href="#"><span class="font-size-14">Tests</span></a></li> | ||
</ul> | ||
<ul class="tools text-right"> | ||
<li class="dropdown"> | ||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-exclamation-circle"></i></a> | ||
<ul id="status-toggle" class="dropdown-menu dropdown-md p-v-0"> | ||
<a class="dropdown-item" status="pass" href="#"><span>Pass</span><span class="status success"></span></a> | ||
<div class="dropdown-divider"></div> | ||
<a status="clear" class="dropdown-item" href="#"><span>Clear</span><span class="pull-right"><i class="fa fa-close"></i></span></a> | ||
</ul> | ||
</li> | ||
</ul> | ||
</div> <div class="test-list-wrapper scrollable"> | ||
<ul class="test-list-item"> | ||
<li class="test-item" status="pass" test-id="1" | ||
author="" | ||
tag="" | ||
device=""> | ||
<div class="test-detail"> | ||
<p class="name">testSetDataToExcel</p> | ||
<p class="text-sm"> | ||
<span>12:09:47 PM</span> / <span>00:00:21:597</span> | ||
<span class="badge pass-bg log float-right">Pass</span> | ||
</p> | ||
</div> | ||
<div class="test-contents d-none"> | ||
<div class="detail-head"> | ||
<div class="p-v-10"> | ||
<div class="info"> | ||
<h5 class="test-status text-pass">testSetDataToExcel</h5> | ||
<span class='badge badge-success'>03.31.2023 12:09:47 PM</span> | ||
<span class='badge badge-danger'>03.31.2023 12:10:09 PM</span> | ||
<span class='badge badge-default'>00:00:21:597</span> | ||
· <span class='uri-anchor badge badge-default'>#test-id=1</span> | ||
<span class='badge badge-default pointer float-right ml-1 et'><i class="fa fa-chevron-down"></i></span> | ||
<span class='badge badge-default pointer float-right ct'><i class="fa fa-chevron-up"></i></span> | ||
</div> | ||
<div class="m-t-10 m-l-5"></div> | ||
</div> | ||
</div><div class="detail-body mt-4"> | ||
<table class="table table-sm"> | ||
<thead><tr><th class="status-col">Status</th><th class="timestamp-col">Timestamp</th><th class="details-col">Details</th></tr></thead> | ||
<tbody> | ||
<tr class="event-row"> | ||
<td><span class="badge log pass-bg">Pass</span></td> | ||
<td>12:09:48 PM</td> | ||
<td> | ||
Open URL: https://crm.anhtester.com/admin/authentication | ||
</td> | ||
</tr> | ||
<tr class="event-row"> | ||
<td><span class="badge log pass-bg">Pass</span></td> | ||
<td>12:09:48 PM</td> | ||
<td> | ||
Get text of element By.xpath: //h1 | ||
</td> | ||
</tr> | ||
<tr class="event-row"> | ||
<td><span class="badge log info-bg">Info</span></td> | ||
<td>12:09:48 PM</td> | ||
<td> | ||
==> Text: Login | ||
</td> | ||
</tr> | ||
<tr class="event-row"> | ||
<td><span class="badge log pass-bg">Pass</span></td> | ||
<td>12:09:48 PM</td> | ||
<td> | ||
Set text admin@example.com on element By.xpath: //input[@id='email'] | ||
</td> | ||
</tr> | ||
<tr class="event-row"> | ||
<td><span class="badge log pass-bg">Pass</span></td> | ||
<td>12:09:48 PM</td> | ||
<td> | ||
Set text 123456 on element By.xpath: //input[@id='password'] | ||
</td> | ||
</tr> | ||
<tr class="event-row"> | ||
<td><span class="badge log pass-bg">Pass</span></td> | ||
<td>12:10:03 PM</td> | ||
<td> | ||
Click on element By.xpath: //button[normalize-space()='Login'] | ||
</td> | ||
</tr> | ||
<tr class="event-row"> | ||
<td><span class="badge log pass-bg">Pass</span></td> | ||
<td>12:10:09 PM</td> | ||
<td> | ||
testSetDataToExcel is passed. | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<div class="test-content scrollable"> | ||
<div class="test-content-tools"> | ||
<ul><li><a class="back-to-test" href="#"><i class="fa fa-arrow-left"></i></a></li></ul> | ||
</div> | ||
<div class="test-content-detail"><div class="detail-body"></div></div> | ||
</div></div> | ||
<div class="container-fluid p-4 view dashboard-view"> | ||
<div class="row"> | ||
<div class="col-md-3"> | ||
<div class="card"><div class="card-body"> | ||
<p class="m-b-0">Started</p> | ||
<h3>Mar 31, 2023 12:09:47 PM</h3> | ||
</div></div> | ||
</div> | ||
<div class="col-md-3"> | ||
<div class="card"><div class="card-body"> | ||
<p class="m-b-0">Ended</p> | ||
<h3>Mar 31, 2023 12:10:09 PM</h3> | ||
</div></div> | ||
</div> | ||
<div class="col-md-3"> | ||
<div class="card"><div class="card-body"> | ||
<p class="m-b-0 text-pass">Tests Passed</p> | ||
<h3>1</h3> | ||
</div></div> | ||
</div> | ||
<div class="col-md-3"> | ||
<div class="card"><div class="card-body"> | ||
<p class="m-b-0 text-fail">Tests Failed</p> | ||
<h3>0</h3> | ||
</div></div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<div class="card"> | ||
<div class="card-header"> | ||
<h6 class="card-title">Tests</h6> | ||
</div> | ||
<div class="card-body"> | ||
<div class=""> | ||
<canvas id='parent-analysis' width='115' height='90'></canvas> | ||
</div> | ||
</div> | ||
<div class="card-footer"> | ||
<div><small data-tooltip='100%'> | ||
<b>1</b> tests passed | ||
</small> | ||
</div> | ||
<div> | ||
<small data-tooltip='0%'><b>0</b> tests failed, | ||
<b>0</b> skipped, <b data-tooltip='0%'>0</b> others | ||
</small> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-md-6"> | ||
<div class="card"> | ||
<div class="card-header"> | ||
<h6 class="card-title">Log events</h6> | ||
</div> | ||
<div class="card-body"> | ||
<div class=""> | ||
<canvas id='events-analysis' width='115' height='90'></canvas> | ||
</div> | ||
</div> | ||
<div class="card-footer"> | ||
<div><small data-tooltip='85%'><b>6</b> events passed</small></div> | ||
<div> | ||
<small data-tooltip='0%'><b>0</b> events failed, | ||
<b data-tooltip='%'>1</b> others | ||
</small> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"><div class="col-md-12"> | ||
<div class="card"><div class="card-header"><p>Timeline</p></div> | ||
<div class="card-body pt-0"><div> | ||
<canvas id="timeline" height="120"></canvas> | ||
</div></div> | ||
</div> | ||
</div></div> | ||
<script> | ||
var timeline = { | ||
"testSetDataToExcel":21.597 | ||
}; | ||
</script> | ||
<div class="row"> | ||
<div class="col-lg-6 col-md-12 sysenv-container"> | ||
<div class="card"> | ||
<div class="card-header"><p>System/Environment</p></div> | ||
<div class="card-body pb-0 pt-0"><table class="table table-sm table-bordered"> | ||
<thead><tr class="bg-gray"><th>Name</th><th>Value</th></tr></thead> | ||
<tbody> | ||
<tr> | ||
<td>Framework Name</td> | ||
<td>Selenium Java | Anh Tester</td> | ||
</tr> | ||
<tr> | ||
<td>Author</td> | ||
<td>Anh Tester</td> | ||
</tr> | ||
<tr> | ||
<td>Framework Name</td> | ||
<td>Selenium Java | Anh Tester</td> | ||
</tr> | ||
<tr> | ||
<td>Author</td> | ||
<td>Anh Tester</td> | ||
</tr> | ||
</tbody> | ||
</table></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<script> | ||
var statusGroup = { | ||
parentCount: 5, | ||
passParent: 1, | ||
failParent: 0, | ||
warningParent: 0, | ||
skipParent: 0, | ||
childCount: 5, | ||
passChild: 0, | ||
failChild: 0, | ||
warningChild: 0, | ||
skipChild: 0, | ||
infoChild: 0, | ||
grandChildCount: 5, | ||
passGrandChild: 0, | ||
failGrandChild: 0, | ||
warningGrandChild: 0, | ||
skipGrandChild: 0, | ||
infoGrandChild: 0, | ||
eventsCount: 5, | ||
passEvents: 6, | ||
failEvents: 0, | ||
warningEvents: 0, | ||
skipEvents: 0, | ||
infoEvents: 1 | ||
}; | ||
</script> </div> | ||
</div> | ||
</div> | ||
</div> | ||
<script src="https://cdn.jsdelivr.net/gh/extent-framework/extent-github-cdn@d6562a79075e061305ccfdb82f01e5e195e2d307/spark/js/spark-script.js"></script> | ||
<script type="text/javascript"></script></body> | ||
</html> |
19 changes: 19 additions & 0 deletions
19
src/main/java/anhtester/com/reports/ExtentReportManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package anhtester.com.reports; | ||
|
||
import com.aventstack.extentreports.ExtentReports; | ||
import com.aventstack.extentreports.reporter.ExtentSparkReporter; | ||
|
||
public class ExtentReportManager { | ||
|
||
private static final ExtentReports extentReports = new ExtentReports(); | ||
|
||
public synchronized static ExtentReports getExtentReports() { | ||
ExtentSparkReporter reporter = new ExtentSparkReporter("reports/extentreport/extentreport.html"); | ||
reporter.config().setReportName("Extent Report | Anh Tester"); | ||
extentReports.attachReporter(reporter); | ||
extentReports.setSystemInfo("Framework Name", "Selenium Java | Anh Tester"); | ||
extentReports.setSystemInfo("Author", "Anh Tester"); | ||
return extentReports; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/anhtester/com/reports/ExtentTestManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package anhtester.com.reports; | ||
|
||
import anhtester.com.drivers.DriverManager; | ||
import com.aventstack.extentreports.ExtentReports; | ||
import com.aventstack.extentreports.ExtentTest; | ||
import com.aventstack.extentreports.MediaEntityBuilder; | ||
import com.aventstack.extentreports.Status; | ||
import org.openqa.selenium.OutputType; | ||
import org.openqa.selenium.TakesScreenshot; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ExtentTestManager { | ||
static Map<Integer, ExtentTest> extentTestMap = new HashMap<>(); | ||
static ExtentReports extent = ExtentReportManager.getExtentReports(); | ||
|
||
public static ExtentTest getTest() { | ||
return extentTestMap.get((int) Thread.currentThread().getId()); | ||
} | ||
|
||
public static synchronized ExtentTest saveToReport(String testName, String desc) { | ||
ExtentTest test = extent.createTest(testName, desc); | ||
extentTestMap.put((int) Thread.currentThread().getId(), test); | ||
return test; | ||
} | ||
|
||
public static void addScreenShot(String message) { | ||
String base64Image = "data:image/png;base64," | ||
+ ((TakesScreenshot) DriverManager.getDriver()).getScreenshotAs(OutputType.BASE64); | ||
|
||
getTest().log(Status.INFO, message, | ||
MediaEntityBuilder.createScreenCaptureFromBase64String(base64Image).build()); | ||
} | ||
|
||
public static void addScreenShot(Status status, String message) { | ||
String base64Image = "data:image/png;base64," | ||
+ ((TakesScreenshot) DriverManager.getDriver()).getScreenshotAs(OutputType.BASE64); | ||
|
||
getTest().log(status, message, | ||
MediaEntityBuilder.createScreenCaptureFromBase64String(base64Image).build()); | ||
} | ||
|
||
public static void logMessage(String message) { | ||
getTest().log(Status.INFO, message); | ||
} | ||
|
||
public static void logMessage(Status status, String message) { | ||
getTest().log(status, message); | ||
} | ||
} |