Skip to content

Commit 3b8c6d4

Browse files
committed
Update version 1.6.0 PREVIEW
1 parent d0243e2 commit 3b8c6d4

13 files changed

Lines changed: 43 additions & 75 deletions

File tree

src/main/java/anhtester/com/constants/FrameworkConstants.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ private FrameworkConstants() {
4040
public static final String screenshot_failed_steps = PropertiesHelpers.getValue("screenshot_failed_steps");
4141
public static final String screenshot_skipped_steps = PropertiesHelpers.getValue("screenshot_skipped_steps");
4242
public static final String screenshot_all_steps = PropertiesHelpers.getValue("screenshot_all_steps");
43+
public static final String zip_folder = PropertiesHelpers.getValue("zip_folder");
44+
public static final String video_record = PropertiesHelpers.getValue("video_record");
4345

4446
public static final int WAIT_DEFAULT = Integer.parseInt(PropertiesHelpers.getValue("WAIT_DEFAULT"));
4547
public static final int WAIT_IMPLICIT = Integer.parseInt(PropertiesHelpers.getValue("WAIT_IMPLICIT"));
@@ -71,11 +73,11 @@ private FrameworkConstants() {
7173
public static final String ICON_OS_MAC = "<i class='fa fa-apple' ></i>";
7274
public static final String ICON_OS_LINUX = "<i class='fa fa-linux' ></i>";
7375

74-
public static final String ICON_BROWSER_OPERA = "<i class=\"fa fa-opera\" aria-hidden=\"true\"></i>";
75-
public static final String ICON_BROWSER_EDGE = "<i class=\"fa fa-edge\" aria-hidden=\"true\"></i>";
76-
public static final String ICON_BROWSER_CHROME = "<i class=\"fa fa-chrome\" aria-hidden=\"true\"></i>";
77-
public static final String ICON_BROWSER_FIREFOX = "<i class=\"fa fa-firefox\" aria-hidden=\"true\"></i>";
78-
public static final String ICON_BROWSER_SAFARI = "<i class=\"fa fa-safari\" aria-hidden=\"true\"></i>";
76+
public static final String ICON_BROWSER_OPERA = "<i class=\"fa fa-opera\" aria-hidden=\"true\"></i>";
77+
public static final String ICON_BROWSER_EDGE = "<i class=\"fa fa-edge\" aria-hidden=\"true\"></i>";
78+
public static final String ICON_BROWSER_CHROME = "<i class=\"fa fa-chrome\" aria-hidden=\"true\"></i>";
79+
public static final String ICON_BROWSER_FIREFOX = "<i class=\"fa fa-firefox\" aria-hidden=\"true\"></i>";
80+
public static final String ICON_BROWSER_SAFARI = "<i class=\"fa fa-safari\" aria-hidden=\"true\"></i>";
7981

8082
public static final String ICON_Navigate_Right = "<i class='fa fa-arrow-circle-right' ></i>";
8183
public static final String ICON_LAPTOP = "<i class='fa fa-laptop' style='font-size:18px'></i>";

src/main/java/anhtester/com/utils/BrowserInfoUtils.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ private BrowserInfoUtils() {
1515
}
1616

1717
public static String getBrowserInfo() {
18-
// Capabilities capabilities = ((RemoteWebDriver) DriverManager.getDriver()).getCapabilities();
19-
// return capabilities.getBrowserName().toUpperCase();
2018
String browser = "";
2119
if (Reporter.getCurrentTestResult().getTestContext().getCurrentXmlTest().getParameter("browser") == null) {
2220
browser = BROWSER.toUpperCase();
@@ -26,12 +24,6 @@ public static String getBrowserInfo() {
2624
return browser;
2725
}
2826

29-
public static String getBrowserVersionInfo() {
30-
// Capabilities capabilities = ((RemoteWebDriver) DriverManager.getDriver()).getCapabilities();
31-
// return capabilities.getBrowserVersion();
32-
return "";
33-
}
34-
3527
public static String getOSInfo() {
3628
return System.getProperty("os.name").replace(" ", " ");
3729
}

src/main/java/anhtester/com/utils/DataGenerateUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public class DataGenerateUtils {
1414
static final String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
1515
static SecureRandom random = new SecureRandom();
1616

17-
public static String randomString(int len) {
18-
StringBuilder sb = new StringBuilder(len);
19-
for (int i = 0; i < len; i++) {
17+
public static String randomString(int length) {
18+
StringBuilder sb = new StringBuilder(length);
19+
for (int i = 0; i < length; i++) {
2020
sb.append(AB.charAt(random.nextInt(AB.length())));
2121
}
2222
return sb.toString();

src/main/java/anhtester/com/utils/DateUtils.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
//final -> We do not want any class to extend this class
1212
public final class DateUtils {
1313

14-
//private -> We do not want anyone to create the object of this class
15-
//Private constructor to avoid external instantiation
1614
private DateUtils() {
1715
}
1816

src/main/java/anhtester/com/utils/IconUtils.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,16 @@
55

66
package anhtester.com.utils;
77

8-
import anhtester.com.constants.FrameworkConstants;
98
import anhtester.com.enums.Browser;
10-
import anhtester.com.helpers.PropertiesHelpers;
11-
import org.testng.Reporter;
129

1310
import static anhtester.com.constants.FrameworkConstants.*;
1411

15-
//final -> We do not want any class to extend this class
1612
public final class IconUtils {
1713

18-
/**
19-
* Private constructor to avoid external instantiation
20-
* private -> We do not want anyone to create the object of this class
21-
*/
2214
private IconUtils() {
2315
}
2416

2517
public static String getBrowserIcon() {
26-
// String browserInLowerCase = BrowserInfoUtils.getBrowserInfo().toLowerCase();
27-
28-
2918
if (BrowserInfoUtils.getBrowserInfo().contains(Browser.CHROME.toString())) {
3019
return ICON_BROWSER_CHROME;
3120
} else if (BrowserInfoUtils.getBrowserInfo().contains(Browser.EDGE.toString())) {

src/main/java/anhtester/com/utils/JsonUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
*/
2323
public class JsonUtils {
2424

25-
2625
private static Map<String, String> CONFIGMAP;
2726

2827
private JsonUtils() {

src/main/java/anhtester/com/utils/ObjectUtils.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,6 @@ public static String getXpathValue(String elementName) {
9292
}
9393

9494

95-
/**
96-
* Receives a wildcard string, replace the wildcard with the value and return to the caller
97-
*
98-
* @param xpath Xpath with wildcard string
99-
* VD: //a[text()='%s'] => %s is String, %d is int
100-
* @param value value to be replaced in place of wildcard
101-
* @return dynamic xpath string
102-
* @author Anh Tester
103-
*/
104-
public static String getXpathDynamic(String xpath, Object value) {
105-
if (xpath == null || xpath == "") {
106-
try {
107-
Log.info("Parameter passing error. The 'xpath' parameter is null.");
108-
throw new Exception("Warning !! The xpath is null.");
109-
} catch (Exception e) {
110-
e.printStackTrace();
111-
}
112-
return null;
113-
} else {
114-
return String.format(xpath, value);
115-
}
116-
}
117-
11895
/**
11996
* Receives a wildcard string, replace the wildcard with the value and return to the caller
12097
*

src/main/java/anhtester/com/utils/WebUI.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ public static boolean verifyElementExists(By by) {
711711

712712
public static boolean verifyElementText(By by, String text) {
713713
smartWait();
714+
waitForElementVisible(by);
714715

715716
return getTextElement(by).trim().equals(text.trim());
716717
}
@@ -1245,6 +1246,7 @@ public static WebElement highLightElement(By by) {
12451246
@Step("Open website with get URL")
12461247
public static void getToUrl(String URL) {
12471248
sleep(WAIT_SLEEP_STEP);
1249+
12481250
DriverManager.getDriver().get(URL);
12491251
waitForPageLoaded();
12501252

src/test/java/anhtester/com/listeners/TestListener.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public void onStart(ISuite iSuite) {
4444
Log.info("Start suite testing for " + iSuite.getName());
4545
iSuite.setAttribute("WebDriver", DriverManager.getDriver());
4646
//Gọi hàm startRecord video trong CaptureHelpers class
47-
CaptureHelpers.startRecord(iSuite.getName());
47+
if (video_record.trim().toLowerCase().equals(YES)) {
48+
CaptureHelpers.startRecord(iSuite.getName());
49+
}
4850
ExtentReportManager.initReports();
4951
}
5052

@@ -54,10 +56,15 @@ public void onFinish(ISuite iSuite) {
5456
WebUI.stopSoftAssertAll();
5557
//Kết thúc và thực thi Extents Report
5658
ExtentReportManager.flushReports();
57-
ZipUtils.zip();
59+
if (zip_folder.trim().toLowerCase().equals(YES)) {
60+
ZipUtils.zip();
61+
}
5862
EmailSendUtils.sendEmail(count_totalTCs, count_passedTCs, count_failedTCs, count_skippedTCs);
5963
//Gọi hàm stopRecord video trong CaptureHelpers class
60-
CaptureHelpers.stopRecord();
64+
if (video_record.trim().toLowerCase().equals(YES)) {
65+
CaptureHelpers.stopRecord();
66+
}
67+
6168
}
6269

6370
public AuthorType[] getAuthorType(ITestResult iTestResult) {
@@ -118,7 +125,7 @@ public void onTestFailure(ITestResult iTestResult) {
118125
}
119126

120127
//Allure report screenshot file and log
121-
Log.error("FAIL !! Screenshot for test case: " + getTestName(iTestResult));
128+
Log.error("FAILED !! Screenshot for test case: " + getTestName(iTestResult));
122129
Log.error(iTestResult.getThrowable());
123130

124131
AllureManager.takeScreenshotToAttachOnAllureReport();

src/test/java/anhtester/com/projects/website/crm/testcases/ClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public void testSearchClient() {
5656
clientPage.enterDataSearchClient("Anh Tester");
5757
WebUI.checkContainsSearchTableByColumn(2, "Anh Tester");
5858
// Search the second
59-
clientPage.enterDataSearchClient("Anh Tester Client 0107A1");
60-
WebUI.checkContainsSearchTableByColumn(2, "Anh Tester Client 0107A1");
59+
clientPage.enterDataSearchClient("Anh Tester Client 0407A1");
60+
WebUI.checkContainsSearchTableByColumn(2, "Anh Tester Client 0407A1");
6161

6262
}
6363

0 commit comments

Comments
 (0)