Skip to content

Commit f63cb8f

Browse files
committed
Update Selenium 4.22.0
1 parent dbfcce6 commit f63cb8f

File tree

8 files changed

+59
-59
lines changed

8 files changed

+59
-59
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ HDSD.txt
1818
*.zip
1919
*.iml
2020
screenshots/
21+
allure-report/

CHANGELOG.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
v1.7.8
2+
======
3+
Jun 24, 2024
4+
* Update Selenium 4.22.0
5+
* Update support CDP 126 (Chromium)
6+
* Update CucumberListener class
7+
18
v1.7.7
29
======
310
May 28, 2024

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
1616
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
1717
<java-compiler.version>17</java-compiler.version>
18-
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
18+
<maven-surefire-plugin.version>3.3.0</maven-surefire-plugin.version>
1919
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
2020

2121
<cucumber.java.version>7.18.0</cucumber.java.version>
2222
<gherkin.version>28.0.0</gherkin.version>
2323
<cucumber-reporting.version>5.8.0</cucumber-reporting.version>
24-
<selenium.version>4.21.0</selenium.version>
24+
<selenium.version>4.22.0</selenium.version>
2525
<testng.version>7.10.2</testng.version>
2626
<aspectjweaver.version>1.9.22.1</aspectjweaver.version>
2727
<log4j.version>2.23.1</log4j.version>
@@ -41,13 +41,13 @@
4141
<mysql-connector-java.version>8.0.33</mysql-connector-java.version>
4242
<google.zxing.version>3.5.3</google.zxing.version>
4343
<lombok.version>1.18.32</lombok.version>
44-
<google.guava.version>33.2.0-jre</google.guava.version>
44+
<google.guava.version>33.2.1-jre</google.guava.version>
4545
<data.supplier.version>1.9.7</data.supplier.version>
4646
<javax.mail.version>1.6.2</javax.mail.version>
4747
<zip.version>1.17</zip.version>
4848
<jackson.version>2.17.1</jackson.version>
4949
<datafaker.version>2.2.2</datafaker.version>
50-
<telegram.bot.version>7.2.1</telegram.bot.version>
50+
<telegram.bot.version>7.4.0</telegram.bot.version>
5151
<slf4j.version>2.0.13</slf4j.version>
5252
<commons-lang3.version>3.14.0</commons-lang3.version>
5353
<extentreports-cucumber7-adapter.version>1.14.0</extentreports-cucumber7-adapter.version>

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
import org.openqa.selenium.chrome.ChromeOptions;
3333
import org.openqa.selenium.devtools.DevTools;
3434
import org.openqa.selenium.devtools.HasDevTools;
35-
import org.openqa.selenium.devtools.v125.network.Network;
36-
import org.openqa.selenium.devtools.v125.network.model.Headers;
35+
import org.openqa.selenium.devtools.v126.network.Network;
36+
import org.openqa.selenium.devtools.v126.network.model.Headers;
3737
import org.openqa.selenium.interactions.Actions;
3838
import org.openqa.selenium.print.PrintOptions;
3939
import org.openqa.selenium.support.ui.ExpectedCondition;
@@ -2670,7 +2670,7 @@ public static void clearAndFillText(By by, String value) {
26702670
*/
26712671
@Step("Click on the element {0}")
26722672
public static void clickElement(By by) {
2673-
waitForElementVisible(by).click();
2673+
waitForElementClickable(by).click();
26742674
LogUtils.info("Clicked on the element " + by.toString());
26752675

26762676
if (ExtentTestManager.getExtentTest() != null) {
@@ -2689,7 +2689,7 @@ public static void clickElement(By by) {
26892689
*/
26902690
@Step("Click on the element {0} with timeout {1}s")
26912691
public static void clickElement(By by, int timeout) {
2692-
waitForElementVisible(by, timeout).click();
2692+
waitForElementClickable(by, timeout).click();
26932693
LogUtils.info("Clicked on the element " + by.toString());
26942694

26952695
if (ExtentTestManager.getExtentTest() != null) {
@@ -2753,7 +2753,7 @@ public static void clickLinkText(String linkText) {
27532753
@Step("Right click on element {0}")
27542754
public static void rightClickElement(By by) {
27552755
Actions action = new Actions(DriverManager.getDriver());
2756-
action.contextClick(waitForElementVisible(by)).build().perform();
2756+
action.contextClick(waitForElementClickable(by)).build().perform();
27572757
LogUtils.info("Right click on element " + by);
27582758
if (ExtentTestManager.getExtentTest() != null) {
27592759
ExtentReportManager.pass("Right click on element " + by);

src/test/java/com/anhtester/hooks/CucumberListener.java

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99

1010
public class CucumberListener implements EventListener {
1111

12-
public static int count_totalTCs = 0;
13-
public static int count_passedTCs = 0;
14-
public static int count_skippedTCs = 0;
15-
public static int count_failedTCs = 0;
16-
1712
@Override
1813
public void setEventPublisher(EventPublisher publisher) {
1914
//Set all events that need use (public). Override from EventListener
@@ -34,7 +29,7 @@ private void runStarted(TestRunStarted event) {
3429
// Execute after @After in hook
3530
private void runFinished(TestRunFinished event) {
3631
LogUtils.info("********* RUN FINISHED *********");
37-
ReportUtils.openReports(SystemHelpers.getCurrentDir() + PropertiesHelpers.getValue("extent.reporter.spark.out"));
32+
//ReportUtils.openReports(SystemHelpers.getCurrentDir() + PropertiesHelpers.getValue("extent.reporter.spark.out"));
3833
}
3934

4035
// This event is triggered when feature file is read
@@ -49,56 +44,50 @@ private void featureRead(TestSourceRead event) {
4944
private void ScenarioStarted(TestCaseStarted event) {
5045
// LogUtils.info("Scenario Path: " + event.getTestCase().getUri().toString());
5146
// LogUtils.info("Scenario Name: " + event.getTestCase().getName());
52-
count_totalTCs = count_totalTCs + 1;
5347
}
5448

5549
private void ScenarioFinished(TestCaseFinished event) {
56-
Result result = event.getResult();
57-
58-
if (Status.PASSED.equals(result.getStatus())) {
59-
count_passedTCs = count_passedTCs + 1;
60-
}
61-
if (Status.FAILED.equals(result.getStatus())) {
62-
count_failedTCs = count_failedTCs + 1;
63-
}
64-
if (Status.SKIPPED.equals(result.getStatus())) {
65-
count_skippedTCs = count_skippedTCs + 1;
66-
}
50+
// Result result = event.getResult();
51+
//
52+
// if (Status.PASSED.equals(result.getStatus())) {
53+
//
54+
// }
55+
// if (Status.FAILED.equals(result.getStatus())) {
56+
//
57+
// }
58+
// if (Status.SKIPPED.equals(result.getStatus())) {
59+
//
60+
// }
6761
}
6862

6963
// Step started event
7064
private void stepStarted(TestStepStarted event) {
71-
String stepName = "";
72-
String keyword = "";
73-
74-
// Check whether the event is from a hook or step
75-
if (event.getTestStep() instanceof PickleStepTestStep) {
76-
// TestStepStarted event implements PickleStepTestStep interface
77-
// Which have additional methods to interact with the event object
78-
// So we have to cast TestCase object to get those methods
79-
PickleStepTestStep steps = (PickleStepTestStep) event.getTestStep();
80-
stepName = steps.getStep().getText();
81-
keyword = steps.getStep().getKeyword();
82-
} else {
83-
// Same with HookTestStep
84-
HookTestStep hoo = (HookTestStep) event.getTestStep();
85-
stepName = hoo.getHookType().name();
86-
}
65+
// String stepName = "";
66+
// String keyword = "";
67+
//
68+
// if (event.getTestStep() instanceof PickleStepTestStep) {
69+
// PickleStepTestStep steps = (PickleStepTestStep) event.getTestStep();
70+
// stepName = steps.getStep().getText();
71+
// keyword = steps.getStep().getKeyword();
72+
// } else {
73+
// HookTestStep hoo = (HookTestStep) event.getTestStep();
74+
// stepName = hoo.getHookType().name();
75+
// }
8776
}
8877

8978
// This is triggered when test Step is finished
9079
private void stepFinished(TestStepFinished event) {
91-
Result result = event.getResult();
92-
93-
if (Status.PASSED.equals(result.getStatus())) {
94-
95-
}
96-
if (Status.FAILED.equals(result.getStatus())) {
97-
98-
}
99-
if (Status.SKIPPED.equals(result.getStatus())) {
100-
101-
}
80+
// Result result = event.getResult();
81+
//
82+
// if (Status.PASSED.equals(result.getStatus())) {
83+
//
84+
// }
85+
// if (Status.FAILED.equals(result.getStatus())) {
86+
//
87+
// }
88+
// if (Status.SKIPPED.equals(result.getStatus())) {
89+
//
90+
// }
10291
}
10392

10493
}

src/test/java/com/anhtester/hooks/Hooks.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
import com.anhtester.driver.ScenarioManager;
55
import com.anhtester.helpers.CaptureHelpers;
66
import com.anhtester.helpers.PropertiesHelpers;
7+
import com.anhtester.helpers.SystemHelpers;
78
import com.anhtester.keywords.WebUI;
89
import com.anhtester.report.AllureManager;
910
import com.anhtester.utils.EmailSendUtils;
1011
import com.anhtester.utils.LogUtils;
12+
import com.anhtester.utils.ReportUtils;
1113
import com.anhtester.utils.ZipUtils;
1214
import io.cucumber.java.*;
1315
import org.apache.commons.io.FileUtils;
@@ -55,6 +57,7 @@ public static void before_all() {
5557
public static void after_all() {
5658
LogUtils.info("================ AFTER ALL ================");
5759
ZipUtils.zipReportFolder();
60+
ReportUtils.openReports(SystemHelpers.getCurrentDir() + PropertiesHelpers.getValue("extent.reporter.spark.out"));
5861
EmailSendUtils.sendEmail(count_totalTCs
5962
, count_passedTCs
6063
, count_failedTCs
@@ -68,7 +71,7 @@ public static void after_all() {
6871

6972
@Before
7073
public void beforeScenario(Scenario scenario) {
71-
LogUtils.info("Scenario Name: " + scenario.getName());
74+
LogUtils.info("Running Scenario Name: " + scenario.getName());
7275
count_totalTCs = count_totalTCs + 1;
7376
ScenarioManager.setScenario(scenario);
7477

src/test/resources/config/config.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ SCREENSHOT_PASSED_STEPS = no
5555
# Failed Steps Screenshot
5656
SCREENSHOT_FAILED_STEPS = yes
5757
# All Steps Screenshot
58-
SCREENSHOT_ALL_STEPS = yes
58+
SCREENSHOT_ALL_STEPS = no
5959
# All Steps Detail Screenshot
60-
SCREENSHOT_ALL_STEPS_DETAIL = yes
60+
SCREENSHOT_ALL_STEPS_DETAIL = no
6161
# Delete the 'reports' folder before run test
62-
DELETE_TEMP_FOLDER = yes
62+
DELETE_TEMP_FOLDER = no

src/test/resources/extent.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ screenshot.rel.path = /reports/CucumberExtentReports/images/
1616
extent.reporter.spark.base64imagesrc = true
1717

1818
#PDF FILE
19-
extent.reporter.pdf.start = true
19+
extent.reporter.pdf.start = false
2020
extent.reporter.pdf.out = reports/CucumberExtentReports/CucumberExtentPdfReport.pdf
2121
#EXCEL FILE
2222
extent.reporter.excel.start = false

0 commit comments

Comments
 (0)