Skip to content
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

Remove AccountPasswordPage from testsuite #15204

Merged
merged 1 commit into from Nov 2, 2022

Conversation

stianst
Copy link
Contributor

@stianst stianst commented Oct 28, 2022

Closes #15200

@stianst
Copy link
Contributor Author

stianst commented Oct 28, 2022

Depends on #15197 to be merged first, will rebase after that is done.

@stianst stianst force-pushed the remove-account-password-page branch 2 times, most recently from c96ce10 to 8476de8 Compare October 28, 2022 10:27
@stianst stianst changed the title remove account password page Remove AccountPasswordPage from testsuite Oct 28, 2022
@stianst stianst marked this pull request as ready for review October 28, 2022 10:28
Copy link
Contributor

@mabartos mabartos left a comment

Choose a reason for hiding this comment

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

@stianst Thanks! I've added some comments there (most of them are nitpicks). We should still provide a certain confidence level for these tests; at least such as before these changes. As it touches broker/federation tests, it's necessary to have proper tests for that. WDYT?


// Login with old password doesn't work, but with new password works
loginPage.login("jduke", "theduke");
loginPage.assertCurrent();
loginPage.login("jduke", "newPass");
changePasswordPage.assertCurrent();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to verify the login was really successful? In the following steps, there's only used spnegoLogin(), which only sends HTTP requests.

Comment on lines -134 to -138
// Login with username/password from kerberos
changePasswordPage.open();
loginPage.assertCurrent();
loginPage.login("jduke", "theduke");
changePasswordPage.assertCurrent();
Copy link
Contributor

@mabartos mabartos Oct 28, 2022

Choose a reason for hiding this comment

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

As this test case is included in the abstract test and is used for various additional test classes, IMHO, the login should be verified here via the LoginPage. Also, the test case is named usernamePasswordLoginTest, and one could say if I execute this successfully, I'm really confident the login works as expected.

We're not sure the login with password "theduke" worked before, as it's tested in the following steps.

@@ -166,8 +152,6 @@ public void writableEditModeTest() throws Exception {
loginPage.login("jduke", "theduke");
Assert.assertTrue(loginPage.isCurrent());
loginPage.login("jduke", "newPass");
changePasswordPage.assertCurrent();
changePasswordPage.logout();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above with the assertion.

@@ -0,0 +1,31 @@
package org.keycloak.testsuite.util;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: License?

@stianst stianst force-pushed the remove-account-password-page branch 2 times, most recently from 41c32c2 to 346936e Compare October 28, 2022 12:10
@stianst
Copy link
Contributor Author

stianst commented Oct 28, 2022

@mabartos I've updated the tests to fix the broken tests, and also introduced a TestAppHelper to make it simpler to test login/logout. Could you take another look?

Copy link
Contributor

@mabartos mabartos left a comment

Choose a reason for hiding this comment

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

In order to properly address previous comments, I'd be glad if some additional changes would be made. I don't wanna block it, but would be good to have it there. Thanks!

// Bad existing password
changePasswordPage.changePassword("theduke-invalid", "newPass", "newPass");
Assert.assertTrue(driver.getPageSource().contains("Invalid existing password."));
testAppHelper.login("jduke", "theduke");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
testAppHelper.login("jduke", "theduke");
Assert.assertTrue(testAppHelper.login("jduke", "theduke"));

Would be good to verify the state. I'm aware the intention for that is to simplify the process and mainly execute the methods only as certain "procedures", but in this case it's ok(IMHO).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be sorted now

Comment on lines 152 to 170
loginPage.login("jduke", "theduke");
Assert.assertTrue(loginPage.isCurrent());
loginPage.login("jduke", "newPass");
changePasswordPage.assertCurrent();
changePasswordPage.logout();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to use the TestAppHelper here and verify the state even for the last login?

Sth like this?

Assert.assertTrue(testAppHelper.login("jduke", "newPass"));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be sorted now

Copy link
Contributor

@pedroigor pedroigor left a comment

Choose a reason for hiding this comment

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

I follow @mabartos comments as there are a few places where assertions were removed.

In addition to that, some assertions changed to not check the message (for instance check if Your password has been updated). I'm wondering if we should keep checks for messages if it makes sense.

@stianst stianst force-pushed the remove-account-password-page branch 3 times, most recently from 6fa95c8 to 2df32a1 Compare October 28, 2022 13:33
@stianst
Copy link
Contributor Author

stianst commented Oct 28, 2022

@mabartos @pedroigor asserts and testing failed logins added.

@pedroigor there is no longer a "your password has been updated thing" needed as it's now just testing updating the password through the admin endpoints as that's way simpler, and we're testing if the password can be updated, not if a user can update the password through the account console, so I think that's more than sufficient.

@mabartos
Copy link
Contributor

/rerun

@stianst stianst merged commit cac4c43 into keycloak:main Nov 2, 2022
@stianst stianst deleted the remove-account-password-page branch November 2, 2022 05:20
RuslanTM pushed a commit to RuslanTM/keycloak that referenced this pull request Nov 9, 2022
andre-nascimento6791 pushed a commit to andre-nascimento6791/keycloak-cnd-work that referenced this pull request Dec 1, 2022
Cracky5457 pushed a commit to Cracky5457/keycloak that referenced this pull request Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove AccountPasswordPage from testsuite
3 participants