diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e93568..210ef8c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: needs: [check-code] timeout-minutes: 10 outputs: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ steps.create-release.outputs.upload_url }} steps: - uses: actions/checkout@v4 @@ -61,15 +61,7 @@ jobs: git config --global user.name "GitHub Actions" - name: Un-SNAP - run: | - mvnwPath=$(readlink -f ./mvnw) - modules=("") # root - modules+=($(grep -oP '(?<=)[^<]+' 'pom.xml')) - for i in "${modules[@]}" - do - echo "Processing $i/pom.xml" - (cd "$i" && $mvnwPath -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false) - done + run: ./mvnw -B versions:set -DremoveSnapshot -DprocessAllModules -DgenerateBackupPoms=false - name: Get version id: version @@ -88,7 +80,7 @@ jobs: git push origin --tags - name: Create Release - id: create_release + id: create-release uses: shogo82148/actions-create-release@4661dc54f7b4b564074e9fbf73884d960de569a3 # v1 with: tag_name: v${{ steps.version.outputs.release }} @@ -112,6 +104,9 @@ jobs: runs-on: ubuntu-latest needs: [prepare-release] timeout-minutes: 60 + permissions: + contents: read + packages: write steps: - uses: actions/checkout@v4 @@ -120,20 +115,34 @@ jobs: git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" git pull + + - name: Set up JDK + uses: actions/setup-java@v4 + with: # running setup-java overwrites the settings.xml + distribution: 'temurin' + java-version: '17' + gpg-passphrase: MAVEN_GPG_PASSPHRASE + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once + - name: Publish to Central Portal + run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github::https://maven.pkg.github.com/${{ github.repository }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} + - name: Set up JDK uses: actions/setup-java@v4 with: # running setup-java again overwrites the settings.xml - java-version: '17' distribution: 'temurin' + java-version: '17' server-id: sonatype-central-portal server-username: MAVEN_CENTRAL_USERNAME server-password: MAVEN_CENTRAL_TOKEN gpg-passphrase: MAVEN_GPG_PASSPHRASE - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - name: Publish to Central Portal - run: ../mvnw -B deploy -P publish-sonatype-central-portal -DskipTests + run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests env: MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }} MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }} @@ -185,15 +194,7 @@ jobs: git pull - name: Inc Version and SNAP - run: | - mvnwPath=$(readlink -f ./mvnw) - modules=("") # root - modules+=($(grep -oP '(?<=)[^<]+' 'pom.xml')) - for i in "${modules[@]}" - do - echo "Processing $i/pom.xml" - (cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true -DupdateMatchingVersions=false) - done + run: ./mvnw -B versions:set -DnextSnapshot -DprocessAllModules -DgenerateBackupPoms=false - name: Git Commit and Push run: | diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 8a85891..922eda0 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -10,8 +10,26 @@ jobs: publish-maven: runs-on: ubuntu-latest timeout-minutes: 60 + permissions: + contents: read + packages: write steps: - uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: # running setup-java overwrites the settings.xml + distribution: 'temurin' + java-version: '17' + gpg-passphrase: MAVEN_GPG_PASSPHRASE + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once + + - name: Publish to GitHub Packages + run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github::https://maven.pkg.github.com/${{ github.repository }} + working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - name: Set up JDK uses: actions/setup-java@v4 @@ -22,10 +40,9 @@ jobs: server-username: MAVEN_CENTRAL_USERNAME server-password: MAVEN_CENTRAL_TOKEN gpg-passphrase: MAVEN_GPG_PASSPHRASE - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - name: Publish to Central Portal - run: ../mvnw -B deploy -P publish-sonatype-central-portal -DskipTests + run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} env: MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }} diff --git a/.gitignore b/.gitignore index 5c85054..14a1fb4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,12 @@ # Maven target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -# https://github.com/takari/maven-wrapper#usage-without-binary-jar + +# Maven Wrapper .mvn/wrapper/maven-wrapper.jar +# Maven Flatten Plugin +.flattened-pom.xml # Compiled class file *.class @@ -18,20 +14,12 @@ buildNumber.properties # Log file *.log -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - # Package/Binary Files don't belong into a git repo *.jar *.war -*.nar *.ear *.zip *.tar.gz -*.rar *.dll *.exe *.bin @@ -39,27 +27,11 @@ buildNumber.properties # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* -# JRebel -**/resources/rebel.xml -**/resources/rebel-remote.xml - -# eclispe stuff for root -/.settings/ -/.classpath -/.project - - -# eclispe stuff for modules -/*/.metadata/ -/*/.apt_generated_tests/ -/*/.settings/ -/*/.classpath -/*/.project -/*/RemoteSystemsTempFiles/ - -#custom -.flattened-pom.xml -.tern-project +# Eclipse +.metadata +.settings +.classpath +.project # == IntelliJ == *.iml diff --git a/CHANGELOG.md b/CHANGELOG.md index 027747b..cff82d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.0.3 +* Removed reflection calls in ``CustomizableJsonToWebElementConverter`` as https://github.com/SeleniumHQ/selenium/issues/15884 was fixed #11 + * Selenium version 4.34+ is required +* Updated dependencies + # 1.0.2 * ``ImprovedRemoteWebElement`` * Make it possible to disable auto scroll diff --git a/README.md b/README.md index d992983..4ef1006 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/selenium-elements/check-build.yml?branch=develop)](https://github.com/xdev-software/selenium-elements/actions/workflows/check-build.yml?query=branch%3Adevelop) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_selenium-elements&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_selenium-elements) -# Elements for Selenium +# Elements for Selenium Define Selenium HTML elements as Java classes, similar to Selenium's [``@FindBy`` annotation](https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/support/FindBy.html). Also contains a ton of other predefined utility, for example: -* Automatically scrolling elements that perform operations into the view +* Automatically scrolls elements that perform operations into the view * Safe click: When an element is detected as stale a JavaScript click is executed instead * Option to globally wait until the page finished loading * Waiting for some time until the element is present (``waitUntil``) diff --git a/pom.xml b/pom.xml index 209f17a..8b9dbc6 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ com.puppycrawl.tools checkstyle - 10.25.0 + 10.26.1 @@ -69,7 +69,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.26.0 + 3.27.0 true true @@ -81,12 +81,12 @@ net.sourceforge.pmd pmd-core - 7.14.0 + 7.15.0 net.sourceforge.pmd pmd-java - 7.14.0 + 7.15.0 diff --git a/renovate.json5 b/renovate.json5 index 39e6fa8..5cde43e 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -19,6 +19,16 @@ "maven" ], "groupName": "net.sourceforge.pmd" + }, + { + "description": "Group org.seleniumhq.selenium", + "matchPackagePatterns": [ + "^org.seleniumhq.selenium" + ], + "datasources": [ + "maven" + ], + "groupName": "org.seleniumhq.selenium" } ] } diff --git a/selenium-elements/pom.xml b/selenium-elements/pom.xml index 09a71f3..e8efcf4 100644 --- a/selenium-elements/pom.xml +++ b/selenium-elements/pom.xml @@ -53,7 +53,7 @@ org.seleniumhq.selenium selenium-support - 4.33.0 + 4.34.0 @@ -82,7 +82,7 @@ org.junit.jupiter junit-jupiter - 5.13.1 + 5.13.3 test @@ -94,13 +94,13 @@ software.xdev testcontainers-selenium - 1.2.3 + 1.2.4 test org.seleniumhq.selenium selenium-firefox-driver - 4.33.0 + 4.34.0 test @@ -113,7 +113,7 @@ org.seleniumhq.selenium selenium-chrome-driver - 4.33.0 + 4.34.0 test @@ -217,13 +217,13 @@ - publish-sonatype-central-portal + publish org.codehaus.mojo flatten-maven-plugin - 1.7.0 + 1.7.1 ossrh @@ -240,7 +240,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.7 + 3.2.8 sign-artifacts @@ -259,11 +259,17 @@ - + + + + + publish-sonatype-central-portal + + org.sonatype.central central-publishing-maven-plugin - 0.7.0 + 0.8.0 true sonatype-central-portal @@ -285,7 +291,7 @@ com.puppycrawl.tools checkstyle - 10.25.0 + 10.26.1 @@ -310,7 +316,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.26.0 + 3.27.0 true true @@ -322,12 +328,12 @@ net.sourceforge.pmd pmd-core - 7.14.0 + 7.15.0 net.sourceforge.pmd pmd-java - 7.14.0 + 7.15.0 diff --git a/selenium-elements/src/main/java/software/xdev/selenium/elements/remote/CustomizableRemoteWebElementInstaller.java b/selenium-elements/src/main/java/software/xdev/selenium/elements/remote/CustomizableRemoteWebElementInstaller.java index b502933..b147d30 100644 --- a/selenium-elements/src/main/java/software/xdev/selenium/elements/remote/CustomizableRemoteWebElementInstaller.java +++ b/selenium-elements/src/main/java/software/xdev/selenium/elements/remote/CustomizableRemoteWebElementInstaller.java @@ -51,8 +51,6 @@ public static void install( public static class CustomizableJsonToWebElementConverter extends JsonToWebElementConverter { - // Can be removed once https://github.com/SeleniumHQ/selenium/issues/15884 is fixed - private final Method mSetOwner; private final Supplier remoteWebElementSupplier; public CustomizableJsonToWebElementConverter( @@ -60,30 +58,13 @@ public CustomizableJsonToWebElementConverter( final Supplier remoteWebElementSupplier) { super(driver); - - try - { - this.mSetOwner = JsonToWebElementConverter.class.getDeclaredMethod("setOwner", RemoteWebElement.class); - this.mSetOwner.setAccessible(true); - } - catch(final NoSuchMethodException ex) - { - throw new IllegalStateException("Failed to find setOwner", ex); - } this.remoteWebElementSupplier = remoteWebElementSupplier; } @Override protected RemoteWebElement newRemoteWebElement() { - try - { - return (RemoteWebElement)this.mSetOwner.invoke(this, this.remoteWebElementSupplier.get()); - } - catch(final IllegalAccessException | InvocationTargetException e) - { - throw new IllegalStateException("Failed to call setOwner", e); - } + return this.setOwner(this.remoteWebElementSupplier.get()); } }