Skip to content

Commit

Permalink
Merge pull request #722 from jayesh12234/develop-java21
Browse files Browse the repository at this point in the history
MOSIP-33383
  • Loading branch information
aranaravi authored Jun 26, 2024
2 parents 9bca6d9 + 1372dd7 commit c02abec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
package io.mosip.testrig.residentui.testcase;

import org.openqa.selenium.By;
import org.testng.Reporter;
import org.testng.annotations.Test;

import com.aventstack.extentreports.Status;

import io.mosip.testrig.residentui.kernel.util.ConfigManager;
import io.mosip.testrig.residentui.utility.BaseClass;
import io.mosip.testrig.residentui.utility.Commons;
import io.mosip.testrig.residentui.utility.JsonUtil;
import io.mosip.testrig.residentui.utility.MockSMTPListener;
import io.mosip.testrig.residentui.utility.TestRunner;
@Test(groups = "UMD")
public class UpdateMyData extends BaseClass {

public void updateMyDataName() throws Exception {
String tempemail1 = ConfigManager.gettempemail1();
LoginTest.loginTest();
test = extent.createTest("updateMyData Test ", "verify Login");
Commons.clickWebelement(test, driver, By.id("uinservices/updatedemographic"));
Commons.enter(test, driver, By.id("fullName"+BaseClass.envsupportlang()), data);
Commons.enter(test, driver, By.id("fullName"+BaseClass.envsupportlang()), Commons.generateRandomAlphabetString());
Commons.dropdown(test, driver, By.id("gender"));
test.log(Status.INFO, "Click on gender");
Commons.enter(test, driver, By.id("proofOfIdentityvalue"), data);
Expand All @@ -29,16 +26,15 @@ public void updateMyDataName() throws Exception {
TestRunner.getResourcePath() + "//BulkUploadFiles//tonyId.png");
Thread.sleep(2000);
Commons.clickWebelement(test, driver, By.id("previewBtn"));

test.log(Status.INFO, "Click on submit");

test.log(Status.INFO, "Click on submit");
Commons.clickWebelement(test, driver, By.id("submitBtn"));
Commons.clickWebelement(test, driver, By.id("confirmUpdateData"));
Commons.clickWebelement(test, driver, By.id("updateMyDataBtn"));

Commons.clickWebelement(test, driver, By.id("updateMyDataBtn"));
test.log(Status.INFO, "Click on Submit");
Commons.clickWebelement(test, driver, By.id("dismissBtn"));
}


public void updateMyDataAddress() throws Exception {

test.log(Status.INFO, "Update Address");
Expand All @@ -47,7 +43,7 @@ public void updateMyDataAddress() throws Exception {
Commons.clickWebelement(test, driver, By.xpath("//div[@id='mat-tab-label-0-1']"));


Commons.enter(test, driver, By.id("addressLine1"+BaseClass.envsupportlang()), data);
Commons.enter(test, driver, By.id("addressLine1"+BaseClass.envsupportlang()), Commons.generateRandomAlphabetString());
Commons.dropdown(test, driver, By.id("Region"+BaseClass.envsupportlang()));
Commons.dropdown(test, driver, By.id("Province"+BaseClass.envsupportlang()));
Commons.dropdown(test, driver, By.id("City"+BaseClass.envsupportlang()));
Expand All @@ -74,39 +70,27 @@ public void UpdateDataWithEmail() throws Exception {
LoginTest.loginTest();
test.log(Status.INFO, "Update Email");
Commons.click(test, driver, By.id("uinservices/updatedemographic"));
// Commons.click(test,driver, By.xpath("//span[text()='Demographic Data']"));
Commons.clickWebelement(test, driver, By.xpath("//div[@id='mat-tab-label-0-2']"));

Commons.enter(test, driver, By.id("email"), tempemail1);

Commons.enter(test, driver, By.id("email"), tempemail1);
Commons.clickWebelement(test, driver, By.id("sendOTPemail"));
String otp = MockSMTPListener.getOtp(tempemail1);
System.out.println(otp);
// for(int i=0;i<=otp.length()-1;i++) {
// Commons.enter(driver, By.xpath("//*[@class=\"pincode-input-text\"]["+(i+1)+"]"), Character.toString(otp.charAt(i)));}

Commons.enter(test, driver, By.id("otp-input"), otp);
Commons.enter(test, driver, By.id("otp-input"), otp);
Commons.clickWebelement(test, driver, By.id("submitOtpBtn"));
Commons.clickWebelement(test, driver, By.id("dismissBtn"));

}
public void UpdateDataWithLanguage() throws Exception {
// Lang prefrence
LoginTest.loginTest();
test.log(Status.INFO, "Select Language Preference");
Commons.click(test, driver, By.id("uinservices/updatedemographic"));
// Commons.click(test,driver, By.xpath("//span[text()='Demographic Data']"));
Commons.clickWebelement(test, driver, By.xpath("//div[@id='mat-tab-label-0-3']"));
Commons.dropdown(test, driver, By.id("preferredLang"));
Commons.clickWebelement(test, driver, By.id("submit"));


}





public void UpdateDataWithoutAddressLine() throws Exception {
LoginTest.loginTest();
test = extent.createTest("UpdateDataWithoutAddressLine ", "verify Login");
Expand All @@ -124,8 +108,6 @@ public void UpdateDataWithoutAddressLine() throws Exception {
test.log(Status.INFO, "file Uploaded");
Thread.sleep(2000);
Commons.clickWebelement(test, driver, By.id("previewBtn"));


Commons.clickWebelement(test, driver, By.id("submitBtn"));
Commons.clickWebelement(test, driver, By.id("confirmUpdateData"));
Commons.clickWebelement(test, driver, By.id("updateMyDataBtn"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -389,7 +390,18 @@ public static void clickSpan(WebDriver driver,String key) throws Exception {
logger.info("clickSpan" + var );
}

public static String generateRandomAlphabetString() {
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
Random random = new Random();
StringBuilder stringBuilder = new StringBuilder(15);

for (int i = 0; i < 15; i++) {
int index = random.nextInt(alphabet.length());
stringBuilder.append(alphabet.charAt(index));
}

return stringBuilder.toString();
}



Expand Down

0 comments on commit c02abec

Please sign in to comment.