Skip to content

Commit

Permalink
AYS-219 | "Delete" Button Test on the Users Detail Screen (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
cagla88 authored Apr 18, 2024
1 parent cca80e3 commit 61465c9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/test/java/org/ays/feature/UsersDelete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,17 @@ Feature: Testing Users
And Sort Created At column in descending order
And Click on the trash bin icon for the top users
And Click on the delete button for the top users
Then Validate the success message
Then Validate the success message

Scenario: Delete the Existing Users on the Detail Screen
When Click on the users tab
And Click on the create button
And Fill out the users form using "Test" firstName
Then Click on the save button
And Click on the pop up close button
And Click on the pop up close Ok button
And Sort Created At column in descending order
And Click on the eye icon for the top users
And Click on the delete button on the users detail screen
And Click on the delete button for the top users
Then Validate the success message
5 changes: 4 additions & 1 deletion src/test/java/org/ays/pages/UsersPOM.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public UsersPOM() {
@FindBy(xpath = "//div[.= 'Invalid phone number']")
private WebElement invalidPhoneNumberMessage;

@FindBy(xpath = "(//span[contains(@Class,'anticon-eye')])[2]")
@FindBy(xpath = "(//span[contains(@Class,'anticon-eye')])[1]")
private WebElement showIcon;

@FindBy(xpath = "//h5[.='Username']")
Expand Down Expand Up @@ -104,4 +104,7 @@ public UsersPOM() {

@FindBy(xpath = "//div[@class= 'ant-modal-confirm-btns']/button[2]")
private WebElement popupCloseOkButton;

@FindBy(xpath = "//span[.='Delete']")
private WebElement usersDetailDeleteButton;
}
22 changes: 22 additions & 0 deletions src/test/java/org/ays/step_definitions/UsersDelete.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,26 @@ public void Validate_the_success_message() {
Assert.assertTrue(usersPOM.getSuccessMessageDelete().isDisplayed());
}

@And("Click on the eye icon for the top users")
public void clickOnTheEyeIconForTheTopUsers() {
pageActions.waitFor(3);
pageActions.waitUntilVisible(usersPOM.getFirstRowData());

String firstName = usersPOM.getFirstRowData().get(0).getText();
if (firstName.startsWith("Test")) {
pageActions.moveToElement(usersPOM.getShowIcon());
pageActions.clickElementWithJavaScript(usersPOM.getShowIcon());
}
pageActions.waitFor(3);
}

@And("Click on the delete button on the users detail screen")
public void clickOnTheDeleteButtonOnTheUsersDetailScreen() {
pageActions.waitFor(3);
pageActions.moveToElement(usersPOM.getUsersDetailDeleteButton());
pageActions.clickElementWithJavaScript(usersPOM.getUsersDetailDeleteButton());
pageActions.waitFor(3);
}

}

0 comments on commit 61465c9

Please sign in to comment.