-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...e/src/main/java/io/hawt/tests/features/stepdefinitions/throttling/ThrottlingStepDefs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.hawt.tests.features.stepdefinitions.throttling; | ||
|
||
import com.codeborne.selenide.SelenideElement; | ||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
import io.hawt.tests.features.pageobjects.pages.LoginPage; | ||
import io.hawt.tests.features.setup.LoginLogout; | ||
|
||
import static com.codeborne.selenide.Condition.text; | ||
import static com.codeborne.selenide.Selenide.$; | ||
|
||
public class ThrottlingStepDefs { | ||
private final LoginPage loginPage = new LoginPage(); | ||
private final static SelenideElement warning = $("p.pf-c-form__helper-text.pf-m-error"); | ||
|
||
|
||
@Given("User is on Login page") | ||
public void userIsOnLoginPage() { | ||
LoginLogout.logout(); | ||
loginPage.loginPageIsOpened(); | ||
} | ||
|
||
@When("the user attempts to log in with incorrect credentials {int} times") | ||
public void theUserAttemptsToLogInWithIncorrectCredentialsTimes(int attempts) { | ||
for (int i = 0; i < attempts; i++) { | ||
loginPage.throttling("username", "invalid"); | ||
} | ||
|
||
} | ||
|
||
@Then("the user should see a message indicating account lockout") | ||
public void theUserShouldSeeAMessageIndicatingAccountLockout() { | ||
warning.shouldHave(text("Login attempt blocked. Retry after 1 second")); | ||
} | ||
|
||
@When("the user attempts to log in with incorrect credential {int} times") | ||
public void theUserAttemptsToLogInWithIncorrectCredentialTimes(int attempts) { | ||
for (int i = 0; i < attempts; i++) { | ||
loginPage.throttling("username", "invalid"); | ||
} | ||
} | ||
|
||
@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")); | ||
} | ||
} | ||
|
8 changes: 8 additions & 0 deletions
8
...hawtio-test-suite/src/test/resources/io/hawt/tests/features/throttling/throttling.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Feature: Account Lockout (Throttling) | ||
|
||
Scenario: User account gets locked out after multiple failed login attempts | ||
Given User is on Login page | ||
When the user attempts to log in with incorrect credentials 5 times | ||
Then the user should see a message indicating account lockout | ||
When the user attempts to log in with incorrect credential 2 times | ||
Then the user should see a message indicating account lockout second time |