Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/release-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
java-version: "11"
distribution: "adopt"
server-id: ossrh
server-id: central
server-username: MVN_CENTRAL_USERNAME
server-password: MVN_CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
Expand Down Expand Up @@ -54,7 +54,12 @@ jobs:

- name: Step 6 - Publish package
run: |
mvn -Dmaven.test.skip=true -P release -Drevision=${{ steps.gitversion.outputs.semVer }} deploy
mvn -B --no-transfer-progress \
versions:set \
-DnewVersion=${{ steps.gitversion.outputs.semVer }} \
-DgenerateBackupPoms=false \
-DprocessAllModules
mvn -B --no-transfer-progress -Dmaven.test.skip=true deploy
env:
MVN_CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MVN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
Expand Down
57 changes: 40 additions & 17 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,55 @@ jobs:
displayName: Analyse code with SonarQube

steps:
- task: SonarCloudPrepare@3
displayName: 'Prepare SonarCloud analysis'
inputs:
SonarCloud: 'SonarCloud'
organization: 'aqualityautomation'
scannerMode: 'CLI'
configMode: 'file'
extraProperties: 'sonar.coverage.exclusions=**/**'

- task: Maven@3
displayName: 'Build project'
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '11'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'clean'
- task: Maven@4
displayName: 'Build project'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false

- task: SonarCloudAnalyze@3
inputs:
jdkversion: 'JAVA_HOME_21_X64'
displayName: 'Run SonarCloud code analysis'
continueOnError: true

- task: SonarCloudPublish@3
displayName: 'Publish SonarCloud quality gate results'
inputs:
pollingTimeoutSec: '300'

- job: tests
displayName: Run tests

steps:

- task: Maven@3
- task: Maven@4
displayName: 'Run tests'
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '11'
jdkArchitectureOption: 'x64'
goals: 'clean test -Dprofile=local'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'test -Dprofile=local'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
48 changes: 21 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.aquality-automation</groupId>
<artifactId>aquality-selenium</artifactId>
<version>${revision}</version>
<version>4.0.0</version>
<packaging>jar</packaging>
<name>Aquality Selenium</name>
<description>Library around Selenium WebDriver</description>
Expand All @@ -15,20 +15,8 @@
<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>4.0.0-SNAPSHOT</revision>
</properties>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<scm>
<connection>scm:git:[email protected]:aquality-automation/aquality-selenium-java.git</connection>
<developerConnection>scm:git:[email protected]:aquality-automation/aquality-selenium-java.git</developerConnection>
Expand Down Expand Up @@ -82,12 +70,12 @@
<dependency>
<groupId>com.github.aquality-automation</groupId>
<artifactId>aquality-selenium-core</artifactId>
<version>4.6.0</version>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.17.0</version>
<version>3.18.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand All @@ -97,7 +85,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.16</version>
<version>2.0.17</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -119,7 +107,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<version>3.14.0</version>
<configuration>
<source>11</source>
<target>11</target>
Expand All @@ -128,7 +116,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<version>0.8.13</version>
<executions>
<execution>
<id>pre-unit-test</id>
Expand Down Expand Up @@ -156,7 +144,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
<version>3.5.3</version>
<configuration>
<argLine>${surefireArgLine} -Dfile.encoding=UTF-8</argLine>
<reuseForks>false</reuseForks>
Expand All @@ -168,6 +156,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -198,7 +187,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.1</version>
<version>3.11.2</version>
<configuration>
<source>11</source>
</configuration>
Expand All @@ -214,7 +203,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -232,16 +221,21 @@
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.7.0</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.18.0</version>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.Event;
import org.openqa.selenium.devtools.HasDevTools;
import org.openqa.selenium.devtools.v137.performance.Performance;
import org.openqa.selenium.devtools.v137.performance.model.Metric;
import org.openqa.selenium.devtools.v138.performance.Performance;
import org.openqa.selenium.devtools.v138.performance.model.Metric;

import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.v137.dom.model.RGBA;
import org.openqa.selenium.devtools.v137.emulation.Emulation;
import org.openqa.selenium.devtools.v137.emulation.model.MediaFeature;
import org.openqa.selenium.devtools.v137.emulation.model.ScreenOrientation;
import org.openqa.selenium.devtools.v138.dom.model.RGBA;
import org.openqa.selenium.devtools.v138.emulation.Emulation;
import org.openqa.selenium.devtools.v138.emulation.model.MediaFeature;
import org.openqa.selenium.devtools.v138.emulation.model.ScreenOrientation;

import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import org.openqa.selenium.devtools.idealized.Javascript;
import org.openqa.selenium.devtools.idealized.ScriptId;
import org.openqa.selenium.devtools.idealized.target.model.SessionID;
import org.openqa.selenium.devtools.v137.page.Page;
import org.openqa.selenium.devtools.v137.page.model.ScriptIdentifier;
import org.openqa.selenium.devtools.v137.runtime.Runtime;
import org.openqa.selenium.devtools.v138.page.Page;
import org.openqa.selenium.devtools.v138.page.model.ScriptIdentifier;
import org.openqa.selenium.devtools.v138.runtime.Runtime;
import org.openqa.selenium.logging.EventType;
import org.openqa.selenium.logging.HasLogEvents;
import org.openqa.selenium.remote.Augmenter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.openqa.selenium.UsernameAndPassword;
import org.openqa.selenium.devtools.NetworkInterceptor;
import org.openqa.selenium.devtools.idealized.Network;
import org.openqa.selenium.devtools.v137.network.model.*;
import org.openqa.selenium.devtools.v138.network.model.*;
import org.openqa.selenium.remote.http.*;

