-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement native scroll actions and use Selenium 4.23.0 #142
Conversation
mialeska
commented
Jul 23, 2024
- cover with tests
- replace js references with native actions in pre-existing methods
- add localization values for scrolling actions
- refactor MouseActions
- Update to Selenium 4.23.0
- cover with tests - replace js references with native actions in pre-existing methods - add localization values for scrolling actions - refactor MouseActions - Update to Selenium 4.23.0
WalkthroughThe recent updates introduce enhancements primarily to scrolling functionalities within the Aquality Selenium framework. New methods for scrolling via JavaScript and mouse actions have been added, alongside improved logging for tracking actions. The localization files have been updated to provide clearer descriptions in multiple languages. Additionally, tests have been expanded to cover new scrolling functionalities, ensuring robust validation of user interactions with dynamically loaded content. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Browser
participant Page
User->>Browser: Initiates scroll action
Browser->>Page: scrollWindowBy(int x, int y)
Page-->>Browser: Scrolls viewport
Browser->>User: Displays updated content
User->>Browser: Initiates scroll via JS
Browser->>Page: scrollByJs(int x, int y)
Page-->>Browser: Scrolls specific element
Browser->>User: Displays element in view
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Quality Gate passedIssues Measures |
There was a problem hiding this 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
Outside diff range, codebase verification and nitpick comments (1)
src/test/java/tests/usecases/devtools/DeviceEmulationTest.java (1)
6-7
: Update import statements to use the latest Selenium DevTools version.The following files still reference the older Selenium DevTools version (v85). Please update the import statements in these files to use the latest version (v127):
src/main/java/aquality/selenium/browser/devtools/JavaScriptHandling.java
src/main/java/aquality/selenium/browser/devtools/NetworkHandling.java
src/main/java/aquality/selenium/browser/devtools/EmulationHandling.java
src/main/java/aquality/selenium/browser/devtools/DevToolsHandling.java
Ensure that the code is adjusted to accommodate any API changes between versions.
Analysis chain
Update import statements to use the latest Selenium DevTools version.
The import statements have been updated to use
Emulation
andDisplayFeature
from version 127 of the Selenium DevTools. Ensure that these versions are compatible with the rest of the code.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new versions of Emulation and DisplayFeature are compatible with the existing code. # Test: Search for the usage of Emulation and DisplayFeature in the codebase. Expect: Only occurances of the new versions. rg --type java -A 5 $'Emulation' rg --type java -A 5 $'DisplayFeature'Length of output: 27588
Script:
#!/bin/bash # Description: Search for all occurrences of the older Selenium DevTools version (v85) in the codebase. rg --type java 'org.openqa.selenium.devtools.v85'Length of output: 1922
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (15)
- pom.xml (1 hunks)
- src/main/java/aquality/selenium/browser/Browser.java (2 hunks)
- src/main/java/aquality/selenium/elements/actions/JsActions.java (1 hunks)
- src/main/java/aquality/selenium/elements/actions/MouseActions.java (1 hunks)
- src/main/java/aquality/selenium/forms/Form.java (1 hunks)
- src/main/resources/localization/be.json (1 hunks)
- src/main/resources/localization/en.json (1 hunks)
- src/main/resources/localization/pl.json (1 hunks)
- src/main/resources/localization/ru.json (1 hunks)
- src/main/resources/localization/uk.json (1 hunks)
- src/test/java/tests/integration/ActionTests.java (3 hunks)
- src/test/java/tests/integration/BrowserTests.java (1 hunks)
- src/test/java/tests/usecases/devtools/DeviceEmulationTest.java (1 hunks)
- src/test/java/tests/usecases/devtools/NetworkSpeedEmulationTest.java (1 hunks)
- src/test/java/tests/usecases/devtools/OverrideUserAgentTest.java (1 hunks)
Files skipped from review due to trivial changes (2)
- pom.xml
- src/test/java/tests/usecases/devtools/OverrideUserAgentTest.java
Additional comments not posted (41)
src/test/java/tests/usecases/devtools/NetworkSpeedEmulationTest.java (1)
5-5
: Update import statement to use the latest Selenium DevTools version.The import statement has been updated to use
ConnectionType
from version 127 of the Selenium DevTools network model. Ensure that this version is compatible with the rest of the code.src/main/java/aquality/selenium/forms/Form.java (1)
83-85
: New methodscrollByJs
added.The new method
scrollByJs
provides an alternative way to scroll the form using JavaScript. Ensure that this method is implemented correctly and does not introduce any issues.src/main/java/aquality/selenium/elements/actions/MouseActions.java (10)
4-11
: Imports look good.The new imports for
ILocalizedLogger
,IElementActionRetrier
, andScrollOrigin
are appropriate for the added functionalities.
19-27
: Constructor changes are appropriate.The initialization of
logger
andelementActionRetrier
is necessary for the new functionalities.
34-36
: Improved logging and action handling inclick
method.The use of
logElementAction
andperformActionAfterMove
enhances logging and ensures proper action handling.
43-45
: Improved logging and action handling inrightClick
method.The use of
logElementAction
andperformActionAfterMove
enhances logging and ensures proper action handling.
50-53
: NewscrollToElement
method looks good.The method provides scrolling functionality with proper logging and action handling.
61-79
: NewscrollFromOrigin
methods look good.The methods provide scrolling functionalities by coordinates with and without offsets, along with proper logging and action handling.
86-87
: Improved logging and action handling inmoveMouseToElement
method.The use of
logElementAction
andperformActionAfterMove
enhances logging and ensures proper action handling.
94-95
: Improved logging and action handling inmoveMouseFromElement
method.The use of
logElementAction
andperformAction
enhances logging and ensures proper action handling.
102-104
: Improved logging and action handling indoubleClick
method.The use of
logElementAction
andperformActionAfterMove
enhances logging and ensures proper action handling.
106-121
: Improved action handling and logging methods.The updates to
performActionAfterMove
andperformAction
methods, along with the newlogElementAction
method, enhance action handling flexibility and logging.src/main/java/aquality/selenium/elements/actions/JsActions.java (1)
95-95
: Enhanced logging inscrollBy
method.The additional logging of parameters
x
andy
improves traceability and debugging.src/test/java/tests/integration/ActionTests.java (3)
26-26
: Simplified browser window maximization inbeforeMethod
.The refactoring simplifies the code and improves readability.
45-60
: Comprehensive test coverage intestScrollToElement
method.The method provides thorough testing of the new scrolling functionality, ensuring its reliability.
63-73
: Comprehensive test coverage intestScrollFromOrigin
method.The method provides thorough testing of the new scrolling functionality, ensuring its reliability.
src/test/java/tests/integration/BrowserTests.java (1)
191-199
: LGTM! The new test method is well-structured.The test method
testShouldBePossibleToScrollWindowByViaJavaScript
is well-structured and effectively verifies the scrolling functionality using JavaScript.src/main/resources/localization/en.json (4)
73-73
: Approved: Updated localization string improves clarity.The updated string "Scrolling to element via JavaScript" provides better clarity by specifying the scrolling action.
74-74
: Approved: New localization string added.The new string "Scrolling to element" provides a general description of the scrolling action.
75-75
: Approved: New localization string added.The new string "Scrolling by (%s,%s)" provides a detailed description of the scrolling action with coordinates.
76-76
: Approved: New localization string added.The new string "Scrolling by (%s,%s) via JavaScript" provides a detailed description of the scrolling action with coordinates in the context of JavaScript.
src/main/resources/localization/be.json (4)
73-73
: Approved: Updated localization string improves clarity.The updated string "Пракручваем старонку да элемента праз JavaScript" provides better clarity by specifying the scrolling action.
74-74
: Approved: New localization string added.The new string "Пракручваем старонку да элемента" provides a general description of the scrolling action.
75-75
: Approved: New localization string added.The new string "Пракручваем на (%s,%s)" provides a detailed description of the scrolling action with coordinates.
76-76
: Approved: New localization string added.The new string "Пракручваем на (%s,%s) праз JavaScript" provides a detailed description of the scrolling action with coordinates in the context of JavaScript.
src/main/resources/localization/uk.json (4)
73-73
: Approved: Improved clarity for scrolling action.The updated string
"Прокрутка до елемента за допомогою JavaScript"
enhances clarity by specifying that the scrolling action is directed towards a specific element.
74-74
: Approved: Added clear description for scrolling action.The new entry
"Прокрутка до елемента"
provides a clear description for the scrolling action.
75-75
: Approved: Added description for scrolling to coordinates.The new entry
"Прокрутка на (%s,%s)"
specifies scrolling to specific coordinates, enhancing clarity.
76-76
: Approved: Added description for JavaScript scrolling to coordinates.The new entry
"Прокрутка на (%s,%s) за допомогою JavaScript"
provides a clear description for scrolling to specific coordinates using JavaScript.src/main/resources/localization/ru.json (4)
73-73
: Approved: Improved clarity for scrolling action.The updated string
"Скроллинг к элементу (посредством JavaScript)"
enhances clarity by specifying that the scrolling action is directed towards a specific element.
74-74
: Approved: Added clear description for scrolling action.The new entry
"Скроллинг к элементу"
provides a clear description for the scrolling action.
75-75
: Approved: Added description for scrolling to coordinates.The new entry
"Скроллинг на (%s,%s)"
specifies scrolling to specific coordinates, enhancing clarity.
76-76
: Approved: Added description for JavaScript scrolling to coordinates.The new entry
"Скроллинг на (%s,%s) посредством JavaScript"
provides a clear description for scrolling to specific coordinates using JavaScript.src/main/resources/localization/pl.json (4)
73-73
: Approved: Improved clarity for scrolling action.The updated string
"Przewijanie do elementu przez JavaScript"
enhances clarity by specifying that the scrolling action is directed towards a specific element.
74-74
: Approved: Added clear description for scrolling action.The new entry
"Przewijanie do elementu"
provides a clear description for the scrolling action.
75-75
: Approved: Added description for scrolling to coordinates.The new entry
"Przewijanie o (%s,%s)"
specifies scrolling to specific coordinates, enhancing clarity.
76-76
: Approved: Added description for JavaScript scrolling to coordinates.The new entry
"Przewijanie o (%s,%s) przez JavaScript"
provides a clear description for scrolling to specific coordinates using JavaScript.src/main/java/aquality/selenium/browser/Browser.java (4)
15-16
: Imports approved.The new imports for
Actions
andScrollOrigin
are necessary for the new scrolling functionalities.
357-359
: MethodscrollWindowBy
approved.The method correctly logs the action and performs scrolling using Selenium
Actions
.
367-370
: MethodscrollWindowByViaJs
approved.The method correctly logs the action and performs scrolling using JavaScript.
379-381
: MethodscrollFromOrigin
approved.The method correctly performs scrolling from a specified origin using Selenium
Actions
.