Skip to content

Commit

Permalink
AYS-218 | DOM Change Testing (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
cagla88 authored Apr 7, 2024
1 parent 470701f commit 574e45b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/test/java/org/ays/feature/UsersEdit.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Ignore
@Smoke @Regression
Feature: Testing Users

Background:
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/ays/pages/UsersPOM.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public UsersPOM() {
@FindBy(id = "lastName")
private WebElement lastName;

@FindBy(xpath = "//div/span[@class='ant-select-selection-search']")
@FindBy(xpath = "(//div/span[@class='ant-select-selection-search'])[2]")
private WebElement countryCode;

@FindBy(xpath = "(//div[.='+90 Türkiye'])[2]")
Expand Down Expand Up @@ -57,7 +57,7 @@ public UsersPOM() {
@FindBy(xpath = "//span[contains(@class, 'anticon-edit')]")
private WebElement usersEditIcon;

@FindBy(xpath = "(//span[@class='ant-select-selection-item'])[1]")
@FindBy(xpath = "(//span[@class='ant-select-selection-item'])[2]")
private WebElement statusDropdown;

@FindBy(xpath = "//div[.='Active']")
Expand All @@ -78,7 +78,7 @@ public UsersPOM() {
@FindBy(xpath = "//div[@class='ant-table-column-sorters']/span[1]")
private WebElement createdAtColumn;

@FindBy(xpath = "(//span[contains(@class, 'anticon-save')])[2]")
@FindBy(xpath = "(//button[contains(@class, 'refine-save-button')])[2]")
private WebElement editSaveButton;

@FindBy(xpath = "//button[@class='ant-modal-close']")
Expand Down
21 changes: 14 additions & 7 deletions src/test/java/org/ays/step_definitions/UsersEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@ public void editTheStatusSectionInTheUserForm() {
pageActions.moveToElement(usersPOM.getStatusDropdown());
pageActions.clickMethod(usersPOM.getStatusDropdown());

if (usersPOM.getStatusDropdown().getText().equals("Active")) {
pageActions.waitUntilClickable(usersPOM.getPassiveOption());
pageActions.clickMethod(usersPOM.getPassiveOption());
}
if (usersPOM.getStatusDropdown().getText().equals("Passive")) {
pageActions.waitUntilClickable(usersPOM.getActiveOption());
pageActions.clickMethod(usersPOM.getActiveOption());
String status = usersPOM.getStatusDropdown().getText();
switch (status) {

case "Active": {
pageActions.waitUntilClickable(usersPOM.getPassiveOption());
pageActions.clickMethod(usersPOM.getPassiveOption());
break;
}
case "Passive": {
pageActions.waitUntilClickable(usersPOM.getActiveOption());
pageActions.clickMethod(usersPOM.getActiveOption());
break;
}
}
pageActions.waitFor(3);
}

@Then("Click on the save edit button")
Expand Down

0 comments on commit 574e45b

Please sign in to comment.