import java.net.URI;
Expand All @@ -22,11 +22,11 @@

import static aquality.selenium.browser.AqualityServices.getBrowser;
import static aquality.selenium.logging.LocalizedLoggerUtility.logByLevel;
import static org.openqa.selenium.devtools.v137.network.Network.*;
import static org.openqa.selenium.devtools.v138.network.Network.*;

/**
* DevTools commands for version-independent network interception.
* For more information, see {@link org.openqa.selenium.devtools.v137.network.Network} and {@link Network}.
* For more information, see {@link org.openqa.selenium.devtools.v138.network.Network} and {@link Network}.
*/
public class NetworkHandling {
public static final String LOC_NETWORK_INTERCEPTOR_START = "loc.browser.network.interceptor.start";
Expand Down Expand Up @@ -129,7 +129,7 @@ public void interceptTrafficWith(Filter filter) {
*/
public void addRequestListener(Consumer<RequestWillBeSent> listener) {
logger.info("loc.browser.network.event.requestsent.add");
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty()));
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()));
tools.addListener(requestWillBeSent(), listener);
}

Expand All @@ -139,7 +139,7 @@ public void addRequestListener(Consumer<RequestWillBeSent> listener) {
*/
public void addResponseListener(Consumer<ResponseReceived> listener) {
logger.info("loc.browser.network.event.responsereceived.add");
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty()));
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()));
tools.addListener(responseReceived(), listener);
}

Expand Down Expand Up @@ -179,7 +179,7 @@ private Consumer<RequestWillBeSent> getRequestLogger(HttpExchangeLoggingOptions
if (loggingOptions.getRequestPostData().isEnabled() && request.getHasPostData().orElse(false)) {
logByLevel(loggingOptions.getRequestPostData().getLogLevel(),
"loc.browser.network.event.requestsent.log.data",
request.getPostData().orElse(null));
request.getPostDataEntries().orElse(null));
}
};
}
Expand All @@ -199,7 +199,7 @@ private Consumer<ResponseReceived> getResponseLogger(HttpExchangeLoggingOptions
formatHeaders(response.getHeaders()));
}
if (loggingOptions.getResponseBody().isEnabled()) {
String responseBody = tools.sendCommand(org.openqa.selenium.devtools.v137.network.Network.getResponseBody(requestId)).getBody();
String responseBody = tools.sendCommand(org.openqa.selenium.devtools.v138.network.Network.getResponseBody(requestId)).getBody();
if (StringUtils.isNotEmpty(responseBody)) {
logByLevel(loggingOptions.getResponseBody().getLogLevel(),
"loc.browser.network.event.responsereceived.log.body",
Expand Down Expand Up @@ -322,7 +322,7 @@ public void clearNetworkInterceptor() {
* @param uploadThroughput Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.
*/
public void emulateConditions(Boolean offline, Number latency, Number downloadThroughput, Number uploadThroughput) {
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty()));
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()));
tools.sendCommand(emulateNetworkConditions(offline, latency, downloadThroughput, uploadThroughput, Optional.empty(),
Optional.empty(), Optional.empty(), Optional.empty()));
}
Expand All @@ -338,7 +338,7 @@ public void emulateConditions(Boolean offline, Number latency, Number downloadTh
* "wifi", "wimax", "other".
*/
public void emulateConditions(Boolean offline, Number latency, Number downloadThroughput, Number uploadThroughput, String connectionType) {
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty()));
tools.sendCommand(enable(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()));
tools.sendCommand(emulateNetworkConditions(offline, latency, downloadThroughput, uploadThroughput,
Optional.of(ConnectionType.fromString(connectionType)), Optional.empty(), Optional.empty(), Optional.empty()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import aquality.selenium.browser.AqualityServices;
import aquality.selenium.browser.devtools.EmulationHandling;
import com.google.common.collect.ImmutableMap;
import org.openqa.selenium.devtools.v137.emulation.Emulation;
import org.openqa.selenium.devtools.v137.emulation.model.DisplayFeature;
import org.openqa.selenium.devtools.v138.emulation.Emulation;
import org.openqa.selenium.devtools.v138.emulation.model.DisplayFeature;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.common.net.MediaType;
import manytools.RequestHeadersForm;
import org.openqa.selenium.devtools.NetworkInterceptor;
import org.openqa.selenium.remote.http.Contents;
import org.openqa.selenium.remote.http.HttpHandler;
import org.openqa.selenium.remote.http.HttpRequest;
import org.openqa.selenium.remote.http.HttpResponse;
Expand All @@ -15,7 +16,6 @@
import theinternet.TheInternetPage;
import theinternet.forms.WelcomeForm;

import java.io.ByteArrayInputStream;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;

Expand Down Expand Up @@ -87,7 +87,7 @@ public void testAddAndClearRequestHandler()
final String somePhrase = "delicious cheese!";
NetworkInterceptor networkInterceptor = network().addRequestHandler(request -> true, request -> {
HttpResponse response = new HttpResponse();
response.setContent(() -> new ByteArrayInputStream(somePhrase.getBytes()));
response.setContent(Contents.utf8String(somePhrase));
response.setStatus(200);
return response;
});
Expand All @@ -106,7 +106,7 @@ public void testAddAndClearResponseHandler()
final String somePhrase = "delicious cheese!";
NetworkInterceptor networkInterceptor = network().addResponseHandler(response -> true, oldResponse -> {
HttpResponse response = new HttpResponse();
response.setContent(() -> new ByteArrayInputStream(somePhrase.getBytes()));
response.setContent(Contents.utf8String(somePhrase));
response.setStatus(200);
return response;
});
Expand Down
Loading
Loading