Open cbiesinger opened 1 month ago
β±οΈ Estimated effort to review [1-5] | 2, because the changes are straightforward and localized to specific files, involving simple updates to method calls and JSON configurations. The logic is not complex, and the changes are well-described in the PR description. |
π§ͺ Relevant tests | Yes |
β‘ Possible issues | Possible Redundancy: The JSON file `fedcm.json` now contains both "signin_url" and "login_url" with the same endpoint "/signin". If these fields are meant to serve the same purpose, one of them might be redundant unless required for backward compatibility. |
π Security concerns | No |
Category | Suggestion | Score |
Maintainability |
Remove redundant
___
**The | 8 |
Define endpoint paths as constants to improve maintainability and reduce the risk of typos___ **To improve maintainability and avoid potential issues with hardcoded strings, considerdefining the endpoint paths as constants. This will make the code easier to update and reduce the risk of typos.** [java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java [200-208]](https://github.com/SeleniumHQ/selenium/pull/14070/files#diff-640f7348338f49b2894694516ec1682936ca87803d7602531a56de5b537d7745R200-R208) ```diff -String fedcm = sessionId + "/fedcm"; +final String FEDCM_BASE_PATH = "/fedcm"; +String fedcm = sessionId + FEDCM_BASE_PATH; defineCommand(CANCEL_DIALOG, post(fedcm + "/canceldialog")); defineCommand(SELECT_ACCOUNT, post(fedcm + "/selectaccount")); defineCommand(CLICK_DIALOG, post(fedcm + "/clickdialogbutton")); defineCommand(GET_ACCOUNTS, get(fedcm + "/accountlist")); defineCommand(GET_FEDCM_TITLE, get(fedcm + "/gettitle")); defineCommand(GET_FEDCM_DIALOG_TYPE, get(fedcm + "/getdialogtype")); defineCommand(SET_DELAY_ENABLED, post(fedcm + "/setdelayenabled")); defineCommand(RESET_COOLDOWN, post(fedcm + "/resetcooldown")); ``` Suggestion importance[1-10]: 7Why: Using constants for endpoint paths enhances maintainability and reduces typo errors, which is a good practice, especially in a large codebase. | 7 | |
Enhancement |
Add assertions to verify the dialog is dismissed to make the test more robust___ **Consider adding assertions to verify that the dialog is indeed dismissed after callingfedcmDriver.setDelayEnabled(false) . This will make the test more robust and ensure the expected behavior.** [java/test/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementTest.java [83-85]](https://github.com/SeleniumHQ/selenium/pull/14070/files#diff-2e0a0d71dc441c4816d5588bbd502c512fed777c28cc8f5d389284e679671d07R83-R85) ```diff void testDismissDialog() { fedcmDriver.setDelayEnabled(false); assertNull(fedcmDriver.getFederatedCredentialManagementDialog()); + // Additional assertions to verify dialog dismissal + assertFalse(fedcmDriver.isDialogVisible()); + assertEquals("Expected message", fedcmDriver.getDialogMessage()); ``` Suggestion importance[1-10]: 6Why: Adding more assertions would indeed make the test more robust by verifying additional expected behaviors, although the existing test already checks the main functionality. | 6 |
Add assertions to verify account selection behavior to make the test more robust___ **Similar to thetestDismissDialog method, add assertions in the testSelectAccount method to verify the dialog state and account selection behavior.** [java/test/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementTest.java [115-117]](https://github.com/SeleniumHQ/selenium/pull/14070/files#diff-2e0a0d71dc441c4816d5588bbd502c512fed777c28cc8f5d389284e679671d07R115-R117) ```diff void testSelectAccount() { fedcmDriver.setDelayEnabled(false); assertNull(fedcmDriver.getFederatedCredentialManagementDialog()); + // Additional assertions to verify account selection + assertTrue(fedcmDriver.isAccountSelected()); + assertEquals("Expected account", fedcmDriver.getSelectedAccount()); ``` Suggestion importance[1-10]: 6Why: Similar to the previous suggestion, adding assertions enhances the test's robustness by checking more conditions, which is beneficial for ensuring the correct behavior of the system. | 6 |
@titusfortner while I couldn't follow your comment (if they fail on Windows shouldn't they be in the skipped tests file?), I have pushed an update that removes the test from there
RBE runs on Linux, so I want to see if they pass. As for the Windows failures, if these are the affected tests it's an issue of a bazel failure not a JUnit failure. Let's see what the test results show.
User description
Thanks for contributing to Selenium! A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines. Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
In commit 7ad44ee the session ID prefix was removed from the FedCM commands. This change restores it.
This lets us re-enable the FedCM tests, which this change does as well.
Motivation and Context
This test failure was pointed out here: https://github.com/SeleniumHQ/selenium/pull/12096#issuecomment-2017760822
Types of changes
Checklist
PR Type
Bug fix, Tests
Description
AbstractHttpCommandCodec.java
.@NotYetImplemented
annotation inFederatedCredentialManagementTest.java
.login_url
field infedcm.json
.Changes walkthrough π
AbstractHttpCommandCodec.java
Restore session ID prefix in FedCM command definitions.
java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java
fedcm.json
Update FedCM configuration to include `login_url`.
common/src/web/fedcm/fedcm.json - Added `login_url` field to FedCM configuration.
FederatedCredentialManagementTest.java
Re-enable FedCM tests by removing `@NotYetImplemented` annotation.
java/test/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementTest.java
@NotYetImplemented
annotation from FedCM tests.testDismissDialog
andtestSelectAccount
tests.