Skip to content

Commit 3a4bf4f

Browse files
committed
Merge branch 'master' into Feature/Add-Multichoice-Combobox
2 parents 40f6031 + aff8e90 commit 3a4bf4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+767
-196
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish package to Maven Central
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
types: [closed]
7+
8+
jobs:
9+
publish:
10+
if: github.event.pull_request.merged == true
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Step 1 - Checkout code
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Step 2 - Set up Maven Central Repository
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: "8"
22+
distribution: "adopt"
23+
server-id: ossrh
24+
server-username: MVN_CENTRAL_USERNAME
25+
server-password: MVN_CENTRAL_PASSWORD
26+
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
27+
gpg-passphrase: MVN_GPG_PASSPHRASE
28+
29+
- name: Step 3 - Install GitVersion
30+
uses: gittools/actions/gitversion/setup@v0
31+
with:
32+
versionSpec: '5.x'
33+
34+
- name: Step 4 - Determine Version
35+
id: gitversion
36+
uses: gittools/actions/gitversion/execute@v0
37+
with:
38+
useConfigFile: true
39+
40+
- name: Step 5 - Create Release
41+
id: create_release
42+
uses: actions/create-release@latest
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
TITLE: ${{ github.event.pull_request.title }}
46+
BODY: ${{ github.event.pull_request.body }}
47+
VERSION: "v${{ steps.gitversion.outputs.semVer }}"
48+
with:
49+
tag_name: ${{ env.VERSION }}
50+
release_name: ${{ env.VERSION }} ${{ env.TITLE }}
51+
body: ${{ env.BODY }}
52+
draft: false
53+
prerelease: false
54+
55+
- name: Step 6 - Publish package
56+
run: |
57+
mvn -Dmaven.test.skip=true -P release -Drevision=${{ steps.gitversion.outputs.semVer }} deploy
58+
env:
59+
MVN_CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
60+
MVN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
61+
MVN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

GitVersion.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
mode: Mainline
2+
increment: Inherit
3+
branches: {}
4+
ignore:
5+
sha: []
6+

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2023 Aquality Automation
189+
Copyright 2024 Aquality Automation
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

pom.xml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.aquality-automation</groupId>
88
<artifactId>aquality-selenium</artifactId>
9-
<version>4.0.0</version>
9+
<version>${revision}</version>
1010
<packaging>jar</packaging>
1111
<name>Aquality Selenium</name>
1212
<description>Library around Selenium WebDriver</description>
@@ -15,16 +15,17 @@
1515
<properties>
1616
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
1717
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
<revision>4.0.0-SNAPSHOT</revision>
1819
</properties>
1920

2021
<distributionManagement>
2122
<snapshotRepository>
2223
<id>ossrh</id>
23-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
24+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
2425
</snapshotRepository>
2526
<repository>
2627
<id>ossrh</id>
27-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
28+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
2829
</repository>
2930
</distributionManagement>
3031

@@ -81,25 +82,34 @@
8182
<dependency>
8283
<groupId>com.github.aquality-automation</groupId>
8384
<artifactId>aquality-selenium-core</artifactId>
84-
<version>3.0.0</version>
85+
<version>3.1.2</version>
8586
</dependency>
86-
8787
<dependency>
88-
<groupId>io.github.bonigarcia</groupId>
89-
<artifactId>webdrivermanager</artifactId>
90-
<version>5.3.2</version>
88+
<groupId>org.apache.commons</groupId>
89+
<artifactId>commons-lang3</artifactId>
90+
<version>3.13.0</version>
9191
</dependency>
92-
9392
<dependency>
9493
<groupId>com.fasterxml.jackson.core</groupId>
9594
<artifactId>jackson-databind</artifactId>
96-
<version>2.14.2</version>
95+
<version>2.16.1</version>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.slf4j</groupId>
99+
<artifactId>slf4j-simple</artifactId>
100+
<version>2.0.10</version>
101+
<scope>test</scope>
102+
</dependency>
103+
<dependency>
104+
<groupId>org.openpnp</groupId>
105+
<artifactId>opencv</artifactId>
106+
<version>[4.7.0,)</version>
97107
</dependency>
98108

99109
<dependency>
100110
<groupId>org.testng</groupId>
101111
<artifactId>testng</artifactId>
102-
<version>7.5</version>
112+
<version>7.5.1</version>
103113
<scope>test</scope>
104114
</dependency>
105115
</dependencies>
@@ -187,6 +197,9 @@
187197
<plugin>
188198
<groupId>org.apache.maven.plugins</groupId>
189199
<artifactId>maven-javadoc-plugin</artifactId>
200+
<configuration>
201+
<source>8</source>
202+
</configuration>
190203
<executions>
191204
<execution>
192205
<id>attach-javadocs</id>
@@ -207,6 +220,12 @@
207220
<goals>
208221
<goal>sign</goal>
209222
</goals>
223+
<configuration>
224+
<gpgArguments>
225+
<arg>--pinentry-mode</arg>
226+
<arg>loopback</arg>
227+
</gpgArguments>
228+
</configuration>
210229
</execution>
211230
</executions>
212231
</plugin>
@@ -217,7 +236,7 @@
217236
<extensions>true</extensions>
218237
<configuration>
219238
<serverId>ossrh</serverId>
220-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
239+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
221240
<autoReleaseAfterClose>true</autoReleaseAfterClose>
222241
</configuration>
223242
</plugin>

