Skip to content

Commit

Permalink
MOSIP-33299 added testcases for revamp ui (#842)
Browse files Browse the repository at this point in the history
* MOSIP-33299

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflicts

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflicts

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-36006

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-33299

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflicts

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflicts

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflicts

Signed-off-by: Anup Nehe <[email protected]>

---------

Signed-off-by: Anup Nehe <[email protected]>
  • Loading branch information
anup-nehe authored Oct 23, 2024
1 parent 13e6197 commit 293820b
Show file tree
Hide file tree
Showing 14 changed files with 1,092 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public static void clickOnElement(WebElement element) {
}

public static void enter(WebElement element,String value) {

try {
Thread.sleep(3000);
element.clear();
element.sendKeys(value);
}catch (Exception e) {
Expand Down Expand Up @@ -108,7 +110,39 @@ public static void dropdownByIndex(WebElement element, int index) {
executor.executeScript("arguments[0].click();", element);
}
}

public static void dropdown(WebElement element,String value) throws IOException
{

try {
Thread.sleep(50);
clickOnElement(element);
Thread.sleep(50);
String val="'"+value +"'";
click(By.xpath("//*[contains(text(),"+val+")]"));
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}catch (Exception e) {
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element);

}
}


protected static void click(By by) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.findElement(by).click();
}

public static String generateRandomAlphabetString() {
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
Expand Down Expand Up @@ -190,4 +224,14 @@ public static int getSplitdigit()
}
return Integer.parseInt(splitdigit);
}

