Skip to content

Conversation

@mialeska
Copy link
Contributor

@mialeska mialeska commented Oct 13, 2025

fixes #274

@mialeska mialeska self-assigned this Oct 13, 2025
@mialeska mialeska added enhancement New feature or request dotnet labels Oct 13, 2025
@github-project-automation github-project-automation bot moved this to In progress in Aquality Selenium Oct 13, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 13, 2025

Walkthrough

Bumps Aquality.Selenium.Core to 4.1.0, updates Selenium DevTools references from V138 → V140 (usings and XML docs), replaces versioned DevTools types in tests with non-versioned types, updates test SDK/adapters, relaxes some assertions and wait usage, and guards a cookie-consent click by visibility.

Changes

Cohort / File(s) Summary
Core dependency bump
Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.csproj
Update PackageReference: Aquality.Selenium.Core 3.5.0 → 4.1.0.
DevTools protocol V138 → V140
Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs, Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsPerformanceExtensions.cs, Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml
Replace V138 usings/namespaces with V140 (Emulation, DOM, Performance). XML docs updated to reference DevTools v140 settings. No behavior changes.
Tests: use non-versioned DevTools types
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/DevToolsEmulationTests.cs
Replace versioned DevTools types (V138.*) with public non-versioned types (SetDeviceMetricsOverrideCommandSettings, DisplayFeature, enums).
Tests: SDK/tooling bump
Aquality.Selenium/tests/Aquality.Selenium.Tests/Aquality.Selenium.Tests.csproj
Update NUnit3TestAdapter 5.1.0 → 5.2.0; Microsoft.NET.Test.Sdk 17.14.1 → 18.0.0.
Tests: small behavior tweaks
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/ImageLocatorTests.cs, Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Usecases/CustomBrowserFactoryTests.cs, Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/TestApp/MyLocation/LocationForm.cs
Add ImageTag const and refactor image assertions; switch WaitForTrueWaitFor; relax URL asserts to Does.StartWith; guard cookie-consent click with Displayed check before clicking and waiting for not displayed.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Test
  participant LocationForm
  participant ConsentBtn as consentCookieInfoButton
  participant GotIt as gotItCookieButton
  participant CloseBtn as closeCookieSettingsButton

  Test->>LocationForm: DismissCookieInfo()
  rect rgba(200,230,255,0.25)
    LocationForm->>ConsentBtn: IsDisplayed?
    alt displayed
      LocationForm->>ConsentBtn: Click
      LocationForm->>ConsentBtn: Wait until not displayed
    else not displayed
      LocationForm-->>LocationForm: Skip click/wait
    end
  end
  LocationForm->>GotIt: Click if present
  LocationForm->>CloseBtn: Click if present
  LocationForm-->>Test: Return
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

feature

Suggested reviewers

  • DmitryBogatko

Poem

