Skip to content

Commit

Permalink
Update date Playwright 1.41.1
Browse files Browse the repository at this point in the history
  • Loading branch information
anhtester committed Jan 29, 2024
1 parent 7f33de3 commit 08720a5
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 37 deletions.
25 changes: 11 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
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>anhtester.com</groupId>
<groupId>com.anhtester</groupId>
<artifactId>PlaywrightJava</artifactId>
<version>1.0.0</version>
<version>1.41.1</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand All @@ -19,30 +19,28 @@
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.40.0</version>
<version>1.41.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
<version>7.9.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
<scope>test</scope>
<version>2.0.11</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.9</version>
<scope>test</scope>
<version>2.0.11</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
Expand Down Expand Up @@ -77,14 +75,14 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.22.0</version>
<version>3.0.0-beta1</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>
<version>3.0.0-beta1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
Expand Down Expand Up @@ -137,24 +135,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.0</version>
<version>3.12.1</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.3</version>
<version>3.2.5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>suites/CategoryTest.xml</suiteXmlFile>
<suiteXmlFile>suites/SuiteAll.xml</suiteXmlFile>
</suiteXmlFiles>

<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/1.9.21/aspectjweaver-1.9.21.jar"
</argLine>
<testFailureIgnore>true</testFailureIgnore>
<systemPropertyVariables>
<!--Đường dẫn xuất ra report-->
<allure.results.directory>target/allure-results</allure.results.directory>
</systemPropertyVariables>
</configuration>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/anhtester/reports/ExtentTestManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public static void addScreenShot(String message) {
ScreenshotOptions screenshotOptions = new ScreenshotOptions();

String base64Image = "data:image/png;base64,"
+ PageManager.getPage().screenshot(screenshotOptions.setPath(Paths.get(SystemHelper.getCurrentDir() + PropertiesHelper.getValue("SCREENSHOT_PATH") + File.separator + dateFormat.format(new Date()) + ".png")));
+ PageManager.getPage().screenshot(screenshotOptions.setPath(Paths.get(SystemHelper.getCurrentDir() + PropertiesHelper.getValue("SCREENSHOT_PATH") + File.separator + "ExtentReport_" + dateFormat.format(new Date()) + ".png"))).toString();

getTest().log(Status.INFO, message,
getTest().log(Status.FAIL, message,
MediaEntityBuilder.createScreenCaptureFromBase64String(base64Image).build());
}

Expand Down
1 change: 0 additions & 1 deletion src/main/resources/log4j2.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name=PropertiesConfigLog4j2
#Nen su dung 2 loai file .log hoac .txt
property.filename=logs/app_log.log
appenders=console, file

Expand Down
1 change: 0 additions & 1 deletion src/test/java/com/anhtester/listeners/AllureListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public void beforeTestStop(TestResult result) {
if (PageManager.getPage() != null) {
Allure.addAttachment(result.getName() + "_Failed_Screenshot", new ByteArrayInputStream(PageManager.getPage().screenshot(screenshotOptions.setPath(Paths.get(SystemHelper.getCurrentDir() + PropertiesHelper.getValue("SCREENSHOT_PATH") + File.separator + dateFormat.format(new Date()) + ".png")))));
}
AllureManager.addAttachmentVideoAVI();
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/test/java/com/anhtester/listeners/TestListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public void onStart(ITestContext result) {

@Override
public void onFinish(ITestContext result) {
//Kết thúc và thực thi Extents Report
ExtentReportManager.getExtentReports().flush();
}

Expand All @@ -41,7 +40,6 @@ public void onTestStart(ITestResult result) {
CaptureHelper.startRecord(result.getName());
}

//Bắt đầu ghi 1 TCs mới vào Extent Report
ExtentTestManager.saveToReport(getTestName(result), getTestDescription(result));
}

Expand All @@ -58,7 +56,6 @@ public void onTestSuccess(ITestResult result) {
CaptureHelper.stopRecord();
}

//Extent Report
ExtentTestManager.logMessage(Status.PASS, result.getName() + " is passed.");
}

Expand All @@ -82,7 +79,7 @@ public void onTestFailure(ITestResult result) {

//Allure Report
//AllureManager.saveTextLog(result.getName() + " is failed.");
AllureManager.saveScreenshotPNG();
//AllureManager.saveScreenshotPNG();
}

@Override
Expand Down
22 changes: 11 additions & 11 deletions src/test/resources/config/config.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
browser = chrome
email = admin@example.com
password = 123456
timeout = 20
url = https\://crm.anhtester.com/admin/authentication
SCREENSHOT_PATH = reports/Screenshots/
VIDEO_RECORD_PATH = reports/VideoRecords/
HEADLESS = false
VIDEO_RECORD = true
SCREENSHOT_FAIL = true
SCREENSHOT_PASS = false
browser=chrome
email=admin@example.com
password=123456
timeout=20
url=https://crm.anhtester.com/admin/authentication
SCREENSHOT_PATH=reports/Screenshots/
VIDEO_RECORD_PATH=reports/VideoRecords/
HEADLESS=false
VIDEO_RECORD=false
SCREENSHOT_FAIL=true
SCREENSHOT_PASS=false
4 changes: 2 additions & 2 deletions suites/CategoryTest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="SuiteLoginTest">
<test name="LoginTest" parallel="methods">
<suite name="Regression Test">
<test name="Category Test" parallel="methods">
<parameter name="browser" value="chromium"/>
<classes>
<class name="com.anhtester.pom.testcases.CategoryTest"/>
Expand Down
4 changes: 2 additions & 2 deletions suites/LoginTest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="SuiteLoginTest">
<test name="LoginTest" parallel="methods">
<suite name="Regression Test">
<test name="Login Test" parallel="methods">
<parameter name="browser" value="chrome"/>
<classes>
<class name="com.anhtester.pom.testcases.LoginTest"/>
Expand Down
7 changes: 7 additions & 0 deletions suites/SuiteAll.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Regression Test">
<suite-files>
<suite-file path="LoginTest.xml"/>
<suite-file path="CategoryTest.xml"/>
</suite-files>
</suite>

0 comments on commit 08720a5

Please sign in to comment.