src/main/java/aquality/selenium/browser/Browser.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import aquality.selenium.core.localization.ILocalizationManager;
1010
import aquality.selenium.core.localization.ILocalizedLogger;
1111
import aquality.selenium.core.waitings.IConditionalWait;
12-
import org.apache.commons.io.IOUtils;
13-
import org.apache.commons.lang3.NotImplementedException;
1412
import org.openqa.selenium.*;
1513
import org.openqa.selenium.WebDriver.Navigation;
1614
import org.openqa.selenium.devtools.HasDevTools;
@@ -21,7 +19,6 @@
2119

2220
import java.io.File;
2321
import java.io.IOException;
24-
import java.nio.charset.StandardCharsets;
2522
import java.time.Duration;
2623
import java.util.function.Supplier;
2724

@@ -125,7 +122,7 @@ public void refresh() {
125122
}
126123

127124
/**
128-
* Refreshes the page and process alert that apears after refreshing
125+
* Refreshes the page and process alert that appears after refreshing
129126
*
130127
* @param alertAction accept or decline alert
131128
*/
@@ -135,19 +132,20 @@ public void refreshPageWithAlert(AlertActions alertAction) {
135132
}
136133

137134
private Navigation navigate() {
138-
return new BrowserNavigation(getDriver());
135+
return new BrowserNavigation(getDriver(), localizedLogger);
139136
}
140137

141138
/**
142139
* Provides interface to manage of browser tabs.
143140
* @return Instance of IBrowserTabNavigation.
144141
*/
145142
public IBrowserTabNavigation tabs() {
146-
return new BrowserTabNavigation(getDriver());
143+
return new BrowserTabNavigation(getDriver(), localizedLogger);
147144
}
148145

149146
/**
150-
* Sets page load timeout (Will be ignored for Safari https://github.com/SeleniumHQ/selenium-google-code-issue-archive/issues/687)
147+
* Sets page load timeout (Will be ignored for Safari
148+
* <a href="https://github.com/SeleniumHQ/selenium-google-code-issue-archive/issues/687">...</a>)
151149
*
152150
* @param timeout seconds to wait
153151
*/
@@ -248,10 +246,9 @@ public Object executeAsyncScript(JavaScript scriptName, Object... args) {
248246
* @param file Java Script file
249247
* @param arguments Arguments for the script (web elements, values etc.
250248
* @return Result object of script execution
251-
* @throws IOException in case of problems with the File
252249
*/
253-
public Object executeAsyncScript(final File file, Object... arguments) throws IOException {
254-
return executeAsyncScript(IOUtils.toString(file.toURI(), StandardCharsets.UTF_8.name()), arguments);
250+
public Object executeAsyncScript(final File file, Object... arguments) {
251+
return executeAsyncScript(JavaScript.readScript(file), arguments);
255252
}
256253

257254
/**
@@ -303,7 +300,7 @@ public Object executeScript(JavaScript scriptName, Object... args) {
303300
* @throws IOException in case of problems with the File
304301
*/
305302
public Object executeScript(final File file, Object... arguments) throws IOException {
306-
return executeScript(IOUtils.toString(file.toURI(), StandardCharsets.UTF_8.name()), arguments);
303+
return executeScript(JavaScript.readScript(file), arguments);
307304
}
308305

309306
/**
@@ -400,7 +397,7 @@ public DevToolsHandling devTools() {
400397
return devTools;
401398
}
402399
else {
403-
throw new NotImplementedException("DevTools protocol is not supported for current browser.");
400+
throw new UnsupportedOperationException("DevTools protocol is not supported for current browser.");
404401
}
405402
}
406403

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,55 @@
11
package aquality.selenium.browser;
22

3+
import aquality.selenium.core.localization.ILocalizedLogger;
34
import org.openqa.selenium.WebDriver.Navigation;
45
import org.openqa.selenium.remote.RemoteWebDriver;
56

67
import java.net.URL;
78

8-
class BrowserNavigation implements Navigation {
9+
/**
10+
* Browser navigation wrapper with localized logging.
11+
*/
12+
public class BrowserNavigation implements Navigation {
913

1014
private final RemoteWebDriver driver;
15+
private final ILocalizedLogger logger;
1116

12-
BrowserNavigation(RemoteWebDriver driver){
17+
protected BrowserNavigation(RemoteWebDriver driver, ILocalizedLogger logger){
1318
this.driver = driver;
19+
this.logger = logger;
1420
}
1521

1622
@Override
1723
public void back() {
1824
infoLoc("loc.browser.back");
19-
getDriver().navigate().back();
25+
driver.navigate().back();
2026
}
2127

2228
@Override
2329
public void forward() {
2430
infoLoc("loc.browser.forward");
25-
getDriver().navigate().forward();
31+
driver.navigate().forward();
2632
}
2733

2834
@Override
2935
public void to(String s) {
3036
infoLoc("loc.browser.navigate", s);
31-
getDriver().navigate().to(s);
37+
driver.navigate().to(s);
3238
}
3339

3440
@Override
3541
public void to(URL url) {
3642
infoLoc("loc.browser.navigate", url);
37-
getDriver().navigate().to(url);
43+
driver.navigate().to(url);
3844
}
3945

4046
@Override
4147
public void refresh() {
4248
infoLoc("loc.browser.refresh");
43-
getDriver().navigate().refresh();
44-
}
45-
46-
private RemoteWebDriver getDriver() {
47-
return driver;
49+
driver.navigate().refresh();
4850
}
4951

5052
private void infoLoc(String key, Object... args) {
51-
AqualityServices.getLocalizedLogger().info(key, args);
53+
logger.info(key, args);
5254
}
5355
}

0 commit comments

Comments
 (0)