A rabbit hops on code so bright,
I nudge DevTools to a fresher light.
Tests now wait and URLs start right,
I peek, I click, then skip if slight.
Version bumped — a joyful bite. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (4 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The pull request title asserts an update to Selenium v4.36.0 and a migration from Newtonsoft.Json to System.Text.Json, but the actual changes only bump DevTools protocol versions, update dependencies to Aquality.Selenium.Core v4.1.0, and adjust tests without any JSON library migration or Selenium core reading logic modifications. Please revise the title to accurately summarize the primary changes, such as updating DevTools protocol references to V140, bumping project dependencies, and adapting integration tests.
Linked Issues Check ⚠️ Warning The linked issue demands a fix for JSON file reading by migrating to System.Text.Json, but none of the code changes address JSON parsing or reading logic in Aquality.Selenium.Core. Implement the necessary JSON handling updates to restore file reading functionality or adjust the PR scope to reflect currently applied changes.
Out of Scope Changes Check ⚠️ Warning Most modifications focus on DevTools protocol version bumps, test adjustments for emulation and performance extensions, image locator tests, and browser behavior which are unrelated to the JSON reading objective from issue #274. Separate unrelated DevTools and test refactoring changes into their own pull request and limit this PR to the JSON migration and related core fixes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed The pull request description references the issue it fixes (issue #274), which is directly related to the changes in this PR and therefore is on-topic even though it is brief.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-selenium-to-4.36.0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mialeska mialeska marked this pull request as ready for review October 13, 2025 14:22
@mialeska
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 13, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Usecases/CustomBrowserFactoryTests.cs (1)

27-27: Clarify and tighten the URL assertion
Does.StartWith("https://www.google.com/") accommodates Google’s redirects and query parameters but is less precise. Add a brief comment explaining this choice and consider asserting new Uri(AqualityServices.Browser.CurrentUrl).Host == "www.google.com" to confirm the correct domain.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c45cc40 and f3bd2fa.

📒 Files selected for processing (9)
  • Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.csproj (1 hunks)
  • Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml (4 hunks)
  • Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs (1 hunks)
  • Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsPerformanceExtensions.cs (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Aquality.Selenium.Tests.csproj (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/DevToolsEmulationTests.cs (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/ImageLocatorTests.cs (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/TestApp/MyLocation/LocationForm.cs (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Usecases/CustomBrowserFactoryTests.cs (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: mialeska
PR: aquality-automation/aquality-selenium-dotnet#270
File: Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs:3-4
Timestamp: 2025-05-28T19:52:19.309Z
Learning: DevTools V137 namespaces (OpenQA.Selenium.DevTools.V137.DOM and OpenQA.Selenium.DevTools.V137.Emulation) are available and working in Selenium WebDriver 4.33.0 for .NET projects.
📚 Learning: 2025-05-28T19:52:19.309Z
Learnt from: mialeska
PR: aquality-automation/aquality-selenium-dotnet#270
File: Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs:3-4
Timestamp: 2025-05-28T19:52:19.309Z
Learning: DevTools V137 namespaces (OpenQA.Selenium.DevTools.V137.DOM and OpenQA.Selenium.DevTools.V137.Emulation) are available and working in Selenium WebDriver 4.33.0 for .NET projects.

Applied to files:

  • Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml
  • Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsPerformanceExtensions.cs
  • Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs
📚 Learning: 2024-10-09T11:11:38.254Z
Learnt from: mialeska
PR: aquality-automation/aquality-selenium-dotnet#264
File: Aquality.Selenium/src/Aquality.Selenium.Images/Aquality.Selenium.Images.csproj:41-48
Timestamp: 2024-10-09T11:11:38.254Z
Learning: In `Aquality.Selenium.Images.csproj`, different versions of `OpenCvSharp4` package references are acceptable because the packages are compatible.

Applied to files:

  • Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.csproj
🧬 Code graph analysis (2)
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/ImageLocatorTests.cs (1)
Aquality.Selenium/src/Aquality.Selenium/Browsers/AqualityServices.cs (1)
  • AqualityServices (16-121)
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Usecases/CustomBrowserFactoryTests.cs (1)
Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs (2)
  • Browser (21-478)
  • Browser (36-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: aquality-automation.aquality-selenium-dotnet (test Analyze code with SonarQube)
  • GitHub Check: aquality-automation.aquality-selenium-dotnet (test Run tests)
🔇 Additional comments (9)
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/ImageLocatorTests.cs (1)

33-37: LGTM!

The refactoring from WaitForTrue to WaitFor with a direct predicate is correct and simplifies the code.

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/TestApp/MyLocation/LocationForm.cs (1)

26-30: LGTM!

Adding the WaitForDisplayed guard before clicking the consent cookie button improves test robustness by handling cases where the button may not appear on all pages.

Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsPerformanceExtensions.cs (1)

1-1: LGTM!

The DevTools namespace update from V138 to V140 is consistent with the broader DevTools API migration in this PR.

Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml (4)

481-481: LGTM!

XML documentation reference updated from V138 to V140 to match the code changes in DevToolsEmulationExtensions.cs.


511-511: LGTM!

XML documentation reference updated from V138 to V140 to match the code changes in DevToolsEmulationExtensions.cs.


547-547: LGTM!

XML documentation reference updated from V138 to V140 to match the code changes in DevToolsEmulationExtensions.cs.


566-566: LGTM!

XML documentation reference updated from V138 to V140 to match the code changes in DevToolsEmulationExtensions.cs.

Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.csproj (1)

94-94: Confirm Core 4.1.0 JSON migration and issue #274 fix
No direct Newtonsoft.Json references found; please verify that Aquality.Selenium.Core 4.1.0 fully migrated to System.Text.Json and resolves the JSON reading issues from issue #274 without introducing breaking changes.

Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs (1)

3-4: Verify DevTools V140 support. Ensure Selenium.WebDriver 4.36.0 includes OpenQA.Selenium.DevTools.V140.DOM and .Emulation namespaces; update or revert DevTools version as needed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/ImageLocatorTests.cs (1)

33-37: Update remaining WaitForTrue calls to WaitFor
All occurrences in tests (e.g., AqualityServicesTests, MouseActionsTests, JavaScriptHandlingTests, FileDownloadingTests, BrowserTests, JsActionsTests, SliderForm) and in src/Aquality.Selenium/Browsers/Browser.cs:312 must be replaced with the new WaitFor API.

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/DevToolsEmulationTests.cs (1)

8-8: Align DevTools namespace in tests
Replace using OpenQA.Selenium.DevTools.V139.Emulation; with using OpenQA.Selenium.DevTools.V140.Emulation; in DevToolsEmulationTests.cs to match the updated extension methods and ensure all command-settings types resolve to V140.

🧹 Nitpick comments (1)
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/TestApp/MyLocation/LocationForm.cs (1)

26-30: Good defensive pattern, but consider consistency.

The visibility check before clicking improves test stability by only attempting to click when the button appears. This aligns with the gotItCookieButton handling at lines 31-35.

However, note that closeCookieSettingsButton at lines 36-39 uses IsDisplayed (immediate check) rather than WaitForDisplayed() (polling). Consider whether all three cookie buttons should follow the same pattern for consistency, or if the different approaches are intentional based on the specific button behaviors.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c45cc40 and f3bd2fa.

📒 Files selected for processing (9)
  • Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.csproj (1 hunks)
  • Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml (4 hunks)
  • Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs (1 hunks)
  • Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsPerformanceExtensions.cs (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Aquality.Selenium.Tests.csproj (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/DevToolsEmulationTests.cs (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/ImageLocatorTests.cs (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/TestApp/MyLocation/LocationForm.cs (1 hunks)
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Usecases/CustomBrowserFactoryTests.cs (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: mialeska
PR: aquality-automation/aquality-selenium-dotnet#270
File: Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs:3-4
Timestamp: 2025-05-28T19:52:19.309Z
Learning: DevTools V137 namespaces (OpenQA.Selenium.DevTools.V137.DOM and OpenQA.Selenium.DevTools.V137.Emulation) are available and working in Selenium WebDriver 4.33.0 for .NET projects.
📚 Learning: 2024-10-09T11:11:38.254Z
Learnt from: mialeska
PR: aquality-automation/aquality-selenium-dotnet#264
File: Aquality.Selenium/src/Aquality.Selenium.Images/Aquality.Selenium.Images.csproj:41-48
Timestamp: 2024-10-09T11:11:38.254Z
Learning: In `Aquality.Selenium.Images.csproj`, different versions of `OpenCvSharp4` package references are acceptable because the packages are compatible.

Applied to files:

  • Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.csproj
📚 Learning: 2025-05-28T19:52:19.309Z
Learnt from: mialeska
PR: aquality-automation/aquality-selenium-dotnet#270
File: Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs:3-4
Timestamp: 2025-05-28T19:52:19.309Z
Learning: DevTools V137 namespaces (OpenQA.Selenium.DevTools.V137.DOM and OpenQA.Selenium.DevTools.V137.Emulation) are available and working in Selenium WebDriver 4.33.0 for .NET projects.

Applied to files:

  • Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml
  • Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/DevToolsEmulationTests.cs
  • Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsPerformanceExtensions.cs
  • Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: aquality-automation.aquality-selenium-dotnet (test Analyze code with SonarQube)
  • GitHub Check: aquality-automation.aquality-selenium-dotnet (test Run tests)
🔇 Additional comments (8)
Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs (1)

3-4: LGTM! DevTools protocol updated to V140.

The namespace update to V140 correctly aligns with the Selenium 4.36.0 upgrade mentioned in the PR title. This is a standard version bump that maintains compatibility with the latest DevTools protocol.

Based on learnings: DevTools V137 namespaces were available in Selenium 4.33.0, so V140 for Selenium 4.36.0 is consistent with the progression.

Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsPerformanceExtensions.cs (1)

1-1: LGTM! DevTools protocol updated to V140.

The namespace update to V140 is consistent with the upgrade to Selenium 4.36.0 and matches the DevTools protocol version used in DevToolsEmulationExtensions.cs.

Aquality.Selenium/tests/Aquality.Selenium.Tests/Aquality.Selenium.Tests.csproj (2)

33-33: LGTM! Minor version update.

The NUnit3TestAdapter update from 5.1.0 to 5.2.0 is a minor version bump that should be compatible.


37-37: Verify test execution with Microsoft.NET.Test.Sdk 18.0.0.

The update from 17.14.1 to 18.0.0 is a major version bump of the Test SDK, which could introduce breaking changes or behavioral differences in test discovery and execution.

Ensure that all tests run successfully with the new Test SDK version. If pipeline tests have passed, this verification is complete.

Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.csproj (1)

94-94: Remove JSON deserialization verification suggestion. This project doesn’t deserialize any JSON configuration or data files—JSON is only used internally for CDP command formatting via System.Text.Json. No further verification required.

Likely an incorrect or invalid review comment.

Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml (1)

481-481: LGTM! Documentation updated to reflect DevTools V140.

The XML documentation references have been correctly updated from V138 to V140, aligning with the DevTools namespace version upgrade.

Also applies to: 511-511, 547-547, 566-566

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/DevToolsEmulationTests.cs (1)

62-67: Migration to non-versioned types looks correct, but verify completeness.

The migration from versioned (OpenQA.Selenium.DevTools.V138.Emulation.*) to non-versioned public types is a good practice that will reduce maintenance burden. However, as noted in the comment on line 8, this migration appears incomplete:

  • Lines 62-67, 186: Successfully using non-versioned types
  • Lines 111, 119: Still using versioned types from V139 namespace

Consider whether SetGeolocationOverrideCommandSettings and ClearGeolocationOverrideCommandSettings should also be migrated to non-versioned types for consistency.

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Usecases/CustomBrowserFactoryTests.cs (1)

27-27: Clarify necessity of prefix URL assertion
Changing from exact match (Is.EqualTo(url)) to prefix match (Does.StartWith(url)) on CurrentUrl may hide unexpected query parameters, fragments, or redirects. Confirm if this relaxation is required due to Selenium 4.36.0 or environment-specific trailing-slash behavior; if not, consider trimming trailing slashes or retaining strict equality for full-URL validation.

@sonarqubecloud
Copy link

@mialeska mialeska merged commit 8ffb74f into master Oct 14, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Aquality Selenium Oct 14, 2025
@mialeska mialeska deleted the update-selenium-to-4.36.0 branch October 14, 2025 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dotnet enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

⚠️ JSON File Elements Not Readable After Updating to Aquality.Selenium.Core v4.1.0

2 participants