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
Add account lockout test #3406
base: 4.x
Are you sure you want to change the base?
Add account lockout test #3406
Conversation
Test resultsRun attempt: 1559
|
String pass = "gojo"; | ||
int maxRetries = 7; | ||
int retries = 0; | ||
while (!warning.isDisplayed() && retries < maxRetries) { | ||
Selenide.Wait().until(ExpectedConditions.visibilityOf(loginButton)); | ||
loginInput.shouldBe(editable).setValue(username); | ||
passwordInput.shouldBe(editable).setValue(pass); | ||
loginButton.shouldBe(enabled).click(); | ||
retries++; | ||
} | ||
|
||
|
||
Selenide.Wait().until(ExpectedConditions.visibilityOf(loginButton)); |
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.
Please create another method to test the throttling behavior and create a Cucumber scenario for it.
We should be testing that the throttling time is increasing (2 or 3 attempts is enough).
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.
@kariuwu please change this to a cucumber scenario
|
||
public class ThrottlingStepDefs { | ||
private final LoginPage loginPage = new LoginPage(); | ||
private final static SelenideElement warning = $("p.pf-c-form__helper-text.pf-m-error"); |
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.
It's preferable for this to be just By with the selector and you call the selenide function $
when you need to access the element. This is because sometimes the elements on the webpage can change and leads to Selenide throwing an exception that the reference to the element is stale, it's rare but annoying 😸
Also it's best practice to name constants in ALL_UPPERCASE
, in this case warning is a constant.
@Then("the user should see a message indicating account lockout second time") | ||
public void theUserShouldSeeAMessageIndicatingAccountLockoutSecondTime() { | ||
warning.shouldHave(text("Login attempt blocked. Retry after 3 seconds")); | ||
} | ||
} |
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.
Please make this a universal step "the user should see a message indicating account lockout for {int} seconds" and format the text condition to contain the int parameter.
No description provided.