Skip to content

Commit 42e05f6

Browse files
committed
Update version 1.6.0 PREVIEW
1 parent e38c1ff commit 42e05f6

33 files changed

Lines changed: 385 additions & 149 deletions

pom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<suite.signin.simple>src/test/resources/suites/SignIn-simple.xml</suite.signin.simple>
4848
<suite.client.parallel>src/test/resources/suites/Clients-parallel.xml</suite.client.parallel>
4949
<suite.client.simple>src/test/resources/suites/Clients-simple.xml</suite.client.simple>
50+
<suite.all>src/test/resources/suites/SuiteAll.xml</suite.all>
5051

5152
<maven.test.skip>false</maven.test.skip>
5253
<maven.test.failure.ignore>true</maven.test.failure.ignore>
@@ -315,8 +316,35 @@
315316
</plugins>
316317
</build>
317318
</profile>
319+
320+
<profile>
321+
<id>Suite-All</id>
322+
<build>
323+
<plugins>
324+
<plugin>
325+
<groupId>org.apache.maven.plugins</groupId>
326+
<artifactId>maven-surefire-plugin</artifactId>
327+
<version>${maven-surefire-plugin.version}</version>
328+
<configuration>
329+
<suiteXmlFiles>
330+
<suiteXmlFile>${suite.all}</suiteXmlFile>
331+
</suiteXmlFiles>
332+
<argLine>
333+
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectjweaver.version}/aspectjweaver-${aspectjweaver.version}.jar"
334+
</argLine>
335+
<testFailureIgnore>true</testFailureIgnore>
336+
<systemPropertyVariables>
337+
<allure.results.directory>target/allure-results</allure.results.directory>
338+
</systemPropertyVariables>
339+
</configuration>
340+
</plugin>
341+
</plugins>
342+
</build>
343+
</profile>
344+
318345
</profiles>
319346

347+
320348
<build>
321349
<pluginManagement>
322350
<plugins>

src/main/java/anhtester/com/config/Configuration.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@
1313

1414
public interface Configuration extends Config {
1515

16-
@Key("target")
16+
@Key("TARGET")
1717
String target();
1818

19-
@Key("browser")
19+
@Key("BROWSER")
2020
String browser();
2121

22-
@Key("headless")
22+
@Key("HEADLESS")
2323
Boolean headless();
2424

25-
@Key("base_url")
25+
@Key("URL_CRM")
2626
String baseUrl();
2727

28-
@Key("remote_url")
28+
@Key("REMOTE_URL")
2929
String gridUrl();
3030

31-
@Key("remote_port")
31+
@Key("REMOTE_PORT")
3232
String gridPort();
3333

3434
}

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@ private FrameworkConstants() {
1717
}
1818

1919
public static final String PROJECT_PATH = Helpers.getCurrentDir();
20-
public static final String EXCEL_DATA_PATH = PropertiesHelpers.getValue("excelDataFilePath");
21-
public static final String JSON_CONFIG_FILE_PATH = Helpers.getCurrentDir() + "src/test/resources/config/config.json";
22-
23-
public static final String BROWSER = PropertiesHelpers.getValue("browser");
24-
public static final String BASE_URL = PropertiesHelpers.getValue("base_url");
25-
public static final String REMOTE_URL = PropertiesHelpers.getValue("remote_url");
26-
public static final String REMOTE_PORT = PropertiesHelpers.getValue("remote_port");
27-
public static final String PROJECT_NAME = PropertiesHelpers.getValue("projectName");
28-
public static final String REPORT_TITLE = PropertiesHelpers.getValue("reportTitle");
29-
public static final String EXTENT_REPORT_NAME = PropertiesHelpers.getValue("extentReportName");
30-
public static final String EXTENT_REPORT_FOLDER = PropertiesHelpers.getValue("extentReportFolder");
31-
public static final String ExportVideoPath = PropertiesHelpers.getValue("exportVideoPath");
32-
public static final String ExportCapturePath = PropertiesHelpers.getValue("exportCapturePath");
33-
public static final String AUTHOR = PropertiesHelpers.getValue("author");
34-
public static final String TARGET = PropertiesHelpers.getValue("target");
35-
public static final String HEADLESS = PropertiesHelpers.getValue("headless");
36-
public static final String override_reports = PropertiesHelpers.getValue("override_reports");
20+
public static final String EXCEL_DATA_FILE_PATH = PropertiesHelpers.getValue("EXCEL_DATA_FILE_PATH");
21+
public static final String JSON_DATA_FILE_PATH = PropertiesHelpers.getValue("JSON_DATA_FILE_PATH");
22+
23+
public static final String BROWSER = PropertiesHelpers.getValue("BROWSER");
24+
public static final String URL_CRM = PropertiesHelpers.getValue("URL_CRM");
25+
public static final String REMOTE_URL = PropertiesHelpers.getValue("REMOTE_URL");
26+
public static final String REMOTE_PORT = PropertiesHelpers.getValue("REMOTE_PORT");
27+
public static final String PROJECT_NAME = PropertiesHelpers.getValue("PROJECT_NAME");
28+
public static final String REPORT_TITLE = PropertiesHelpers.getValue("REPORT_TITLE");
29+
public static final String EXTENT_REPORT_NAME = PropertiesHelpers.getValue("EXTENT_REPORT_NAME");
30+
public static final String EXTENT_REPORT_FOLDER = PropertiesHelpers.getValue("EXTENT_REPORT_FOLDER");
31+
public static final String EXPORT_VIDEO_PATH = PropertiesHelpers.getValue("EXPORT_VIDEO_PATH");
32+
public static final String EXPORT_CAPTURE_PATH = PropertiesHelpers.getValue("EXPORT_CAPTURE_PATH");
33+
public static final String AUTHOR = PropertiesHelpers.getValue("AUTHOR");
34+
public static final String TARGET = PropertiesHelpers.getValue("TARGET");
35+
public static final String HEADLESS = PropertiesHelpers.getValue("HEADLESS");
36+
public static final String OVERRIDE_REPORTS = PropertiesHelpers.getValue("OVERRIDE_REPORTS");
3737
public static final String open_reports_after_execution = PropertiesHelpers.getValue("open_reports_after_execution");
3838
public static final String send_email_to_users = PropertiesHelpers.getValue("send_email_to_users");
3939
public static final String screenshot_passed_steps = PropertiesHelpers.getValue("screenshot_passed_steps");
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");
43+
public static final String ZIP_FOLDER = PropertiesHelpers.getValue("ZIP_FOLDER");
44+
public static final String VIDEO_RECORD = PropertiesHelpers.getValue("VIDEO_RECORD");
4545

