[dotnet] [bidi] Align SetGeolocation polymorphic command#17338
[dotnet] [bidi] Align SetGeolocation polymorphic command#17338nvborisenko merged 1 commit intoSeleniumHQ:trunkfrom
Conversation
Review Summary by QodoUnify geolocation override API with polymorphic command pattern
WalkthroughsDescription• Consolidate three geolocation override methods into single polymorphic method • Introduce abstract GeolocationOverride type with two sealed implementations • Move coordinate parameters from options to override record properties • Update tests to use new unified API with polymorphic types File Changes1. dotnet/src/webdriver/BiDi/Emulation/EmulationModule.cs
|
Code Review by Qodo
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the .NET BiDi Emulation geolocation override API to use a single polymorphic command (SetGeolocationOverrideAsync) that accepts a new GeolocationOverride type, consolidating coordinate and error overrides into one entry point.
Changes:
- Replaced multiple geolocation override methods with a single
SetGeolocationOverrideAsync(GeolocationOverride? ...)API. - Added a new public
GeolocationOverridehierarchy (GeolocationCoordinatesOverride,GeolocationPositionErrorOverride) and consolidated options intoSetGeolocationOverrideOptions. - Updated BiDi emulation tests to use the unified API.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dotnet/test/webdriver/BiDi/Emulation/EmulationTests.cs | Updates tests to call the unified geolocation override API for coordinates, default reset, and error override. |
| dotnet/src/webdriver/BiDi/Emulation/SetGeolocationOverride.cs | Introduces the new GeolocationOverride type hierarchy and removes legacy option types while consolidating options. |
| dotnet/src/webdriver/BiDi/Emulation/IEmulationModule.cs | Updates the public interface to expose only the unified geolocation override method. |
| dotnet/src/webdriver/BiDi/Emulation/EmulationModule.cs | Implements SetGeolocationOverrideAsync and removes the prior dedicated geolocation override methods. |
One more polymorphic command.
💥 What does this PR do?
This pull request refactors and simplifies the geolocation override API in the BiDi Emulation module. The main change is to unify the various geolocation override methods into a single method that accepts a new, more flexible type, making the API easier to use and extend. Related test cases and type definitions have also been updated accordingly.
API Unification and Simplification:
SetGeolocationCoordinatesOverrideAsync,SetGeolocationPositionErrorOverrideAsync) with a single methodSetGeolocationOverrideAsyncthat accepts a newGeolocationOverrideparameter, supporting both coordinate and error overrides in one place. ([[1]](https://github.com/SeleniumHQ/selenium/pull/17338/files#diff-326495cc635fdb9686d337228f031a251b2aaed55960d7096b1345e0f1c267ffL108-L123),[[2]](https://github.com/SeleniumHQ/selenium/pull/17338/files#diff-67b1e6d29a1577b79f92d4a3eece9a990768c05d60f023bd9a4c00e913e926a5L25-R25))New Type Hierarchy for Geolocation Override:
GeolocationOverridewith two implementations:GeolocationCoordinatesOverride(for specifying coordinates and related parameters) andGeolocationPositionErrorOverride(for simulating a position error). ([dotnet/src/webdriver/BiDi/Emulation/SetGeolocationOverride.csR24-R36](https://github.com/SeleniumHQ/selenium/pull/17338/files#diff-c98b85709ff9dfdf68799a0b5e3ebb35e890deef4e56db26562a9c71d07eabcfR24-R36))Type and Options Cleanup:
SetGeolocationCoordinatesOverrideOptions,SetGeolocationPositionErrorOverrideOptions) and consolidated configuration into a singleSetGeolocationOverrideOptionstype. ([dotnet/src/webdriver/BiDi/Emulation/SetGeolocationOverride.csL40-L57](https://github.com/SeleniumHQ/selenium/pull/17338/files#diff-c98b85709ff9dfdf68799a0b5e3ebb35e890deef4e56db26562a9c71d07eabcfL40-L57))Test Updates:
SetGeolocationOverrideAsyncmethod and types, ensuring coverage for both coordinate and error override scenarios. ([[1]](https://github.com/SeleniumHQ/selenium/pull/17338/files#diff-ffc3db78f3491d8fdaa73663a8ab27170b6f892406b5e40a27a023ff40742fccL201-R201),[[2]](https://github.com/SeleniumHQ/selenium/pull/17338/files#diff-ffc3db78f3491d8fdaa73663a8ab27170b6f892406b5e40a27a023ff40742fccL211-R211),[[3]](https://github.com/SeleniumHQ/selenium/pull/17338/files#diff-ffc3db78f3491d8fdaa73663a8ab27170b6f892406b5e40a27a023ff40742fccL222-R222))🔄 Types of changes