protected String getTextFromLocator(WebElement element) {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
this.waitForElementToBeVisible(element);
return element.getText();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.mosip.testrig.pmprevampui.pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
Expand All @@ -16,8 +17,15 @@ public class DashboardPage extends BasePage{
private WebElement selectPolicyGroupPopUp;

@FindBy(xpath = "//div[@class='relative w-full']/button")
// select_policy_group_dropdown
private WebElement selectPolicyGroupDropdown;

@FindBy(xpath = "//*[text()='No Data Available.']")
private WebElement noDataAvailableText;

@FindBy(id = "select_policy_group_dropdown_search_input")
private WebElement SearchBox;

@FindBy(xpath = "//*[text()='Submit']")
private WebElement submitButton;

Expand All @@ -42,6 +50,18 @@ public class DashboardPage extends BasePage{
@FindBy(id = "dashboard_authentication_clients_list_card")
private WebElement AuthenticationServices;

@FindBy(id = "select_policy_group_view_text")
private WebElement selectPolicyGroupViewMoreAndLess;

@FindBy(id = "select_policy_group_logout")
private WebElement selectPolicyGroupLogout;

@FindBy(id = "select_policy_group_submit")
private WebElement selectPolicyGroupSubmit;

@FindBy(id = "select_policy_group_dropdown_option1")
private WebElement selectPolicyGrouDropdownOption1;

public DashboardPage(WebDriver driver) {
super(driver);
}
Expand All @@ -67,9 +87,19 @@ public boolean isSubmitButtonSelectPolicyGroupPopUpDisplayed() {
return isElementDisplayed(submitButton);
}

public void selectSelectPolicyGroupDropdown() {
public void selectSelectPolicyGroupDropdown(String value) {
clickOnElement(selectPolicyGroupDropdown);
clickOnElement(value);
enter(SearchBox,value);
String val="'"+value +"'";
// click(By.xpath("//*[contains(text(),"+val+")]"));
clickOnElement(selectPolicyGrouDropdownOption1);
}

public void selectSelectPolicyGroupDropdownForInvalid(String value) {
clickOnElement(selectPolicyGroupDropdown);
enter(SearchBox,value);
String val="'"+value +"'";
// clickOnElement(value);
}

public void clickOnSubmitButton() {
Expand Down Expand Up @@ -119,4 +149,26 @@ public OidcClientPage clickOnAuthenticationServicesTitle() {
return new OidcClientPage(driver);
}

public boolean isSelectPolicyGroupViewMoreAndLess() {
return isElementDisplayed(selectPolicyGroupViewMoreAndLess);
}

public boolean isNoDataAvailableTextDisplayed() {
return isElementDisplayed(noDataAvailableText);
}

public boolean isSelectPolicyGroupSubmitEnabled() {
return isElementEnabled(selectPolicyGroupSubmit);
}

public void clickOnSelectPolicyGroupSubmit() {
clickOnElement(selectPolicyGroupSubmit);
}

public void clickOnSelectPolicyGroupLogout() {
clickOnElement(selectPolicyGroupLogout);
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ public class LoginPage extends BasePage{
@FindBy(xpath = "//*[contains(text(), 'Register')]")
private WebElement registerButton;

@FindBy(id = "username")
private WebElement usernameTextBox;

@FindBy(id = "password")
private WebElement passwordTextBox;

@FindBy(xpath = "//input[@name=\'login\']")
private WebElement LoginButton;

public LoginPage(WebDriver driver) {
super(driver);
}
Expand All @@ -25,4 +34,16 @@ public boolean isLoginPageDisplayed() {
return isElementDisplayed(loginPageTitle);
}

public void enterUserName(String value) {
enter(usernameTextBox,value);
}

public void enterPassword(String value) {
enter(passwordTextBox,value);
}

public void ClickOnLoginButton() {
clickOnElement(LoginButton);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
package io.mosip.testrig.pmprevampui.pages;

import java.io.IOException;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class OldPmpPage extends BasePage{

@FindBy(xpath = "//*[@class='menu-button mat-menu-trigger']")
private WebElement UserProfile;

@FindBy(xpath = "//*[contains(text(), 'Logout')]")
private WebElement LogoutButton;

@FindBy(id = "username")
private WebElement usenameTextBox;

@FindBy(id = "password")
private WebElement PasswordTextBox;

@FindBy(xpath = "//input[@name='login']")
private WebElement LoginButton;

@FindBy(id = "policymenugroup")
private WebElement PolicyMenuGroup;

@FindBy(xpath = "//a[@href='#/pmp/resources/policygroup/view']")
private WebElement PolicyMenuGroupTab;

@FindBy(xpath = "//button[@id='Create Policy Group']")
private WebElement CreatePolicyGroup;

@FindBy(id = "name")
private WebElement nameFormPolicyGroup;

@FindBy(id = "desc")
private WebElement descFormPolicyGroup;

@FindBy(xpath = "//button[@id='createButton']")
private WebElement CreatButton;

@FindBy(xpath = "//button[@id='confirmmessagepopup']")
private WebElement ConfirmMessagePopup;

@FindBy(xpath = "//*[contains(text(), 'Policy')]")
private WebElement PolicyTab;

@FindBy(xpath = "//*[contains(text(), 'Auth Policy')]")
private WebElement AuthPolicyTab;

@FindBy(xpath = "//*[contains(text(), 'Create Policy')]")
private WebElement CreatePolicyTab;

@FindBy(xpath = "//*[@placeholder='Name']")
private WebElement NameTextBox;

@FindBy(xpath = "//*[@placeholder='Description']")
private WebElement DescriptionTextBox;

@FindBy(xpath = "//*[@id='policyGroupName']")
private WebElement policyGroupNameDropDown;

@FindBy(id = "policies")
private WebElement policiesTextBox;

@FindBy(xpath = "//*[contains(text(), 'Filter')]")
private WebElement filterButton;

@FindBy(id = "applyTxt")
private WebElement ApplyTextButton;

@FindBy(xpath = "(//span[@class='mat-button-wrapper']/mat-icon)[2]")
private WebElement PolicyGroupElipsis;

@FindBy(xpath = "//*[contains(text(), 'Activate')]")
private WebElement ActivateButton;

@FindBy(xpath = "//*[contains(text(), ' Yes ')]")
private WebElement YesButton;

public OldPmpPage(WebDriver driver) {
super(driver);
}

public void clickOnUserProfile() {
clickOnElement(UserProfile);
}

public void clickOnLogOut() {
clickOnElement(LogoutButton);
}

public void EnterUserName(String value) {
enter(usenameTextBox,value);
}

public void EntePasswordTextBox(String value) {
enter(PasswordTextBox,value);
}

public void clickOnLoginButton() {
clickOnElement(LoginButton);
}

public void clickOnPolicyMenuGroup() {
clickOnElement(PolicyMenuGroup);
}

public void clickOnPolicyMenuGroupTab() {
clickOnElement(PolicyMenuGroupTab);
}

public void clickOnCreatePolicyGroup() {
clickOnElement(CreatePolicyGroup);
}

public void EnterName() {
enter(nameFormPolicyGroup,"");
}

public void EnterDescription() {
enter(descFormPolicyGroup,"");
}

public void clickOnCreateButton() {
clickOnElement(CreatButton);
}

public void clickOnConfirmMessagePopup() {
clickOnElement(ConfirmMessagePopup);
}

public void clickOnPolicyTab() {
clickOnElement(PolicyTab);
}

public void clickOnAuthPolicyTab() {
clickOnElement(AuthPolicyTab);
}

public void clickOnCreatePolicyTab() {
clickOnElement(CreatePolicyTab);
}

public void EnterNameTextBox(String value) {
enter(NameTextBox,value);
}

public void EnterDescriptionTextBox(String value) {
enter(DescriptionTextBox,value);
}

public void policyGroupNameDropDown(String value) {
try {
dropdown(policyGroupNameDropDown, value);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public void EnterPoliciesTextBox(String value) {
enter(policiesTextBox,value);
}

public void clickOnfilterButton() {
clickOnElement(filterButton);
}

public void clickOnApplyTextButton() {
clickOnElement(ApplyTextButton);
}

public void clickOnPolicyGroupElipsis() {
clickOnElement(PolicyGroupElipsis);
}

public void clickOnActivateButton() {
clickOnElement(ActivateButton);
}

public void clickOnYesButton() {
clickOnElement(YesButton);
}

public void refreshPage() {
driver.navigate().refresh();
}
}
Loading

0 comments on commit 293820b

Please sign in to comment.