-
Notifications
You must be signed in to change notification settings - Fork 15
Implement native scroll actions +semver: feature #258
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
Conversation
mialeska
commented
Jul 22, 2024
- cover with tests
- replace js references with native actions in pre-existing methods
- add localization values for scrolling actions
- cover with tests - add localization values for scrolling actions
WalkthroughThe recent updates to the Aquality.Selenium framework enhance its scrolling capabilities, incorporating new methods for scrolling elements and windows using JavaScript. These additions improve user interaction by allowing more precise control over scrolling behaviors, complemented by enhanced logging and localization support across multiple languages. This update strengthens the framework's functionality and usability in web automation tasks. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Browser
participant JsActions
participant MouseActions
User->>Browser: ScrollWindowByViaJs(x, y)
Browser->>JsActions: Execute JavaScript Scroll
JsActions-->>Browser: Scroll Completed
Browser-->>User: Window Scrolled
sequenceDiagram
participant User
participant MouseActions
User->>MouseActions: ScrollToElement(element)
MouseActions-->>User: Element Scrolled Into 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 (
|
|
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (12)
- Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml (3 hunks)
- Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs (2 hunks)
- Aquality.Selenium/src/Aquality.Selenium/Elements/Actions/JsActions.cs (1 hunks)
- Aquality.Selenium/src/Aquality.Selenium/Elements/Actions/MouseActions.cs (2 hunks)
- Aquality.Selenium/src/Aquality.Selenium/Forms/Form.cs (1 hunks)
- Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/be.json (1 hunks)
- Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/en.json (1 hunks)
- Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/pl.json (1 hunks)
- Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/ru.json (1 hunks)
- Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/uk.json (1 hunks)
- Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Actions/MouseActionsTests.cs (1 hunks)
- Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/BrowserTests.cs (1 hunks)
Additional comments not posted (38)
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Actions/MouseActionsTests.cs (2)
46-61: LGTM!The test method
Should_BePossibleTo_ScrollToElementis well-structured and ensures that scrolling to an element works as expected without raising exceptions.
63-77: LGTM!The test method
Should_BePossibleTo_ScrollFromOriginis well-structured and ensures that scrolling from an origin point works as expected without raising exceptions.Aquality.Selenium/src/Aquality.Selenium/Forms/Form.cs (1)
93-98: LGTM!The method
ScrollByJsis well-structured and provides enhanced scrolling functionality using JavaScript.Aquality.Selenium/src/Aquality.Selenium/Elements/Actions/MouseActions.cs (2)
61-68: LGTM!The method
ScrollToElementis well-structured and ensures that scrolling to an element works as expected with robust retry mechanisms.
70-91: LGTM!The method
ScrollFromOriginis well-structured and ensures that scrolling from an origin point works as expected with robust retry mechanisms.Aquality.Selenium/src/Aquality.Selenium/Elements/Actions/JsActions.cs (1)
96-97: Enhanced logging inScrollBymethod.The logging now includes the
xandyparameters, which improves the detail of the log entries. This is useful for debugging and tracking user interactions more accurately.Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/en.json (4)
69-69: Updated localization string for scrolling via JavaScript.The string has been updated to "Scrolling to element via JavaScript," providing a clearer indication of the action being performed.
70-70: Added new localization string for scrolling to element.The new entry "Scrolling to element" enhances the clarity of the action being described.
71-71: Added new localization string for scrolling by coordinates.The new entry "Scrolling by ({0},{1})" provides a clear description of the action being performed with specific coordinates.
72-72: Added new localization string for scrolling by coordinates via JavaScript.The new entry "Scrolling by ({0},{1}) via JavaScript" specifies the scrolling action by coordinates via JavaScript, enhancing clarity.
Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/BrowserTests.cs (1)
203-217: New test methodShould_BePossibleTo_ScrollWindowBy_ViaJs.The new test method validates the functionality of scrolling a window using JavaScript in an infinite scroll form. It ensures that new examples are loaded as expected after the scroll. The implementation correctly opens the form, waits for the page to load, captures the initial count of example labels, performs the scroll action, and asserts the expected behavior.
Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/uk.json (4)
69-69: Update localization string for clarity.The updated string "Прокрутка до елемента за допомогою JavaScript" provides clearer context by specifying that the scrolling action is directed towards an element.
70-70: Add new localization string for element scrolling.The new string "Прокрутка до елемента" accurately describes scrolling to an element.
71-71: Add new localization string for coordinate scrolling.The new string "Прокрутка на ({0},{1})" specifies scrolling to specific coordinates, enhancing localization support.
72-72: Add new localization string for coordinate scrolling via JavaScript.The new string "Прокрутка на ({0},{1}) за допомогою JavaScript" indicates scrolling to specific coordinates using JavaScript, improving clarity.
Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/be.json (4)
69-69: Update localization string for clarity.The updated string "Пракручваем старонку да элемента праз JavaScript" provides clearer context by specifying that the scrolling action is directed towards an element.
70-70: Add new localization string for element scrolling.The new string "Пракручваем старонку да элемента" accurately describes scrolling to an element.
71-71: Add new localization string for coordinate scrolling.The new string "Пракручваем на ({0},{1})" specifies scrolling to specific coordinates, enhancing localization support.
72-72: Add new localization string for coordinate scrolling via JavaScript.The new string "Пракручваем на ({0},{1}) праз JavaScript" indicates scrolling to specific coordinates using JavaScript, improving clarity.
Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/ru.json (4)
69-69: Update localization string for clarity.The updated string "Скроллинг к элементу с помощью JavaScript" provides clearer context by specifying that the scrolling action is directed towards an element.
70-70: Add new localization string for element scrolling.The new string "Скроллинг к элементу" accurately describes scrolling to an element.
71-71: Add new localization string for coordinate scrolling.The new string "Скроллинг на ({0},{1})" specifies scrolling to specific coordinates, enhancing localization support.
72-72: Add new localization string for coordinate scrolling via JavaScript.The new string "Скроллинг на ({0},{1}) с помощью JavaScript" indicates scrolling to specific coordinates using JavaScript, improving clarity.
Aquality.Selenium/src/Aquality.Selenium/Resources/Localization/pl.json (4)
69-69: LGTM! Improved clarity in localization string.The updated string "Przewijanie do elementu przez JavaScript" is more descriptive.
70-70: LGTM! New localization string added.The new string "Przewijanie do elementu" provides a clear description.
71-71: LGTM! New localization string added.The new string "Przewijanie o ({0},{1})" provides a clear description for scrolling by specific coordinates.
72-72: LGTM! New localization string added.The new string "Przewijanie o ({0},{1}) przez JavaScript" provides a clear description for scrolling by specific coordinates using JavaScript.
Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs (6)
13-14: LGTM! Necessary imports added.The new import statements for
OpenQA.Selenium.InteractionsandWheelInputDeviceare necessary for the new scrolling functionalities.
324-326: LGTM! Logging added toScrollWindowBy.The added logging improves traceability of scrolling actions.
328-336: LGTM! New methodScrollWindowByViaJsadded.The new method performs scrolling using JavaScript and includes logging for traceability.
339-348: LGTM! New methodScrollFromOriginadded.The new method expands scrolling capabilities and uses the
Actionsclass for enhanced interaction.
333-336: Verify the usage ofExecuteScript.Ensure that the
ExecuteScriptmethod is correctly utilized in the new scrolling methods.Also applies to: 347-348
Verification successful
Verify the usage of
ExecuteScriptin theBrowser.csfile.Ensure that the
ExecuteScriptmethod is correctly utilized in the new scrolling methods.
Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs: ExecuteScript(JavaScript.ScrollWindowBy, x, y);Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `ExecuteScript` in the new scrolling methods. # Test: Search for the method usage. Expect: Correct utilization in the new methods. rg --type cs -A 5 $'ExecuteScript'Length of output: 41828
Line range hint
349-354:
Verify the usage ofExecuteScriptFromFile.Ensure that the
ExecuteScriptFromFilemethod is correctly utilized in the class.Verification successful
The method
ExecuteScriptFromFileis correctly utilized in theBrowserclass and is well-tested in various integration tests.
- Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs: Verified usage within the class.
- Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/BrowserTests.cs: Verified usage in integration tests.
- Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Actions/JsActionsTests.cs: Verified usage in integration tests.
- Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Usecases/FileDownloadingTests.cs: Verified usage in integration tests.
- Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/DevToolsEmulationTests.cs: Verified usage in integration tests.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `ExecuteScriptFromFile` in the class. # Test: Search for the method usage. Expect: Correct utilization in the class. rg --type cs -A 5 $'ExecuteScriptFromFile'Length of output: 8318
Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml (5)
233-239: Documentation forScrollWindowByViaJsis correct.The documentation for the
ScrollWindowByViaJsmethod is accurate and complete.
240-247: Documentation forScrollFromOriginis correct.The documentation for the
ScrollFromOriginmethod is accurate and complete.
1470-1474: Documentation forScrollToElementis correct.The documentation for the
ScrollToElementmethod is accurate and complete.
1475-1479: Documentation forScrollFromOriginis correct.The documentation for the
ScrollFromOriginmethod is accurate and complete.
2452-2458: Documentation forScrollByJsis correct.The documentation for the
ScrollByJsmethod is accurate and complete.


