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

AYS-190 | Test application registrations page details #38

Merged
merged 9 commits into from
Apr 16, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@Regression
Feature: Test Registration Applications Page Details

Background:
Given Open the institution login page
When Enter the super admin username and password
And Click the Login button

@Smoke
Scenario: Verify column headers on registration application list page
When Click on the registration-application
Then I should see the following column headers
| Organization |
| Creation Reason |
| Status |
| Created User |
| Created At |
| Actions |

Scenario: Verify action button is not available when application status is WAITING
When Click on the registration-application
When Click filter icon
And Click status bar
And Select waiting option from the status menu
And Click status bar
When Click filter button
Then The review button should not be available


45 changes: 45 additions & 0 deletions src/test/java/org/ays/pages/RegistrationApplicationsPOM.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.ays.pages;

import lombok.Getter;
import org.ays.browser.AysBrowser;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

import java.util.List;

@Getter
public class RegistrationApplicationsPOM {
public RegistrationApplicationsPOM() {
PageFactory.initElements(AysBrowser.getWebDriver(), this);
}

@FindBy(css = "th.ant-table-cell")
private List<WebElement> registrationApplicationsListColumnHeaders;

@FindBy(css = "button.ant-btn.refine-show-button")
private List<WebElement> showButtonUnderTheActions;

@FindBy(xpath = "//div[@id='statuses_list_1']")
private WebElement completed;

@FindBy(css = "div[class='ant-select-item-option-content']")
private List<WebElement> statusOptionsFromFilterDropdownMenu;

@FindBy(css = "span.ant-tag.ant-tag-green")
private List<WebElement> completedApplications;

@FindBy(xpath = "//button[contains(@class,'refine-show-button')]")
private List<WebElement> reviewButtons;

@FindBy(xpath = "//div[@class='ant-card-body']//h5[contains(@class, 'ant-typography')]")
private List<WebElement> adminInformationHeaders;

@FindBy(xpath = "(//span[@class='ant-page-header-heading-title'])[2]")
private WebElement informationOfAdminHeaderInReview;

@FindBy(xpath = "//span[contains(@class,'ant-tag ant-tag-green')]")
private List<WebElement> completedStatusesAfterFilter;


}
5 changes: 4 additions & 1 deletion src/test/java/org/ays/pages/SuperAdminPOM.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ public SuperAdminPOM() {
@FindBy(xpath = "//button[@id='filter-button']")
private WebElement filtersButton;

@FindBy(xpath = "//td/span[contains(@class,'ant-tag-blue')]")
@FindBy(xpath = "//td/span[contains(@class,'ant-tag')]")
private List<WebElement> statusColumn;

@FindBy(css = "div[class='ant-select-item-option-content']")
private List<WebElement> statusOptionsFromFilterDropdownMenu;

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.ays.step_definitions;

import io.cucumber.java.en.And;
import io.cucumber.java.en.Then;
import org.ays.browser.AysPageActions;
import org.ays.pages.RegistrationApplicationsPOM;
import org.ays.pages.SuperAdminPOM;
import org.openqa.selenium.WebElement;
import org.testng.Assert;

import java.util.ArrayList;
import java.util.List;

public class RegistrationApplicationsDetails {
private final RegistrationApplicationsPOM registrationApplications = new RegistrationApplicationsPOM();
private final AysPageActions pageActions = new AysPageActions();
private final SuperAdminPOM superAdminPOM = new SuperAdminPOM();

@Then("I should see the following column headers")
public void iShouldSeeTheFollowingColumnHeaders(List<String> expectedHeaders) {
List<WebElement> headerCells = registrationApplications.getRegistrationApplicationsListColumnHeaders();
List<String> actualHeaders = new ArrayList<>();
for (WebElement headerCell : headerCells) {
actualHeaders.add(headerCell.getText());
}
Assert.assertEquals(expectedHeaders, actualHeaders);
}
cagla88 marked this conversation as resolved.
Show resolved Hide resolved

@And("Select waiting option from the status menu")
public void selectWaitingOptionFromTheStatusMenu() {
pageActions.clickMethod(registrationApplications.getStatusOptionsFromFilterDropdownMenu().get(0));
}

@And("Click status bar")
public void clickStatusBar() {
pageActions.clickMethod(superAdminPOM.getStatusBar());
}

@Then("The review button should not be available")
public void theReviewButtonShouldNotBeAvailable() {
List<WebElement> actionButtons = registrationApplications.getShowButtonUnderTheActions();
Assert.assertTrue(actionButtons.isEmpty(), "Action button should not be available");
}
cagla88 marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,13 @@ public void Click_on_the_registration_application() {

@And("Click filter icon")
public void Click_filter_icon() {
pageActions.waitUntilVisible(superAdminPOM.getFilterIcon());
pageActions.moveToElement(superAdminPOM.getFilterIcon());
pageActions.waitUntilClickable(superAdminPOM.getFilterIcon());
pageActions.clickElementWithJavaScript(superAdminPOM.getFilterIcon());
}

@And("Select available option from the status menu")
public void Select_available_option_from_the_status_menu() {
pageActions.clickMethod(superAdminPOM.getStatusBar());
pageActions.clickElementWithJavaScript(superAdminPOM.getWaiting());
pageActions.clickMethod(superAdminPOM.getStatusOptionsFromFilterDropdownMenu().get(0));
pageActions.clickMethod(superAdminPOM.getStatusBar());
}

Expand All @@ -58,7 +55,6 @@ public void allStatusRowCanShow(String expectedStatus) {

for (WebElement cell : statusCells) {
Assert.assertEquals(cell.getText(), expectedStatus);

}
}
}
Loading