Commit 972bdd3b authored by Trình Nguyễn's avatar Trình Nguyễn

hi

parents
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/automation_selenium" vcs="Git" />
<mapping directory="$PROJECT_DIR$/automation_selenium/LSP_AUTOMATION/automation_selenium" vcs="Git" />
</component>
</project>
\ No newline at end of file
automation_selenium @ 4f1eec7b
Subproject commit 4f1eec7be509b8ce6ec170566a46ecd78983c817
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>ProjectAutomationLSP</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Selenium -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.17.0</version>
</dependency>
<!-- WebDriverManager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.6.3</version> <!-- hoặc mới nhất -->
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.13</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.13</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.15.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.22.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.22.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-testng -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.25.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-attachments -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-attachments</artifactId>
<version>2.25.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.19</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.stephenc.monte/monte-screen-recorder -->
<dependency>
<groupId>com.github.stephenc.monte</groupId>
<artifactId>monte-screen-recorder</artifactId>
<version>0.7.7.0</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.sendgrid</groupId>
<artifactId>sendgrid-java</artifactId>
<version>4.9.3</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
<version>1.6.7</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<suiteXmlFiles>
<!-- Call Suite name -->
<suiteXmlFile>suites/SuiteLoginTest.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/1.9.19/aspectjweaver-1.9.19.jar"
</argLine>
<testFailureIgnore>true</testFailureIgnore>
<systemPropertyVariables>
<!--Đường dẫn xuất ra report-->
<allure.results.directory>target/allure-results</allure.results.directory>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
\ No newline at end of file
package com.example.appium;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
System.out.printf("Hello and welcome!");
for (int i = 1; i <= 5; i++) {
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
System.out.println("i = " + i);
}
}
}
\ No newline at end of file
package org.example;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
System.out.printf("Hello and welcome!");
for (int i = 1; i <= 5; i++) {
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
System.out.println("i = " + i);
}
}
}
\ No newline at end of file
package trinhQC.com.drivers;
import org.openqa.selenium.WebDriver;
public class DriverManager {
private static final ThreadLocal<WebDriver> driver = new ThreadLocal<>();
private DriverManager() {
}
public static WebDriver getDriver() {
return driver.get();
}
public static void setDriver(WebDriver driver) {
DriverManager.driver.set(driver);
}
public static void quit() {
DriverManager.driver.get().quit();
driver.remove();
}
}
package trinhQC.com.helpers;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.io.FileHandler;
import org.testng.ITestResult;
import org.testng.Reporter;
import trinhQC.com.drivers.DriverManager;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
public class CaptureHelper {
//Lấy đường dẫn đến project hiện tại
static String projectPath = System.getProperty("user.dir") + "/";
//Tạo format ngày giờ để xíu gắn dô cái name của screenshot hoặc record video
private static SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH-mm-ss");
public static void captureScreenshot(ITestResult result) {
PropertiesHelper.setDefaultFile();
try {
Reporter.log("Driver for Screenshot: " + DriverManager.getDriver());
// Tạo tham chiếu đối tượng của TakesScreenshot với dirver hiện tại
TakesScreenshot ts = (TakesScreenshot) DriverManager.getDriver();
// Gọi hàm getScreenshotAs để chuyển hóa hình ảnh về dạng FILE
File source = ts.getScreenshotAs(OutputType.FILE);
//Kiểm tra folder nếu không tồn tại thì tạo folder
File theDir = new File(projectPath + PropertiesHelper.getValue("exportCapturePath"));
if (!theDir.exists()){
theDir.mkdirs();
}
// Chổ này đặt tên thì truyền biến "screenName" gán cho tên File chụp màn hình
FileHandler.copy(source, new File(projectPath + PropertiesHelper.getValue("exportCapturePath") + "/" + result.getName() + "_" + dateFormat.format(new Date()) + ".png"));
System.out.println("Screenshot taken: " + result.getName());
Reporter.log("Screenshot taken current URL: " + DriverManager.getDriver().getCurrentUrl(), true);
} catch (Exception e) {
System.out.println("Exception while taking screenshot: " + e.getMessage());
}
}
}
package trinhQC.com.helpers;
import javax.mail.*;
import javax.mail.internet.*;
import java.io.File;
import java.util.Properties;
public class EmailReportSender {
public static void sendReport() {
// Cấu hình Gmail
final String username = "trinhnm77@gmail.com"; // Email gửi
final String password = "jipl advt gpiw qrcp"; // App password (không phải mật khẩu Gmail bình thường)
// Cấu hình SMTP server
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
// Tạo session
Session session = Session.getInstance(props,
new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
try {
// Tạo email
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(username));
message.setRecipients(
Message.RecipientType.TO,
InternetAddress.parse("minhtt2001ccc@gmail.com")
);
message.setSubject("Báo cáo kiểm thử tự động");
// Đính kèm báo cáo HTML
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText("Hello, đây là báo cáo kiểm thử tự động");
MimeBodyPart attachmentPart = new MimeBodyPart();
attachmentPart.attachFile(new File("./extentReports/ExtentReport.html"));
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
multipart.addBodyPart(attachmentPart);
message.setContent(multipart);
// Gửi email
Transport.send(message);
System.out.println("✅ Gửi báo cáo thành công!");
} catch (Exception e) {
System.out.println("❌ Lỗi khi gửi email: " + e.getMessage());
}
}
}
package trinhQC.com.helpers;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
public class ExcelHelper {
private FileInputStream fis;
private FileOutputStream fileOut;
private Workbook wb;
private Sheet sh;
private Cell cell;
private Row row;
private CellStyle cellstyle;
private Color mycolor;
private String excelFilePath;
private final Map<String, Integer> columns = new HashMap<>();
public void setExcelFile(String ExcelPath, String SheetName) {
try {
File f = new File(ExcelPath);
if (!f.exists()) {
f.createNewFile();
System.out.println("File doesn't exist, so created!");
}
fis = new FileInputStream(ExcelPath);
wb = WorkbookFactory.create(fis);
sh = wb.getSheet(SheetName);
//sh = wb.getSheetAt(0); //0 - index of 1st sheet
if (sh == null) {
sh = wb.createSheet(SheetName);
}
this.excelFilePath = ExcelPath;
//adding all the column header names to the map 'columns'
sh.getRow(0).forEach(cell -> {
columns.put(cell.getStringCellValue(), cell.getColumnIndex());
});
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public String getCellData(int rownum, int column) {
try {
cell = sh.getRow(rownum).getCell(column);
String CellData = null;
switch (cell.getCellType()) {
case STRING:
CellData = cell.getStringCellValue();
break;
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
CellData = String.valueOf(cell.getDateCellValue());
} else {
CellData = String.valueOf((long) cell.getNumericCellValue());
}
break;
case BOOLEAN:
CellData = Boolean.toString(cell.getBooleanCellValue());
break;
case BLANK:
CellData = "";
break;
}
return CellData;
} catch (Exception e) {
return "";
}
}
//Gọi ra hàm này nè
public String getCellData(String columnName, int rownum) {
return getCellData(rownum, columns.get(columnName));
}
//Get last row number (lấy vị trí dòng cuối cùng tính từ 0)
public int getLastRowNum() {
return sh.getLastRowNum();
}
//Lấy số dòng có data đang sử dụng
public int getPhysicalNumberOfRows() {
return sh.getPhysicalNumberOfRows();
}
// Write data to excel sheet
//set by column index
public void setCellData(String text, int rowNumber, int colNumber) {
try {
row = sh.getRow(rowNumber);
if (row == null) {
row = sh.createRow(rowNumber);
}
cell = row.getCell(colNumber);
if (cell == null) {
cell = row.createCell(colNumber);
}
cell.setCellValue(text);
XSSFCellStyle style = (XSSFCellStyle) wb.createCellStyle();
text = text.trim().toLowerCase();
if (text == "pass" || text == "passed") {
style.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
}
if (text == "fail" || text == "failed") {
style.setFillForegroundColor(IndexedColors.RED.getIndex());
}
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
cell.setCellStyle(style);
fileOut = new FileOutputStream(excelFilePath);
wb.write(fileOut);
fileOut.flush();
fileOut.close();
} catch (Exception e) {
e.getMessage();
}
}
//set by column name
public void setCellData(String text, int rowNumber, String columnName) {
try {
row = sh.getRow(rowNumber);
if (row == null) {
row = sh.createRow(rowNumber);
}
cell = row.getCell(columns.get(columnName));
if (cell == null) {
cell = row.createCell(columns.get(columnName));
}
cell.setCellValue(text);
XSSFCellStyle style = (XSSFCellStyle) wb.createCellStyle();
text = text.trim().toLowerCase();
if (text == "pass" || text == "passed") {
style.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
}
if (text == "fail" || text == "passed") {
style.setFillForegroundColor(IndexedColors.RED.getIndex());
}
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
cell.setCellStyle(style);
fileOut = new FileOutputStream(excelFilePath);
wb.write(fileOut);
fileOut.flush();
fileOut.close();
} catch (Exception e) {
e.getMessage();
}
}
public Object[][] getExcelData(String fileName, String sheetName) {
Object[][] data = null;
Workbook workbook = null;
try {
// load the file/-strong/-heart:>:o:-((:-hFileInputStream fis = new FileInputStream(fileName);
// load the workbook
workbook = new XSSFWorkbook(fis);
// load the sheet
Sheet sh = workbook.getSheet(sheetName);
// load the row
Row row = sh.getRow(0);
//
int noOfRows = sh.getPhysicalNumberOfRows();
int noOfCols = row.getLastCellNum();
System.out.println(noOfRows + " - " + noOfCols);
Cell cell;
data = new Object[noOfRows - 1][noOfCols];
//
for (int i = 1; i < noOfRows; i++) {
for (int j = 0; j < noOfCols; j++) {
row = sh.getRow(i);
cell = row.getCell(j);
switch (cell.getCellType()) {
case STRING:
data[i - 1][j] = cell.getStringCellValue();
break;
case NUMERIC:
data[i - 1][j] = String.valueOf(cell.getNumericCellValue());
break;
case BLANK:
data[i - 1][j] = cell.getStringCellValue();
break;
default:
data[i - 1][j] = cell.getStringCellValue();
break;
}
}
}
} catch (Exception e) {
System.out.println("The exception is:" + e.getMessage());
throw new RuntimeException(e);
}
return data;
}
//Hàm này dùng cho trường hợp nhiều Field trong File Excel
public int getColumns() {
try {
row = sh.getRow(0);
return row.getLastCellNum();
} catch (Exception e) {
System.out.println(e.getMessage());
throw (e);
}
}
public Object[][] getExcelDataHashTable(String excelPath, String sheetName, int startRow, int endRow) {
System.out.println("Excel Path: " + excelPath);
Object[][] data = null;
try {
File f = new File(excelPath);
if (!f.exists()) {
try {
System.out.println("File Excel path not found.");
throw new IOException("File Excel path not found.");
} catch (Exception e) {
e.printStackTrace();
}
}
fis = new FileInputStream(excelPath);
wb = new XSSFWorkbook(fis);
sh = wb.getSheet(sheetName);
int rows = getLastRowNum();
int columns = getColumns();
System.out.println("Row: " + rows + " - Column: " + columns);
System.out.println("StartRow: " + startRow + " - EndRow: " + endRow);
data = new Object[(endRow - startRow) + 1][1];
Hashtable<String, String> table = null;
table = new Hashtable<>();
for (int rowNums = startRow; rowNums <= endRow; rowNums++) {
table = new Hashtable<>();
for (int colNum = 0; colNum < columns; colNum++) {
table.put(getCellData(0, colNum), getCellData(rowNums, colNum));
}
data[rowNums - startRow][0] = table;
}
} catch (IOException e) {
e.printStackTrace();
}
return data;
}
}
package trinhQC.com.helpers;
public class PathToProject {
public static String getCurrentDir() {
String current = System.getProperty("user.dir") + "/";
return current;
}
public static String relPropertiesFilePathDefault(){
String Path = "src/main/java/Main_HRM_AnhTester/DataTest/Properties/Data.properties";
return Path;
}
}
package trinhQC.com.helpers;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.Properties;
public class PropertiesHelper {
private static Properties properties;
private static String linkFile;
private static FileInputStream file;
private static FileOutputStream out;
private static final String relPropertiesFilePathDefault = "src/main/java/Main_HRM_AnhTester/DataTest/Properties/Data.properties";
public static Properties loadAllFiles() {
LinkedList<String> files = new LinkedList<>();
// Add tất cả file Properties vào đây theo mẫu
files.add("src/main/java/Main_HRM_AnhTester/DataTest/Properties/Data.properties");
try {
properties = new Properties();
for (String f : files) {
Properties tempProp = new Properties();
linkFile = PathToProject.getCurrentDir() + f;
file = new FileInputStream(linkFile);
tempProp.load(file);
properties.putAll(tempProp);
}
return properties;
} catch (IOException ioe) {
return new Properties();
}
}
public static void setFile(String relPropertiesFilePath) {
properties = new Properties();
try {
linkFile = PathToProject.getCurrentDir() + relPropertiesFilePath;
file = new FileInputStream(linkFile);
properties.load(file);
file.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void setDefaultFile() {
properties = new Properties();
try {
linkFile = PathToProject.getCurrentDir() + relPropertiesFilePathDefault;
file = new FileInputStream(linkFile);
properties.load(file);
file.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static String getValue(String key) {
String keyval = null;
try {
if (file == null) {
properties = new Properties();
linkFile = PathToProject.getCurrentDir() + relPropertiesFilePathDefault;
file = new FileInputStream(linkFile);
properties.load(file);
file.close();
}
// Lấy giá trị từ file đã Set
keyval = properties.getProperty(key);
} catch (Exception e) {
System.out.println(e.getMessage());
}
return keyval;
}
public static void setValue(String key, String keyValue) {
try {
if (file == null) {
properties = new Properties();
file = new FileInputStream(PathToProject.getCurrentDir() + relPropertiesFilePathDefault);
properties.load(file);
file.close();
out = new FileOutputStream(PathToProject.getCurrentDir() + relPropertiesFilePathDefault);
}
//Ghi vào cùng file Prop với file lấy ra
out = new FileOutputStream(linkFile);
System.out.println(linkFile);
properties.setProperty(key, keyValue);
properties.store(out, null);
out.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
package trinhQC.com.helpers;
import org.monte.media.Format;
import org.monte.media.FormatKeys.MediaType;
import org.monte.media.Registry;
import org.monte.media.math.Rational;
import org.monte.screenrecorder.ScreenRecorder;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import static org.monte.media.AudioFormatKeys.EncodingKey;
import static org.monte.media.AudioFormatKeys.FrameRateKey;
import static org.monte.media.AudioFormatKeys.KeyFrameIntervalKey;
import static org.monte.media.AudioFormatKeys.MIME_AVI;
import static org.monte.media.AudioFormatKeys.MediaTypeKey;
import static org.monte.media.AudioFormatKeys.MimeTypeKey;
import static org.monte.media.VideoFormatKeys.*;
public class RecordVideo extends ScreenRecorder {
// ------Record with Monte Media library---------
public static ScreenRecorder screenRecorder;
public String name;
//Hàm xây dựng
public RecordVideo(GraphicsConfiguration cfg, Rectangle captureArea, Format fileFormat, Format screenFormat,
Format mouseFormat, Format audioFormat, File movieFolder, String name) throws IOException, AWTException {
super(cfg, captureArea, fileFormat, screenFormat, mouseFormat, audioFormat, movieFolder);
this.name = name;
}
//Hàm này bắt buộc để ghi đè custom lại hàm trong thư viên viết sẵn
@Override
protected File createMovieFile(Format fileFormat) {
if (!movieFolder.exists()) {
movieFolder.mkdirs();
} else if (!movieFolder.isDirectory()) {
try {
throw new IOException("\"" + movieFolder + "\" is not a directory.");
} catch (IOException e) {
throw new RuntimeException(e);
}
}
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH-mm-ss");
return new File(movieFolder,
name + "-" + dateFormat.format(new Date()) + "." + Registry.getInstance().getExtension(fileFormat));
}
// Hàm Start record video
public static void startRecord(String methodname) {
//Tạo thư mục để lưu file video vào
File file = new File("./ExportData/Video/");
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int width = screenSize.width;
int height = screenSize.height;
Rectangle captureSize = new Rectangle(0, 0, width, height);
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
.getDefaultConfiguration();
try {
screenRecorder = new RecordVideo(gc, captureSize,
new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI),
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, DepthKey, 24, FrameRateKey,
Rational.valueOf(15), QualityKey, 1.0f, KeyFrameIntervalKey, 15 * 60),
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black", FrameRateKey, Rational.valueOf(30)),
null, file, methodname);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (AWTException e) {
throw new RuntimeException(e);
}
try {
screenRecorder.start();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
// Stop record video
public static void stopRecord() {
try {
screenRecorder.stop();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
package trinhQC.com.keywords;
import com.aventstack.extentreports.Status;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.*;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import trinhQC.com.drivers.DriverManager;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;
import java.time.Duration;
import java.util.List;
public class Key {
private static int EXPLICIT_WAIT_TIMEOUT = 10;
private static int WAIT_PAGE_LEADED_TIMEOUT = 30;
private static Robot robot;
public static WebElement getWebElement(By by) {
return DriverManager.getDriver().findElement(by);
}
public static void logConsole(String message) {
System.out.println(message);
}
public static void hoverOnElement(By by) {
waitForElementVisible(by);
Actions action = new Actions(DriverManager.getDriver());
action.moveToElement(getWebElement(by));
logConsole("Hover on element " + by);
}
public static WebElement highLightElement(By by) {
waitForElementVisible(by);
// Tô màu border ngoài chính element chỉ định - màu đỏ (có thể đổi màu khác)
if (DriverManager.getDriver() instanceof JavascriptExecutor) {
((JavascriptExecutor) DriverManager.getDriver()).executeScript("arguments[0].style.border='3px solid red'", getWebElement(by));
sleep(1);
}
return getWebElement(by);
}
public static void clickElementWithJS(By by){
JavascriptExecutor js = (JavascriptExecutor) DriverManager.getDriver();
waitForPageLoaded();
waitForElementVisible(by);
js.executeScript("arguments[0].scrollIntoView(true);", getWebElement(by));
js.executeScript("arguments[0].click();", getWebElement(by));
}
public static void rightClickElement(By by) {
waitForElementVisible(by);
Actions action = new Actions(DriverManager.getDriver());
action.contextClick(getWebElement(by));
logConsole("Right click on element " + by);
}
public static void openURL(String URL) {
DriverManager.getDriver().get(URL);
waitForPageLoaded();
logConsole("Open URL: " + URL);
}
public static String getCurrentUrl() {
waitForPageLoaded();
logConsole("Get Current URL: " + DriverManager.getDriver().getCurrentUrl());
return DriverManager.getDriver().getCurrentUrl();
}
public static void clickElement(By by) {
waitForElementVisible(by);
highLightElement(by);
getWebElement(by).click();
logConsole("Click on element " + by);
}
public static void setText(By by, String value) {
waitForElementVisible(by);
getWebElement(by).clear();
getWebElement(by).sendKeys(value);
logConsole("Set text " + value + " on element " + by);
}
public static void uploadFileRobotClass(String FileLocation) {
try {
robot = new Robot();
} catch (AWTException e) {
throw new RuntimeException(e);
}
StringSelection stringSelection = new StringSelection(FileLocation);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
robot.setAutoDelay(1000);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_V);
robot.setAutoDelay(1000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
public static String getTextElement(By by) {
waitForElementVisible(by);
logConsole("Get text of element " + by);
logConsole("==> Text: " + getWebElement(by).getText());
return getWebElement(by).getText();
}
public static String getAttributeElement(By by, String attributeName) {
waitForElementVisible(by);
logConsole("Get attribute value of element " + by);
logConsole("==> Attribute value: " + getWebElement(by).getAttribute(attributeName));
return getWebElement(by).getAttribute(attributeName);
}
public static void scrollToElementWithJS(By by) {
waitForElementPresent(by);
//Dùng Actions class
//Robot class
//Dùng JavascriptExecutor
JavascriptExecutor js = (JavascriptExecutor) DriverManager.getDriver();
js.executeScript("arguments[0].scrollIntoView(true);", getWebElement(by));
logConsole("Scroll to element " + by);
}
public static void scrollToElement(By by) {
//Dùng Actions class
}
public static void scrollToElementWithRobot(By by) {
//Dùng Robot class
}
public static void sleep(double second) {
try {
Thread.sleep((long) (1000 * second));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
public static void waitForElementVisible( By by, int second) {
WebDriverWait wait = new WebDriverWait(DriverManager.getDriver(), Duration.ofSeconds(second), Duration.ofMillis(500));
wait.until(ExpectedConditions.visibilityOfElementLocated(by));
}
public static void waitForElementVisible(By by) {
WebDriverWait wait = new WebDriverWait(DriverManager.getDriver(), Duration.ofSeconds(EXPLICIT_WAIT_TIMEOUT), Duration.ofMillis(500));
wait.until(ExpectedConditions.visibilityOfElementLocated(by));
}
public static List getWebElements(By by){
return DriverManager.getDriver().findElements(by);
}
public static void waitForElementPresent(By by, int second) {
WebDriverWait wait = new WebDriverWait(DriverManager.getDriver(), Duration.ofSeconds(second));
wait.until(ExpectedConditions.presenceOfElementLocated(by));
}
public static void waitForElementPresent(By by) {
WebDriverWait wait = new WebDriverWait(DriverManager.getDriver(), Duration.ofSeconds(EXPLICIT_WAIT_TIMEOUT));
wait.until(ExpectedConditions.presenceOfElementLocated(by));
}
public static void waitForElementClickable(By by, int second) {
WebDriverWait wait = new WebDriverWait(DriverManager.getDriver(), Duration.ofSeconds(second));
wait.until(ExpectedConditions.elementToBeClickable(by));
}
// public static void verifyElementText(By by, String textValue, String message){
// waitForPageLoaded();
// waitForElementVisible(by);
// sleep(5);
// Log.info("ACTUAL RESULT: Text of the element is: " + getWebElement(by).getText().trim());
// ExtentReportTestManager.logMessage(Status.PASS, "ACTUAL RESULT: Text of the element is: " + getWebElement(by).getText().trim());
// AllureReportManager.saveTextLog("ACTUAL RESULT: Text of the element is: " + getWebElement(by).getText().trim());
// Log.info("EXPECTED RESULT Text is: " + textValue.trim());
// ExtentReportTestManager.logMessage(Status.PASS, "EXPECTED RESULT Text is: " + textValue.trim());
// AllureReportManager.saveTextLog("EXPECTED RESULT Text is: " + textValue.trim());
// boolean expected = getWebElement(by).getText().trim().equals(textValue.trim());
// if(expected){
// ExtentReportTestManager.logMessage(Status.PASS, "ACTUAL RESULT the same as EXPECTED RESULT");
// }else {
// ExtentReportTestManager.logMessage(Status.FAIL, "ACTUAL RESULT not the same as EXPECTED RESULT");
// }
// Assert.assertTrue(expected,message);
// }
public static boolean verifyElementVisible(By by, int second) {
try {
WebDriverWait wait = new WebDriverWait(DriverManager.getDriver(), Duration.ofSeconds(second), Duration.ofMillis(500));
wait.until(ExpectedConditions.visibilityOfElementLocated(by));
return true;
} catch (TimeoutException e) {
e.printStackTrace();
return false;
}
}
public static boolean verifyElementNotVisible(By by, int second) {
try {
WebDriverWait wait = new WebDriverWait(DriverManager.getDriver(), Duration.ofSeconds(second), Duration.ofMillis(500));
wait.until(ExpectedConditions.invisibilityOfElementLocated(by));
return true;
} catch (TimeoutException e) {
e.printStackTrace();
return false;
}
}
// public static boolean verifyTextExist(By by){
public static boolean checkElementExist(By by) {
List<WebElement> listElement = DriverManager.getDriver().findElements(by);
if (listElement.size() > 0) {
System.out.println("Element " + by + " existing.");
return true;
} else {
System.out.println("Element " + by + " NOT exist.");
return false;
}
}
public static Boolean checkElementExist(String xpath) {
List<WebElement> listElement = DriverManager.getDriver().findElements(By.xpath(xpath));
if (listElement.size() > 0) {
System.out.println("Element " + xpath + " existing.");
return true;
} else {
System.out.println("Element " + xpath + " NOT exist.");
return false;
}
}
/**
* Wait for Page loaded
* Chờ đợi trang tải xong (Javascript tải xong)
*/
public static void waitForPageLoaded() {
WebDriverWait wait = new WebDriverWait(DriverManager.getDriver(), Duration.ofSeconds(WAIT_PAGE_LEADED_TIMEOUT), Duration.ofMillis(500));
JavascriptExecutor js = (JavascriptExecutor) DriverManager.getDriver();
//Wait for Javascript to load
ExpectedCondition<Boolean> jsLoad = new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
return js.executeScript("return document.readyState").toString().equals("complete");
}
};
//Check JS is Ready
boolean jsReady = js.executeScript("return document.readyState").toString().equals("complete");
//Wait Javascript until it is Ready!
if (!jsReady) {
System.out.println("Javascript is NOT Ready.");
//Wait for Javascript to load
try {
wait.until(jsLoad);
} catch (Throwable error) {
error.printStackTrace();
Assert.fail("FAILED. Timeout waiting for page load.");
}
}
}
public static void selectDropdownByVisibleText(WebDriver driver, By locator, String visibleText) {
WebElement dropdownElement = driver.findElement(locator);
Select dropdown = new Select(dropdownElement);
dropdown.selectByVisibleText(visibleText);
}
}
package trinhQC.com.keywords;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class Log {
private static final Logger Log = LogManager.getLogger(Log.class);
public static void info (String message) {
Log.info(message);
}
public static void info (Object object) {
Log.info(object);
}
public static void warn (String message) {
Log.warn(message);
}
public static void warn (Object object) {
Log.warn(object);
}
public static void error (String message) {
Log.error(message);
}
public static void error (Object object) {
Log.error(object);
}
public static void fatal (String message) {
Log.fatal(message);
}
public static void debug (String message) {
Log.debug(message);
}
public static void debug (Object object) {
Log.debug(object);
}
}
package trinhQC.com.reports;
import io.qameta.allure.Attachment;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import trinhQC.com.drivers.DriverManager;
public class AllureReportManager {
//Text attachments for Allure
@Attachment(value = "{0}", type = "text/plain")
public static String saveTextLog(String message) {
return message;
}
//HTML attachments for Allure
@Attachment(value = "{0}", type = "text/html")
public static String attachHtml(String html) {
return html;
}
//Text attachments for Allure
@Attachment(value = "BugImage", type = "image/png")
public static byte[] saveScreenshotPNG() {
return ((TakesScreenshot) DriverManager.getDriver()).getScreenshotAs(OutputType.BYTES);
}
}
package trinhQC.com.reports;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.reporter.ExtentSparkReporter;
import java.io.File;
public class ExtentReportManager {
private static final ExtentReports extentReports = new ExtentReports();
public static synchronized ExtentReports getExtentReports() {
// ✅ Tạo thư mục nếu chưa có
File reportDir = new File("./extentReports");
if (!reportDir.exists()) reportDir.mkdirs();
ExtentSparkReporter reporter = new ExtentSparkReporter("./extentReports/ExtentReport.html");
reporter.config().setReportName("Demo Extent Report");
extentReports.attachReporter(reporter);
extentReports.setSystemInfo("Framework Name", "Selenium Java Framework | Anh Tester");
extentReports.setSystemInfo("Author", "Trình Nguyễn88");
return extentReports;
}
}
package trinhQC.com.reports;
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 trinhQC.com.drivers.DriverManager;
import java.util.HashMap;
import java.util.Map;
public class ExtentReportTestManager {
static Map<Integer, ExtentTest> extentTestMap = new HashMap<>();
static ExtentReports extentReports = ExtentReportManager.getExtentReports();
public static ExtentTest getTest() {
return extentTestMap.get((int) Thread.currentThread().getId());
}
public static synchronized ExtentTest saveToReport(String testName, String desc) {
ExtentTest test = extentReports.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 addScreenShotWithStatus(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);
}
}
\ No newline at end of file
package Fosco.com.commom;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.ITestResult;
import org.testng.annotations.*;
import trinhQC.com.drivers.DriverManager;
import trinhQC.com.reports.ExtentReportManager;
import trinhQC.com.reports.ExtentReportTestManager;
import java.awt.*;
import java.io.File;
import java.io.IOException;
public class BaseTest {
@BeforeMethod
@Parameters({"browser"})
public static void createDriver(@Optional("chrome") String browser) {
WebDriver driver = setupDriver(browser);
DriverManager.setDriver(driver);
}
public static WebDriver setupDriver(String browserName) {
WebDriver driver;
switch (browserName.trim().toLowerCase()) {
case "edge":
driver = initEdgeDriver();
break;
case "firefox":
driver = initFirefoxDriver();
break;
case "chrome":
default:
System.out.println("Browser: " + browserName + " → launching Chrome by default...");
driver = initChromeDriver();
}
return driver;
}
private static WebDriver initEdgeDriver() {
System.out.println("Launching Edge browser...");
WebDriverManager.edgedriver().setup();
EdgeOptions options = new EdgeOptions();
options.setAcceptInsecureCerts(true); // ✅ Bỏ qua lỗi HTTPS
WebDriver driver = new EdgeDriver(options);
driver.manage().window().maximize();
return driver;
}
private static WebDriver initChromeDriver() {
System.out.println("Launching Chrome browser...");
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.setAcceptInsecureCerts(true); // ✅ Bỏ qua lỗi HTTPS
WebDriver driver = new ChromeDriver(options);
driver.manage().window().maximize();
return driver;
}
private static WebDriver initFirefoxDriver() {
System.out.println("Launching Firefox browser...");
WebDriverManager.firefoxdriver().setup();
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
return driver;
}
@AfterMethod
public void takeScreenshotOnFailure(ITestResult result) {
// Chỉ thực hiện nếu test bị FAIL
if (ITestResult.FAILURE == result.getStatus()) {
WebDriver driver = DriverManager.getDriver(); // Lấy driver hiện tại
if (driver != null) {
try {
// Chụp ảnh màn hình
TakesScreenshot ts = (TakesScreenshot) driver;
File source = ts.getScreenshotAs(OutputType.FILE);
// Tạo thư mục nếu chưa tồn tại
String screenshotDir = "./screenshots";
File dir = new File(screenshotDir);
if (!dir.exists()) {
dir.mkdirs(); // tạo thư mục nếu chưa có
}
// Đặt tên file: tên của test case + .png
String screenshotName = result.getName() + ".png";
File destFile = new File(dir, screenshotName);
// Lưu file
FileUtils.copyFile(source, destFile);
// In ra đường dẫn ảnh lưu
System.out.println("✅ Screenshot saved: " + destFile.getAbsolutePath());
} catch (IOException e) {
System.err.println("❌ Failed to save screenshot: " + e.getMessage());
e.printStackTrace();
}
} else {
System.err.println("⚠️ WebDriver is null, cannot capture screenshot.");
}
}
}
@AfterMethod
public void closeDriver() {
if (DriverManager.getDriver() != null) {
DriverManager.quit();
}
}
}
\ No newline at end of file
package Fosco.com.listeners;
import com.aventstack.extentreports.Status;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
import com.aventstack.extentreports.ExtentTest;
import trinhQC.com.helpers.CaptureHelper;
import trinhQC.com.helpers.EmailReportSender;
import trinhQC.com.helpers.RecordVideo;
import trinhQC.com.keywords.Log;
import trinhQC.com.reports.AllureReportManager;
import trinhQC.com.reports.ExtentReportManager;
import trinhQC.com.reports.ExtentReportTestManager;
import java.awt.*;
import java.io.File;
public class TestListener implements ITestListener {
public String getTestName(ITestResult result) {
return result.getTestName() != null ? result.getTestName()
: result.getMethod().getConstructorOrMethod().getName();
}
public String getTestDescription(ITestResult result) {
return result.getMethod().getDescription() != null ? result.getMethod().getDescription() : getTestName(result);
}
@Override
public void onStart(ITestContext iTestContext) {
Log.info("Start Suite: " + iTestContext.getStartDate());
RecordVideo.startRecord(iTestContext.getName());
}
@Override
public void onFinish(ITestContext result) {
Log.info("Finish Suite: " + result.getEndDate());
RecordVideo.stopRecord();
ExtentReportManager.getExtentReports().flush();
EmailReportSender.sendReport();
//RunCMD.Allure("allure serve target/allure-results");
}
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
}
@Override
public void onTestStart(ITestResult result) {
ExtentReportTestManager.saveToReport(getTestName(result),getTestDescription(result));
}
@Override
public void onTestSuccess(ITestResult result) {
//Ghi log binh thuong
Log.info(result.getName() + " is passed.");
//Extent Report
ExtentReportTestManager.logMessage(Status.PASS, getTestName(result) + " is passed.");
//Allure Report
AllureReportManager.saveTextLog(getTestName(result) + " is passed.");
}
@Override
public void onTestFailure(ITestResult result) {
//Ghi log binh thuong
Log.error(result.getName() + " is failed.");
CaptureHelper.captureScreenshot(result);
//Extent Report
ExtentReportTestManager.addScreenShotWithStatus(
Status.FAIL,
result.getName() + " is failed."
);
//Allure Report
AllureReportManager.saveScreenshotPNG();
AllureReportManager.saveTextLog(getTestName(result) + " is failed ");
}
@Override
public void onTestSkipped(ITestResult result) {
//Ghi log binh thuong
Log.info(result.getName() + " is skipped.");
//Extent Report
ExtentReportTestManager.addScreenShotWithStatus(
Status.SKIP,
result.getName() + " is skipped."
);
//Allure Report
AllureReportManager.saveScreenshotPNG();
AllureReportManager.saveTextLog(getTestName(result) + " is skipped.");
}
}
\ No newline at end of file
package Fosco.com.pages;
import org.checkerframework.checker.units.qual.K;
import org.openqa.selenium.By;
import org.testng.Assert;
import trinhQC.com.keywords.Key;
public class LoginPage {
private String URL = "https://fosco.erp.meu-solutions.com/vi/auth/sign-in";
By inputEmail = By.xpath("/html/body/div/div/div/div/div/div/div/form/div/div[2]/div[1]/input");
By inputPassword = By.xpath("/html/body/div/div/div/div/div/div/div/form/div/div[2]/div[2]/div/input");
By clickOnLoginButton = By.xpath("//button[contains(text(),'Đăng nhập')]");
public void LoginSuccess(String email, String password) {
Key.openURL(URL);
Key.setText(inputEmail, email);
Key.setText(inputPassword, password);
Key.clickElement(clickOnLoginButton);
Key.sleep(1.5);
}
By messageSuccess = By.xpath("(//div[contains(text(),'Đăng nhập thành công')])[1]");
public void verifyLoginThanhCong(String messageloginthanhcong) {
boolean ketquamongmuon = Key.getTextElement(messageSuccess).trim().equals(messageloginthanhcong);
Assert.assertTrue(ketquamongmuon, "Fail");
}
}
\ No newline at end of file
package Fosco.com.testcases;
import Fosco.com.commom.BaseTest;
import org.testng.annotations.Listeners;
import Fosco.com.listeners.TestListener;
import Fosco.com.pages.LoginPage;
import org.testng.annotations.Test;
import trinhQC.com.helpers.ExcelHelper;
@Listeners(Fosco.com.listeners.TestListener.class)
public class LoginTest extends BaseTest {
LoginPage loginPage;
ExcelHelper excelHelper;
@Test(priority =1)
public void LoginPass(){
loginPage = new LoginPage();
excelHelper = new ExcelHelper();
excelHelper.setExcelFile("src\\main\\resources\\login.xlsx","login");
loginPage.LoginSuccess(excelHelper.getCellData(1,0),
excelHelper.getCellData(1,1));
loginPage.verifyLoginThanhCong(excelHelper.getCellData(1,2));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment