From ecb67626340d107ba08371e26121213d51302176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fla=20=C4=B0slamo=C4=9Flu?= <124668094+cagla88@users.noreply.github.com> Date: Thu, 26 Sep 2024 18:36:06 +0300 Subject: [PATCH] AYS-464 | Framework Refactoring (#45) --- .../workflows/application-health-checker.yml | 16 +-- .github/workflows/pull-request-checker.yml | 18 +-- sample_configuration.properties | 8 +- .../AysConfigurationProperty.java | 24 +++- .../ApplicationRegistrationsDetail.feature | 29 ---- .../SuperAdminRegistrationFilter.feature | 14 -- .../java/org/ays/feature/UsersCreate.feature | 40 ------ .../java/org/ays/feature/UsersDelete.feature | 32 ----- .../java/org/ays/feature/UsersEdit.feature | 14 -- .../java/org/ays/feature/UsersShow.feature | 12 -- .../pages/RegistrationApplicationsPOM.java | 45 ------- .../java/org/ays/pages/SuperAdminPOM.java | 39 ------ src/test/java/org/ays/pages/UsersPOM.java | 110 ---------------- .../java/org/ays/step_definitions/Login.java | 4 +- .../RegistrationApplicationsDetails.java | 44 ------- .../SuperAdminRegistrationFilter.java | 60 --------- .../org/ays/step_definitions/UsersCreate.java | 124 ------------------ .../org/ays/step_definitions/UsersDelete.java | 99 -------------- .../org/ays/step_definitions/UsersEdit.java | 50 ------- .../org/ays/step_definitions/UsersShow.java | 26 ---- 20 files changed, 40 insertions(+), 768 deletions(-) delete mode 100644 src/test/java/org/ays/feature/ApplicationRegistrationsDetail.feature delete mode 100644 src/test/java/org/ays/feature/SuperAdminRegistrationFilter.feature delete mode 100644 src/test/java/org/ays/feature/UsersCreate.feature delete mode 100644 src/test/java/org/ays/feature/UsersDelete.feature delete mode 100644 src/test/java/org/ays/feature/UsersEdit.feature delete mode 100644 src/test/java/org/ays/feature/UsersShow.feature delete mode 100644 src/test/java/org/ays/pages/RegistrationApplicationsPOM.java delete mode 100644 src/test/java/org/ays/pages/SuperAdminPOM.java delete mode 100644 src/test/java/org/ays/pages/UsersPOM.java delete mode 100644 src/test/java/org/ays/step_definitions/RegistrationApplicationsDetails.java delete mode 100644 src/test/java/org/ays/step_definitions/SuperAdminRegistrationFilter.java delete mode 100644 src/test/java/org/ays/step_definitions/UsersCreate.java delete mode 100644 src/test/java/org/ays/step_definitions/UsersDelete.java delete mode 100644 src/test/java/org/ays/step_definitions/UsersEdit.java delete mode 100644 src/test/java/org/ays/step_definitions/UsersShow.java diff --git a/.github/workflows/application-health-checker.yml b/.github/workflows/application-health-checker.yml index 21ddc67..0890764 100644 --- a/.github/workflows/application-health-checker.yml +++ b/.github/workflows/application-health-checker.yml @@ -34,17 +34,17 @@ jobs: - name: Replace ui.url in configuration.properties # Step to replace the placeholder api.url in configuration.properties run: sed 's|'{UI_URL}'|'${{ secrets.AYS_UI_URL }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - - name: Replace institution_one.admin_user_one.username in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.username in configuration.properties - run: sed 's|'{INSTITUTION_ONE_ADMIN_USER_ONE_USERNAME}'|'${{ secrets.AYS_INSTITUTION_ONE_ADMIN_USER_ONE_USERNAME }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties + - name: Replace volunteer_foundation.admin.emailAddress in configuration.properties # Step to replace the placeholder volunteer_foundation.admin.email_address in configuration.properties + run: sed 's|'{VOLUNTEER_FOUNDATION_ADMIN_EMAIL_ADDRESS}'|'${{ secrets.AYS_VOLUNTEER_FOUNDATION_ADMIN_EMAIL_ADDRESS }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - - name: Replace institution_one.admin_user_one.password in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.password in configuration.properties - run: sed 's|'{INSTITUTION_ONE_ADMIN_USER_ONE_PASSWORD}'|'${{ secrets.AYS_INSTITUTION_ONE_ADMIN_USER_ONE_PASSWORD }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties + - name: Replace volunteer_foundation.admin.password in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.password in configuration.properties + run: sed 's|'{VOLUNTEER_FOUNDATION_ADMIN_PASSWORD}'|'${{ secrets.AYS_VOLUNTEER_FOUNDATION_ADMIN_PASSWORD }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - - name: Replace institution.super_admin_user_one.username in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.username in configuration.properties - run: sed 's|'{INSTITUTION_SUPER_ADMIN_USER_ONE_USERNAME}'|'${{ secrets.AYS_INSTITUTION_SUPER_ADMIN_USER_ONE_USERNAME }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties + - name: Replace test_foundation.admin.email_address in configuration.properties # Step to replace the placeholder test_foundation.admin.email_address in configuration.properties + run: sed 's|'{TEST_FOUNDATION_ADMIN_EMAIL_ADDRESS}'|'${{ secrets.AYS_TEST_FOUNDATION_ADMIN_EMAIL_ADDRESS }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - - name: Replace institution.super_admin_user_one.password in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.password in configuration.properties - run: sed 's|'{INSTITUTION_SUPER_ADMIN_USER_ONE_PASSWORD}'|'${{ secrets.AYS_INSTITUTION_SUPER_ADMIN_USER_ONE_PASSWORD }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties + - name: Replace test_foundation.admin.password in configuration.properties # Step to replace the placeholder test_foundation.admin.password in configuration.properties + run: sed 's|'{TEST_FOUNDATION_ADMIN_PASSWORD}'|'${{ secrets.AYS_TEST_FOUNDATION_ADMIN_PASSWORD }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - name: Build with Maven # Step to build the project with Maven run: mvn clean test -P weekly \ No newline at end of file diff --git a/.github/workflows/pull-request-checker.yml b/.github/workflows/pull-request-checker.yml index a820635..b7373e0 100644 --- a/.github/workflows/pull-request-checker.yml +++ b/.github/workflows/pull-request-checker.yml @@ -40,18 +40,18 @@ jobs: - name: Replace ui.url in configuration.properties # Step to replace the placeholder api.url in configuration.properties run: sed 's|'{UI_URL}'|'${{ secrets.AYS_UI_URL }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - - name: Replace institution_one.admin_user_one.username in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.username in configuration.properties - run: sed 's|'{INSTITUTION_ONE_ADMIN_USER_ONE_USERNAME}'|'${{ secrets.AYS_INSTITUTION_ONE_ADMIN_USER_ONE_USERNAME }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties + - name: Replace volunteer_foundation.admin.emailAddress in configuration.properties # Step to replace the placeholder volunteer_foundation.admin.email_address in configuration.properties + run: sed 's|'{VOLUNTEER_FOUNDATION_ADMIN_EMAIL_ADDRESS}'|'${{ secrets.AYS_VOLUNTEER_FOUNDATION_ADMIN_EMAIL_ADDRESS }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - - name: Replace institution_one.admin_user_one.password in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.password in configuration.properties - run: sed 's|'{INSTITUTION_ONE_ADMIN_USER_ONE_PASSWORD}'|'${{ secrets.AYS_INSTITUTION_ONE_ADMIN_USER_ONE_PASSWORD }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties + - name: Replace volunteer_foundation.admin.password in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.password in configuration.properties + run: sed 's|'{VOLUNTEER_FOUNDATION_ADMIN_PASSWORD}'|'${{ secrets.AYS_VOLUNTEER_FOUNDATION_ADMIN_PASSWORD }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - - name: Replace institution.super_admin_user_one.username in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.username in configuration.properties - run: sed 's|'{INSTITUTION_SUPER_ADMIN_USER_ONE_USERNAME}'|'${{ secrets.AYS_INSTITUTION_SUPER_ADMIN_USER_ONE_USERNAME }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties + - name: Replace test_foundation.admin.email_address in configuration.properties # Step to replace the placeholder test_foundation.admin.email_address in configuration.properties + run: sed 's|'{TEST_FOUNDATION_ADMIN_EMAIL_ADDRESS}'|'${{ secrets.AYS_TEST_FOUNDATION_ADMIN_EMAIL_ADDRESS }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties + + - name: Replace test_foundation.admin.password in configuration.properties # Step to replace the placeholder test_foundation.admin.password in configuration.properties + run: sed 's|'{TEST_FOUNDATION_ADMIN_PASSWORD}'|'${{ secrets.AYS_TEST_FOUNDATION_ADMIN_PASSWORD }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - - name: Replace institution.super_admin_user_one.password in configuration.properties # Step to replace the placeholder institution_one.admin_user_one.password in configuration.properties - run: sed 's|'{INSTITUTION_SUPER_ADMIN_USER_ONE_PASSWORD}'|'${{ secrets.AYS_INSTITUTION_SUPER_ADMIN_USER_ONE_PASSWORD }}'|g' configuration.properties >> temp_configuration.properties ; rm configuration.properties ; mv temp_configuration.properties configuration.properties - - name: Build with Maven # Step to build the project with Maven run: mvn clean test -P weekly diff --git a/sample_configuration.properties b/sample_configuration.properties index 701f06f..982e5e7 100644 --- a/sample_configuration.properties +++ b/sample_configuration.properties @@ -1,5 +1,5 @@ ui.url={UI_URL} -institution_one.admin_user_one.username={INSTITUTION_ONE_ADMIN_USER_ONE_USERNAME} -institution_one.admin_user_one.password={INSTITUTION_ONE_ADMIN_USER_ONE_PASSWORD} -institution.super_admin_user_one.username={INSTITUTION_SUPER_ADMIN_USER_ONE_USERNAME} -institution.super_admin_user_one.password={INSTITUTION_SUPER_ADMIN_USER_ONE_PASSWORD} \ No newline at end of file +volunteer_foundation.admin.email_address={VOLUNTEER_FOUNDATION_ADMIN_EMAIL_ADDRESS} +volunteer_foundation.admin.password={VOLUNTEER_FOUNDATION_ADMIN_PASSWORD} +test_foundation.admin.email_address={TEST_FOUNDATION_ADMIN_EMAIL_ADDRESS} +test_foundation.admin.password={TEST_FOUNDATION_ADMIN_PASSWORD} \ No newline at end of file diff --git a/src/test/java/org/ays/configuration/AysConfigurationProperty.java b/src/test/java/org/ays/configuration/AysConfigurationProperty.java index 21d3363..7dfdc1f 100644 --- a/src/test/java/org/ays/configuration/AysConfigurationProperty.java +++ b/src/test/java/org/ays/configuration/AysConfigurationProperty.java @@ -30,17 +30,27 @@ public static class Ui { public static final String URL = PROPERTIES.getProperty("ui.url"); } - public static class InstitutionOne { - public static class AdminUserOne { - public static final String USERNAME = PROPERTIES.getProperty("institution_one.admin_user_one.username"); - public static final String PASSWORD = PROPERTIES.getProperty("institution_one.admin_user_one.password"); + public static class VolunteerFoundation { + + public static class Admin { + public static final String EMAIL_ADDRESS = PROPERTIES.getProperty("volunteer_foundation.admin.email_address"); + public static final String PASSWORD = PROPERTIES.getProperty("volunteer_foundation.admin.password"); + } - public static class SuperAdminUserOne { - public static final String USERNAME = PROPERTIES.getProperty("institution.super_admin_user_one.username"); - public static final String PASSWORD = PROPERTIES.getProperty("institution.super_admin_user_one.password"); + + } + + public static class TestFoundation { + + public static class Admin { + public static final String EMAIL_ADDRESS = PROPERTIES.getProperty("test_foundation.admin.email_address"); + public static final String PASSWORD = PROPERTIES.getProperty("test_foundation.admin.password"); + } + } + private static class AysConfigurationException extends RuntimeException { @Serial diff --git a/src/test/java/org/ays/feature/ApplicationRegistrationsDetail.feature b/src/test/java/org/ays/feature/ApplicationRegistrationsDetail.feature deleted file mode 100644 index fc8e9ae..0000000 --- a/src/test/java/org/ays/feature/ApplicationRegistrationsDetail.feature +++ /dev/null @@ -1,29 +0,0 @@ -@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 - - diff --git a/src/test/java/org/ays/feature/SuperAdminRegistrationFilter.feature b/src/test/java/org/ays/feature/SuperAdminRegistrationFilter.feature deleted file mode 100644 index 910711d..0000000 --- a/src/test/java/org/ays/feature/SuperAdminRegistrationFilter.feature +++ /dev/null @@ -1,14 +0,0 @@ -@Regression @Smoke -Feature: Testing Super Admin Registration List - - Background: - Given Open the institution login page - When Enter the super admin username and password - And Click the Login button - - Scenario: Testing registration list by super admin user - When Click on the registration-application - When Click filter icon - And Select available option from the status menu - Then Click filter button - And All status row can show "Waiting" \ No newline at end of file diff --git a/src/test/java/org/ays/feature/UsersCreate.feature b/src/test/java/org/ays/feature/UsersCreate.feature deleted file mode 100644 index 2c2d939..0000000 --- a/src/test/java/org/ays/feature/UsersCreate.feature +++ /dev/null @@ -1,40 +0,0 @@ -@Regression -Feature: Testing Users Section - - Background: - Given Open the institution login page - When Enter the username and password - And Click the Login button - - @Smoke - Scenario: Create a New Users - When Click on the users tab - And Click on the create button - And Fill out the users form - Then Click on the save button - And "Successful" success message is displayed - And "New User Created" title is displayed - And Username and Password information is displayed - Then Click on the Copy and Close button - And "Username and password copied to clipboard" message is displayed - - Scenario: Create an Users with an Invalid First Name - When Click on the users tab - And Click on the create button - And Enter invalid characters in the name field while filling out the users form - Then Click on the save button - And "This field is required" error massage is displayed - - Scenario: Create an Users with an Invalid Last Name - When Click on the users tab - And Click on the create button - And Enter invalid characters in the last name field while filling out the users form - Then Click on the save button - And "This field is required" error massage is displayed - - Scenario: Create an Users with an Invalid Phone Number - When Click on the users tab - And Click on the create button - And Enter invalid characters in the phone number field while filling out the users form - Then Click on the save button - And "Invalid phone number" massage is displayed \ No newline at end of file diff --git a/src/test/java/org/ays/feature/UsersDelete.feature b/src/test/java/org/ays/feature/UsersDelete.feature deleted file mode 100644 index 74d6ac8..0000000 --- a/src/test/java/org/ays/feature/UsersDelete.feature +++ /dev/null @@ -1,32 +0,0 @@ -@Smoke @Regression -Feature: Testing Users - - Background: - Given Open the institution login page - When Enter the username and password - And Click the Login button - - Scenario: Delete the Existing Users - 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 trash bin icon for the top users - And Click on the delete button for the top users - 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 diff --git a/src/test/java/org/ays/feature/UsersEdit.feature b/src/test/java/org/ays/feature/UsersEdit.feature deleted file mode 100644 index 7178384..0000000 --- a/src/test/java/org/ays/feature/UsersEdit.feature +++ /dev/null @@ -1,14 +0,0 @@ -@Ignore -Feature: Testing Users - - Background: - Given Open the institution login page - When Enter the username and password - And Click the Login button - - Scenario: Editing Users - When Click on the users tab - And Click on the pencil icon - And Edit the status section in the user form - Then Click on the save edit button - And "Successful" success message is displayed \ No newline at end of file diff --git a/src/test/java/org/ays/feature/UsersShow.feature b/src/test/java/org/ays/feature/UsersShow.feature deleted file mode 100644 index aff2ee1..0000000 --- a/src/test/java/org/ays/feature/UsersShow.feature +++ /dev/null @@ -1,12 +0,0 @@ -@Regression -Feature: Testing Users - - Background: - Given Open the institution login page - When Enter the username and password - And Click the Login button - - Scenario: Display Users Information - When Click on the users tab - And Click on the eye icon - Then Validate that the "Username" has appeared in the users information \ No newline at end of file diff --git a/src/test/java/org/ays/pages/RegistrationApplicationsPOM.java b/src/test/java/org/ays/pages/RegistrationApplicationsPOM.java deleted file mode 100644 index 51b8185..0000000 --- a/src/test/java/org/ays/pages/RegistrationApplicationsPOM.java +++ /dev/null @@ -1,45 +0,0 @@ -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 registrationApplicationsListColumnHeaders; - - @FindBy(css = "button.ant-btn.refine-show-button") - private List showButtonUnderTheActions; - - @FindBy(xpath = "//div[@id='statuses_list_1']") - private WebElement completed; - - @FindBy(css = "div[class='ant-select-item-option-content']") - private List statusOptionsFromFilterDropdownMenu; - - @FindBy(css = "span.ant-tag.ant-tag-green") - private List completedApplications; - - @FindBy(xpath = "//button[contains(@class,'refine-show-button')]") - private List reviewButtons; - - @FindBy(xpath = "//div[@class='ant-card-body']//h5[contains(@class, 'ant-typography')]") - private List 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 completedStatusesAfterFilter; - - -} diff --git a/src/test/java/org/ays/pages/SuperAdminPOM.java b/src/test/java/org/ays/pages/SuperAdminPOM.java deleted file mode 100644 index abeeeff..0000000 --- a/src/test/java/org/ays/pages/SuperAdminPOM.java +++ /dev/null @@ -1,39 +0,0 @@ -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 SuperAdminPOM { - public SuperAdminPOM() { - PageFactory.initElements(AysBrowser.getWebDriver(), this); - } - - @FindBy(xpath = "//a[normalize-space()='Registration Applications']") - private WebElement registrationApplication; - - @FindBy(xpath = "(//button)[5]") - private WebElement filterIcon; - - @FindBy(xpath = "//div[@class='ant-select-selection-overflow']") - private WebElement statusBar; - - @FindBy(xpath = "//div[@id='statuses_list_0']") - private WebElement waiting; - - @FindBy(xpath = "//button[@id='filter-button']") - private WebElement filtersButton; - - @FindBy(xpath = "//td/span[contains(@class,'ant-tag')]") - private List statusColumn; - - @FindBy(css = "div[class='ant-select-item-option-content']") - private List statusOptionsFromFilterDropdownMenu; - -} - diff --git a/src/test/java/org/ays/pages/UsersPOM.java b/src/test/java/org/ays/pages/UsersPOM.java deleted file mode 100644 index d12f88b..0000000 --- a/src/test/java/org/ays/pages/UsersPOM.java +++ /dev/null @@ -1,110 +0,0 @@ -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 UsersPOM { - - public UsersPOM() { - PageFactory.initElements(AysBrowser.getWebDriver(), this); - } - - @FindBy(xpath = "//a[.='Users']") - private WebElement usersTab; - - @FindBy(xpath = "(//span[.='Create'])[2]") - private WebElement createButton; - - @FindBy(id = "firstName") - private WebElement firstName; - - @FindBy(id = "lastName") - private WebElement lastName; - - @FindBy(xpath = "(//div/span[@class='ant-select-selection-search'])[2]") - private WebElement countryCode; - - @FindBy(xpath = "(//div[.='+90 Türkiye'])[2]") - private WebElement turkeyCountryCode; - - @FindBy(xpath = "//input[@id= 'phoneNumber_lineNumber']") - private WebElement phoneNumber; - - @FindBy(xpath = "//span[contains(@class, 'anticon-save')]") - private WebElement saveButton; - - @FindBy(xpath = "//div[.='Successful']") - private WebElement successfulMessage; - - @FindBy(xpath = "//div[.= 'This field is required']") - private WebElement errorMassage; - - @FindBy(xpath = "//div[.= 'Invalid phone number']") - private WebElement invalidPhoneNumberMessage; - - @FindBy(xpath = "(//span[contains(@Class,'anticon-eye')])[1]") - private WebElement showIcon; - - @FindBy(xpath = "//h5[.='Username']") - private WebElement showUsername; - - @FindBy(xpath = "//span[contains(@class, 'anticon-edit')]") - private WebElement usersEditIcon; - - @FindBy(xpath = "(//span[@class='ant-select-selection-item'])[2]") - private WebElement statusDropdown; - - @FindBy(xpath = "//div[.='Active']") - private WebElement activeOption; - - @FindBy(xpath = "(//div[.='Passive'])[2]") - private WebElement passiveOption; - - @FindBy(xpath = "(//tr[contains(@class,'ant-table-row-level-0')])[1]/td/div/div/button") - private WebElement deleteUsersIcon; - - @FindBy(xpath = "//div[@class='ant-popover-content']/div/div/div/div[2]/button[2]") - private WebElement sureDeleteButton; - - @FindBy(xpath = "//div[@class='ant-notification-notice-message']") - private WebElement successMessageDelete; - - @FindBy(xpath = "//div[@class='ant-table-column-sorters']/span[1]") - private WebElement createdAtColumn; - - @FindBy(xpath = "(//button[contains(@class, 'refine-save-button')])[2]") - private WebElement editSaveButton; - - @FindBy(xpath = "//button[@class='ant-modal-close']") - private WebElement popupCloseButton; - - @FindBy(xpath = "(//tr[contains(@class,'ant-table-row-level-0')])[1]/td/span") - private List firstRowData; - - @FindBy(xpath = "//div[@class='ant-modal-title']") - private WebElement newUserCreatedTitle; - - @FindBy(xpath = "//div[@class='ant-modal-body']/div/div[3]/span") - private WebElement usernameInfo; - - @FindBy(xpath = "//div[@class='ant-modal-body']/div/div[4]/span") - private WebElement passwordInfo; - - @FindBy(xpath = "//button/span[.='Copy and Close']") - private WebElement copyAndCloseButton; - - @FindBy(xpath = "//div[.='Username and password copied to clipboard']") - private WebElement copiedMessage; - - @FindBy(xpath = "//div[@class= 'ant-modal-confirm-btns']/button[2]") - private WebElement popupCloseOkButton; - - @FindBy(xpath = "//span[.='Delete']") - private WebElement usersDetailDeleteButton; -} diff --git a/src/test/java/org/ays/step_definitions/Login.java b/src/test/java/org/ays/step_definitions/Login.java index 93b460e..2742d11 100644 --- a/src/test/java/org/ays/step_definitions/Login.java +++ b/src/test/java/org/ays/step_definitions/Login.java @@ -22,8 +22,8 @@ public void open_the_institution_login_page() { @When("Enter the username and password") public void enter_the_username_and_password() { - this.pageActions.sendKeysMethod(loginPOM.getLoginUsername(), AysConfigurationProperty.InstitutionOne.AdminUserOne.USERNAME); - this.pageActions.sendKeysMethod(loginPOM.getLoginPassword(), AysConfigurationProperty.InstitutionOne.AdminUserOne.PASSWORD); + this.pageActions.sendKeysMethod(loginPOM.getLoginUsername(), AysConfigurationProperty.VolunteerFoundation.Admin.EMAIL_ADDRESS); + this.pageActions.sendKeysMethod(loginPOM.getLoginPassword(), AysConfigurationProperty.VolunteerFoundation.Admin.PASSWORD); } @And("Click the Login button") diff --git a/src/test/java/org/ays/step_definitions/RegistrationApplicationsDetails.java b/src/test/java/org/ays/step_definitions/RegistrationApplicationsDetails.java deleted file mode 100644 index 7f122d5..0000000 --- a/src/test/java/org/ays/step_definitions/RegistrationApplicationsDetails.java +++ /dev/null @@ -1,44 +0,0 @@ -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 expectedHeaders) { - List headerCells = registrationApplications.getRegistrationApplicationsListColumnHeaders(); - List actualHeaders = new ArrayList<>(); - for (WebElement headerCell : headerCells) { - actualHeaders.add(headerCell.getText()); - } - Assert.assertEquals(expectedHeaders, actualHeaders); - } - - @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 actionButtons = registrationApplications.getShowButtonUnderTheActions(); - Assert.assertTrue(actionButtons.isEmpty(), "Action button should not be available"); - } -} diff --git a/src/test/java/org/ays/step_definitions/SuperAdminRegistrationFilter.java b/src/test/java/org/ays/step_definitions/SuperAdminRegistrationFilter.java deleted file mode 100644 index d7ed14d..0000000 --- a/src/test/java/org/ays/step_definitions/SuperAdminRegistrationFilter.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.ays.step_definitions; - -import io.cucumber.java.en.And; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import org.ays.browser.AysPageActions; -import org.ays.configuration.AysConfigurationProperty; -import org.ays.pages.LoginPOM; -import org.ays.pages.SuperAdminPOM; -import org.openqa.selenium.WebElement; - -import java.util.List; -import org.testng.Assert; - - -public class SuperAdminRegistrationFilter { - private final LoginPOM loginPOM = new LoginPOM(); - private final SuperAdminPOM superAdminPOM = new SuperAdminPOM(); - private final AysPageActions pageActions = new AysPageActions(); - - @When("Enter the super admin username and password") - public void Enter_the_super_admin_username_and_password() { - this.pageActions.sendKeysMethod(loginPOM.getLoginUsername(), AysConfigurationProperty.InstitutionOne.SuperAdminUserOne.USERNAME); - this.pageActions.sendKeysMethod(loginPOM.getLoginPassword(), AysConfigurationProperty.InstitutionOne.SuperAdminUserOne.PASSWORD); - } - - @When("Click on the registration-application") - public void Click_on_the_registration_application() { - pageActions.waitUntilClickable(superAdminPOM.getRegistrationApplication()); - pageActions.clickMethod(superAdminPOM.getRegistrationApplication()); - } - - @And("Click filter icon") - public void Click_filter_icon() { - 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.clickMethod(superAdminPOM.getStatusOptionsFromFilterDropdownMenu().get(0)); - pageActions.clickMethod(superAdminPOM.getStatusBar()); - } - - @Then("Click filter button") - public void Click_filter_button() { - pageActions.clickMethod(superAdminPOM.getFiltersButton()); - } - - @And("All status row can show {string}") - public void allStatusRowCanShow(String expectedStatus) { - - pageActions.waitUntilVisible(superAdminPOM.getStatusColumn()); - List statusCells = superAdminPOM.getStatusColumn(); - - for (WebElement cell : statusCells) { - Assert.assertEquals(cell.getText(), expectedStatus); - } - } -} diff --git a/src/test/java/org/ays/step_definitions/UsersCreate.java b/src/test/java/org/ays/step_definitions/UsersCreate.java deleted file mode 100644 index 9f13e5d..0000000 --- a/src/test/java/org/ays/step_definitions/UsersCreate.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.ays.step_definitions; - -import io.cucumber.java.en.And; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import org.ays.browser.AysPageActions; -import org.ays.pages.UsersPOM; -import org.ays.utilities.AysRandomUtil; -import org.testng.Assert; - -public class UsersCreate { - - private final UsersPOM usersPOM = new UsersPOM(); - private final AysPageActions pageActions = new AysPageActions(); - - @When("Click on the users tab") - public void click_on_the_users_tab() { - pageActions.waitUntilClickable(usersPOM.getUsersTab()); - pageActions.clickMethod(usersPOM.getUsersTab()); - } - - @And("Click on the create button") - public void Click_on_the_create_button() { - pageActions.moveToElement(usersPOM.getCreateButton()); - pageActions.clickElementWithJavaScript(usersPOM.getCreateButton()); - } - - @When("Fill out the users form") - public void fill_out_the_users_form() { - pageActions.waitUntilVisible(usersPOM.getFirstName()); - pageActions.sendKeysMethod(usersPOM.getFirstName(), AysRandomUtil.generateFirstName()); - pageActions.waitUntilVisible(usersPOM.getLastName()); - pageActions.sendKeysMethod(usersPOM.getLastName(), AysRandomUtil.generateLastName()); - pageActions.clickMethod(usersPOM.getCountryCode()); - pageActions.clickMethod(usersPOM.getTurkeyCountryCode()); - pageActions.waitUntilVisible(usersPOM.getPhoneNumber()); - pageActions.sendKeysMethod(usersPOM.getPhoneNumber(), AysRandomUtil.generatePhoneNumber()); - } - - @Then("Click on the save button") - public void Click_on_the_save_button() { - pageActions.clickMethod(usersPOM.getSaveButton()); - } - - @And("{string} success message is displayed") - public void successMessageIsDisplayed(String message) { - pageActions.waitUntilVisible(usersPOM.getSuccessfulMessage()); - Assert.assertEquals(usersPOM.getSuccessfulMessage().getText(), message); - } - - @And("Enter invalid characters in the name field while filling out the users form") - public void enterInvalidCharactersInTheNameFieldWhileFillingOutTheUsersForm() { - pageActions.waitUntilVisible(usersPOM.getFirstName()); - pageActions.sendKeysMethod(usersPOM.getFirstName(), "?--/-**-8965"); - pageActions.waitUntilVisible(usersPOM.getLastName()); - pageActions.sendKeysMethod(usersPOM.getLastName(), AysRandomUtil.generateLastName()); - pageActions.clickMethod(usersPOM.getCountryCode()); - pageActions.clickMethod(usersPOM.getTurkeyCountryCode()); - pageActions.waitUntilVisible(usersPOM.getPhoneNumber()); - pageActions.sendKeysMethod(usersPOM.getPhoneNumber(), AysRandomUtil.generatePhoneNumber()); - } - - @And("Enter invalid characters in the last name field while filling out the users form") - public void enterInvalidCharactersInTheLastNameFieldWhileFillingOutTheUsersForm() { - pageActions.waitUntilVisible(usersPOM.getFirstName()); - pageActions.sendKeysMethod(usersPOM.getFirstName(), AysRandomUtil.generateFirstName()); - pageActions.waitUntilVisible(usersPOM.getLastName()); - pageActions.sendKeysMethod(usersPOM.getLastName(), "?--/-**-8965"); - pageActions.clickMethod(usersPOM.getCountryCode()); - pageActions.clickMethod(usersPOM.getTurkeyCountryCode()); - pageActions.waitUntilVisible(usersPOM.getPhoneNumber()); - pageActions.sendKeysMethod(usersPOM.getPhoneNumber(), AysRandomUtil.generatePhoneNumber()); - } - - @And("{string} error massage is displayed") - public void errorMassageIsDisplayed(String message) { - pageActions.waitUntilVisible(usersPOM.getErrorMassage()); - Assert.assertEquals(usersPOM.getErrorMassage().getText(), message); - } - - @And("Enter invalid characters in the phone number field while filling out the users form") - public void enterInvalidCharactersInThePhoneNumberFieldWhileFillingOutTheUsersForm() { - pageActions.waitUntilVisible(usersPOM.getFirstName()); - pageActions.sendKeysMethod(usersPOM.getFirstName(), AysRandomUtil.generateFirstName()); - pageActions.waitUntilVisible(usersPOM.getLastName()); - pageActions.sendKeysMethod(usersPOM.getLastName(), AysRandomUtil.generateLastName()); - pageActions.clickMethod(usersPOM.getCountryCode()); - pageActions.clickMethod(usersPOM.getTurkeyCountryCode()); - pageActions.waitUntilVisible(usersPOM.getPhoneNumber()); - pageActions.sendKeysMethod(usersPOM.getPhoneNumber(), "123"); - } - - @And("{string} massage is displayed") - public void massageIsDisplayed(String message) { - pageActions.waitUntilVisible(usersPOM.getInvalidPhoneNumberMessage()); - Assert.assertEquals(usersPOM.getInvalidPhoneNumberMessage().getText(), message); - } - - @And("{string} title is displayed") - public void titleIsDisplayed(String title) { - pageActions.waitUntilVisible(usersPOM.getNewUserCreatedTitle()); - Assert.assertEquals(usersPOM.getNewUserCreatedTitle().getText(), title); - - } - - @And("Username and Password information is displayed") - public void usernameAndPasswordInformationIsDisplayed() { - pageActions.waitUntilVisible(usersPOM.getUsernameInfo()); - Assert.assertTrue(pageActions.isPresent(usersPOM.getUsernameInfo())); - Assert.assertTrue(pageActions.isPresent(usersPOM.getPasswordInfo())); - } - - @Then("Click on the Copy and Close button") - public void clickOnTheCopyAndCloseButton() { - pageActions.waitUntilClickable(usersPOM.getCopyAndCloseButton()); - pageActions.clickMethod(usersPOM.getCopyAndCloseButton()); - } - - @And("{string} message is displayed") - public void messageIsDisplayed(String copiedMessage) { - pageActions.waitUntilVisible(usersPOM.getCopiedMessage()); - Assert.assertEquals(usersPOM.getCopiedMessage().getText(), copiedMessage); - } -} diff --git a/src/test/java/org/ays/step_definitions/UsersDelete.java b/src/test/java/org/ays/step_definitions/UsersDelete.java deleted file mode 100644 index 40824e1..0000000 --- a/src/test/java/org/ays/step_definitions/UsersDelete.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.ays.step_definitions; - -import io.cucumber.java.en.And; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import org.ays.pages.UsersPOM; -import org.ays.browser.AysPageActions; -import org.ays.utilities.AysRandomUtil; -import org.testng.Assert; - -public class UsersDelete { - - private final UsersPOM usersPOM = new UsersPOM(); - private final AysPageActions pageActions = new AysPageActions(); - - @And("Fill out the users form using {string} firstName") - public void fillOutTheUsersFormUsingFirstName(String firstName) { - pageActions.waitUntilVisible(usersPOM.getFirstName()); - pageActions.sendKeysMethod(usersPOM.getFirstName(), firstName + AysRandomUtil.generateFirstName()); - pageActions.waitUntilVisible(usersPOM.getLastName()); - pageActions.sendKeysMethod(usersPOM.getLastName(), AysRandomUtil.generateLastName()); - pageActions.clickMethod(usersPOM.getCountryCode()); - pageActions.clickMethod(usersPOM.getTurkeyCountryCode()); - pageActions.waitUntilVisible(usersPOM.getPhoneNumber()); - pageActions.sendKeysMethod(usersPOM.getPhoneNumber(), AysRandomUtil.generatePhoneNumber()); - - } - - @And("Click on the pop up close button") - public void clickOnThePopUpCloseButton() { - pageActions.waitFor(3); - pageActions.waitUntilClickable(usersPOM.getPopupCloseButton()); - pageActions.clickMethod(usersPOM.getPopupCloseButton()); - } - - @And("Click on the pop up close Ok button") - public void clickOnThePopUpCloseOkButton() { - pageActions.waitUntilClickable(usersPOM.getPopupCloseOkButton()); - pageActions.clickMethod(usersPOM.getPopupCloseOkButton()); - - } - - @When("Sort Created At column in descending order") - public void sort_created_at_column_in_descending_order() { - pageActions.waitFor(3); - pageActions.waitUntilVisible(usersPOM.getCreatedAtColumn()); - pageActions.waitUntilClickable(usersPOM.getCreatedAtColumn()); - pageActions.doubleClick(usersPOM.getCreatedAtColumn()); - } - - @When("Click on the trash bin icon for the top users") - public void click_on_the_trash_bin_icon_for_the_top_users() { - pageActions.waitFor(3); - pageActions.waitUntilVisible(usersPOM.getFirstRowData()); - - String firstName = usersPOM.getFirstRowData().get(0).getText(); - if (firstName.startsWith("Test")) { - pageActions.moveToElement(usersPOM.getDeleteUsersIcon()); - pageActions.clickElementWithJavaScript(usersPOM.getDeleteUsersIcon()); - } - pageActions.waitFor(3); - } - - @And("Click on the delete button for the top users") - public void clickOnTheDeleteButtonForTheTopUsers() { - pageActions.moveToElement(usersPOM.getSureDeleteButton()); - pageActions.waitUntilClickable(usersPOM.getSureDeleteButton()); - pageActions.clickElementWithJavaScript(usersPOM.getSureDeleteButton()); - } - - @Then("Validate the success message") - public void Validate_the_success_message() { - pageActions.waitUntilVisible(usersPOM.getSuccessMessageDelete()); - 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); - } - -} - diff --git a/src/test/java/org/ays/step_definitions/UsersEdit.java b/src/test/java/org/ays/step_definitions/UsersEdit.java deleted file mode 100644 index a30ac8f..0000000 --- a/src/test/java/org/ays/step_definitions/UsersEdit.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.ays.step_definitions; - -import io.cucumber.java.en.And; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import org.ays.browser.AysPageActions; -import org.ays.pages.UsersPOM; - -public class UsersEdit { - - private final UsersPOM usersPOM = new UsersPOM(); - private final AysPageActions pageActions = new AysPageActions(); - - @And("Click on the pencil icon") - public void clickOnThePencilIcon() { - pageActions.waitUntilVisible(usersPOM.getUsersEditIcon()); - pageActions.moveToElement(usersPOM.getUsersEditIcon()); - pageActions.clickElementWithJavaScript(usersPOM.getUsersEditIcon()); - } - - @When("Edit the status section in the user form") - public void editTheStatusSectionInTheUserForm() { - pageActions.moveToElement(usersPOM.getStatusDropdown()); - pageActions.clickMethod(usersPOM.getStatusDropdown()); - - 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") - public void Click_on_the_save_edit_button() { - pageActions.waitUntilVisible(usersPOM.getEditSaveButton()); - pageActions.moveToElement(usersPOM.getEditSaveButton()); - pageActions.clickElementWithJavaScript(usersPOM.getEditSaveButton()); - } - -} diff --git a/src/test/java/org/ays/step_definitions/UsersShow.java b/src/test/java/org/ays/step_definitions/UsersShow.java deleted file mode 100644 index 2e069d6..0000000 --- a/src/test/java/org/ays/step_definitions/UsersShow.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.ays.step_definitions; - -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import org.ays.browser.AysPageActions; -import org.ays.pages.UsersPOM; -import org.testng.Assert; - -public class UsersShow { - - private final UsersPOM usersPOM = new UsersPOM(); - private final AysPageActions pageActions = new AysPageActions(); - - @When("Click on the eye icon") - public void clickOnTheEyeIcon() { - pageActions.moveToElement(usersPOM.getShowIcon()); - pageActions.clickElementWithJavaScript(usersPOM.getShowIcon()); - } - - @Then("Validate that the {string} has appeared in the users information") - public void validateThatTheHasAppearedInTheUsersInformation(String username) { - pageActions.waitUntilVisible(usersPOM.getShowUsername()); - Assert.assertEquals(usersPOM.getShowUsername().getText(), username); - } - -}