4646
public static final int WAIT_DEFAULT = Integer.parseInt(PropertiesHelpers.getValue("WAIT_DEFAULT"));
4747
public static final int WAIT_IMPLICIT = Integer.parseInt(PropertiesHelpers.getValue("WAIT_IMPLICIT"));

src/main/java/anhtester/com/driver/BrowserFactory.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public WebDriver createDriver() {
3535
@Override
3636
public ChromeOptions getOptions() {
3737
ChromeOptions chromeOptions = new ChromeOptions();
38-
chromeOptions.addArguments(START_MAXIMIZED);
3938
chromeOptions.addArguments("--disable-infobars");
4039
chromeOptions.addArguments("--disable-notifications");
4140
chromeOptions.setHeadless(Boolean.valueOf(FrameworkConstants.HEADLESS));
@@ -46,14 +45,13 @@ public ChromeOptions getOptions() {
4645
@Override
4746
public WebDriver createDriver() {
4847
WebDriverManager.getInstance(DriverManagerType.FIREFOX).setup();
49-
48+
5049
return new FirefoxDriver(getOptions());
5150
}
5251

5352
@Override
5453
public FirefoxOptions getOptions() {
5554
FirefoxOptions firefoxOptions = new FirefoxOptions();
56-
firefoxOptions.addArguments(START_MAXIMIZED);
5755
firefoxOptions.setHeadless(Boolean.valueOf(FrameworkConstants.HEADLESS));
5856

5957
return firefoxOptions;
@@ -69,7 +67,6 @@ public WebDriver createDriver() {
6967
@Override
7068
public EdgeOptions getOptions() {
7169
EdgeOptions edgeOptions = new EdgeOptions();
72-
edgeOptions.addArguments(START_MAXIMIZED);
7370
edgeOptions.setHeadless(Boolean.valueOf(FrameworkConstants.HEADLESS));
7471

7572
return edgeOptions;

src/main/java/anhtester/com/helpers/CaptureHelpers.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@
3434
public class CaptureHelpers extends ScreenRecorder {
3535

3636
// ------Record with Monte Media library---------
37-
public static ScreenRecorder screenRecorder;
38-
public String name;
37+
private static ScreenRecorder screenRecorder;
38+
private static String name;
3939
private static SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH-mm-ss");
40-
private static PropertiesHelpers propertiesHelpers = new PropertiesHelpers();
4140

4241
//Hàm xây dựng
4342
public CaptureHelpers(GraphicsConfiguration cfg, Rectangle captureArea, Format fileFormat, Format screenFormat,
@@ -53,41 +52,40 @@ protected File createMovieFile(Format fileFormat) throws IOException {
5352
if (!movieFolder.exists()) {
5453
movieFolder.mkdirs();
5554
} else if (!movieFolder.isDirectory()) {
56-
throw new IOException("\"" + movieFolder + "\" is not a directory.");
55+
throw new IOException(movieFolder + " is not a directory.");
5756
}
58-
5957
return new File(movieFolder,
60-
name + "-" + dateFormat.format(new Date()) + "." + Registry.getInstance().getExtension(fileFormat));
58+
name + "_" + dateFormat.format(new Date()) + "." + Registry.getInstance().getExtension(fileFormat));
6159
}
6260

6361
// Hàm Start record video
6462
public static void startRecord(String methodName) {
6563
//Tạo thư mục để lưu file video vào
66-
File file = new File("./" + FrameworkConstants.ExportVideoPath + "/" + methodName + "/");
64+
File file = new File("./" + FrameworkConstants.EXPORT_VIDEO_PATH + "/" + methodName + "/");
6765
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
6866
int width = screenSize.width;
6967
int height = screenSize.height;
7068

69+
System.out.println("width" + width);
70+
System.out.println("height" + height);
71+
7172
Rectangle captureSize = new Rectangle(0, 0, width, height);
7273

73-
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
74+
GraphicsConfiguration gc = GraphicsEnvironment
75+
.getLocalGraphicsEnvironment()
76+
.getDefaultScreenDevice()
7477
.getDefaultConfiguration();
7578
try {
76-
screenRecorder = new CaptureHelpers(gc, captureSize,
79+
screenRecorder = new CaptureHelpers(gc, null,
7780
new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI),
7881
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
7982
CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, DepthKey, 24, FrameRateKey,
8083
Rational.valueOf(15), QualityKey, 1.0f, KeyFrameIntervalKey, 15 * 60),
8184
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black", FrameRateKey, Rational.valueOf(30)),
8285
null, file, methodName);
83-
} catch (IOException e) {
84-
e.printStackTrace();
85-
} catch (AWTException e) {
86-
e.printStackTrace();
87-
}
88-
try {
86+
8987
screenRecorder.start();
90-
} catch (IOException e) {
88+
} catch (IOException | AWTException e) {
9189
e.printStackTrace();
9290
}
9391
}
@@ -103,7 +101,7 @@ public static void stopRecord() {
103101

104102
public static void captureScreenshot(WebDriver driver, String screenName) {
105103
try {
106-
String path = Helpers.getCurrentDir() + FrameworkConstants.ExportCapturePath;
104+
String path = Helpers.getCurrentDir() + FrameworkConstants.EXPORT_CAPTURE_PATH;
107105
File file = new File(path);
108106
if (!file.exists()) {
109107
Log.info("No Folder: " + path);

src/main/java/anhtester/com/helpers/ExcelHelpers.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55

66
package anhtester.com.helpers;
77

8-
import java.awt.Color;
9-
import java.io.*;
10-
import java.util.*;
11-
12-
import anhtester.com.constants.FrameworkConstants;
13-
import anhtester.com.exceptions.FrameworkException;
148
import anhtester.com.exceptions.InvalidPathForExcelException;
159
import anhtester.com.utils.Log;
1610
import org.apache.poi.ss.usermodel.*;
1711
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
18-
import org.apache.poi.xssf.usermodel.XSSFSheet;
1912
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
2013

14+
import java.awt.Color;
15+
import java.io.*;
16+
import java.util.HashMap;
17+
import java.util.Hashtable;
18+
import java.util.Map;
19+
2120
public class ExcelHelpers {
2221

2322
private FileInputStream fis;
@@ -34,6 +33,10 @@ public class ExcelHelpers {
3433
public int rowNumber; //Row Number
3534
public int columnNumber; //Column Number
3635

36+
public ExcelHelpers() {
37+
PropertiesHelpers.loadAllFiles();
38+
}
39+
3740
// Set Excel file
3841
public void setExcelFile(String excelPath, String sheetName) {
3942
try {
@@ -182,7 +185,7 @@ public Object[][] getTableArray(String filePath, String sheetName, int iTestCase
182185
}
183186

184187
public Object[][] getDataHashTable(String excelPath, String sheetName, int startRow, int endRow) {
185-
188+
System.out.println("Excel Path: " + excelPath);
186189
Object[][] data = null;
187190
try {
188191

src/main/java/anhtester/com/helpers/PropertiesHelpers.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
import java.io.FileInputStream;
1313
import java.io.FileOutputStream;
1414
import java.io.IOException;
15-
import java.io.InputStreamReader;
16-
import java.nio.charset.Charset;
17-
import java.nio.charset.StandardCharsets;
1815
import java.util.LinkedList;
1916
import java.util.Properties;
2017

@@ -32,7 +29,7 @@ public static Properties loadAllFiles() {
3229
// Add tất cả file Properties vào đây theo mẫu
3330
files.add("src/test/resources/config/config.properties");
3431
files.add("src/test/resources/config/datatest.properties");
35-
files.add("src/test/resources/objects.crm/crm_locators.properties");
32+
files.add("src/test/resources/objects/crm_locators.properties");
3633

3734
try {
3835
properties = new Properties();

0 commit comments

Comments
 (0)