From 73099384d01da8d50c56dda86410cedcbbfefd5b Mon Sep 17 00:00:00 2001 From: kamalsinghthoughtworks <120381388+kamalsinghthoughtworks@users.noreply.github.com> Date: Thu, 30 Nov 2023 09:57:27 +0530 Subject: [PATCH] MOSIP-30369 | Framework structure change to support device farm execution (#1039) * Test script updated for new apk Signed-off-by: kamalsingh * new test cases added Signed-off-by: kamalsingh * new test cases added from master sheet Signed-off-by: kamalsingh * Test cases added from regression sheet Signed-off-by: kamalsingh * new test cases added Signed-off-by: kamalsingh * automated ios tests for regression Signed-off-by: kamalsingh * conflict resolved Signed-off-by: kamalsingh * framework optimization Signed-off-by: kamalsingh * folder structure changed Signed-off-by: kamalsingh * framework restructure for device farm Signed-off-by: kamalsingh * incorporated review comments Signed-off-by: kamalsingh --------- Signed-off-by: kamalsingh --- injitest/pom.xml | 479 ++++++++++-------- injitest/src/main/assembly/zip.xml | 26 + .../test/mob => }/inji/api/AdminTestUtil.java | 30 +- .../mob => }/inji/api/ApplicationLibrary.java | 6 +- .../test/mob => }/inji/api/BaseTestCase.java | 27 +- .../test/mob => }/inji/api/CommonLibrary.java | 24 +- .../test/mob => }/inji/api/ConfigManager.java | 7 +- .../mob => }/inji/api/GlobalConstants.java | 2 +- .../test/mob => }/inji/api/GlobalMethods.java | 4 +- .../mob => }/inji/api/JsonPrecondtion.java | 7 +- .../inji/api/KernelAuthentication.java | 7 +- .../inji/api/KeycloakUserManager.java | 21 +- .../mob => }/inji/api/MockSMTPListener.java | 19 +- .../inji/api/OutputValidationDto.java | 2 +- .../test/mob => }/inji/api/ReportUtil.java | 2 +- .../test/mob => }/inji/api/RestClient.java | 8 +- .../mosip/test/mob => }/inji/api/pojo/Cc.java | 2 +- .../test/mob => }/inji/api/pojo/From.java | 2 +- .../mob => }/inji/api/pojo/HeaderLine.java | 2 +- .../src/main/java/inji/api/pojo/Headers.java | 4 + .../test/mob => }/inji/api/pojo/Root.java | 2 +- .../mosip/test/mob => }/inji/api/pojo/To.java | 2 +- .../test/mob => }/inji/api/pojo/Value.java | 2 +- .../inji/constants/StringUtilConstants.java | 2 + .../test/mob => }/inji/constants/Target.java | 2 +- .../main/java/inji/driver/DriverManager.java | 81 +++ .../src/main/java/inji/driver/TestRunner.java | 66 +++ .../PlatformNotSupportException.java | 2 +- .../inji/extentReports/ExtentLogger.java | 2 +- .../inji/extentReports/ExtentReport.java | 2 +- .../mob => }/inji/listeners/Listeners.java | 16 +- .../mob => }/inji/pages/AboutInjiPage.java | 4 +- .../mob => }/inji/pages/AddNewCardPage.java | 4 +- .../inji/pages/AppUnlockMethodPage.java | 2 +- .../test/mob => }/inji/pages/BasePage.java | 4 +- .../inji/pages/ChooseLanguagePage.java | 5 +- .../mob => }/inji/pages/ConfirmPasscode.java | 4 +- .../inji/pages/CredentialRegistryPage.java | 2 +- .../inji/pages/DetailedVcViewPage.java | 5 +- .../inji/pages/EnterYourPasscodePage.java | 4 +- .../inji/pages/GenerateUinOrVidPage.java | 2 +- .../pages/HassleFreeAuthenticationPage.java | 2 +- .../test/mob => }/inji/pages/HelpPage.java | 3 +- .../test/mob => }/inji/pages/HistoryPage.java | 10 +- .../test/mob => }/inji/pages/HomePage.java | 2 +- .../mob => }/inji/pages/MoreOptionsPage.java | 2 +- .../inji/pages/OtpVerificationPage.java | 4 +- .../inji/pages/PleaseConfirmPopupPage.java | 2 +- .../mob => }/inji/pages/ReceiveCardPage.java | 4 +- .../mob => }/inji/pages/RetrieveIdPage.java | 5 +- .../test/mob => }/inji/pages/ScanPage.java | 5 +- .../inji/pages/SecureSharingPage.java | 2 +- .../test/mob => }/inji/pages/SetPasscode.java | 4 +- .../mob => }/inji/pages/SettingsPage.java | 3 +- .../inji/pages/TrustedDigitalWalletPage.java | 2 +- .../inji/pages/UnlockApplicationPage.java | 2 +- .../test/mob => }/inji/pages/WelcomePage.java | 2 +- .../java/inji/utils/CapabilitiesReader.java | 44 ++ .../mob => }/inji/utils/CommonMethods.java | 14 +- .../test/mob => }/inji/utils/JsonUtil.java | 20 +- .../mob => }/inji/utils/PropertiesReader.java | 30 +- .../src/main/java/inji/utils/S3Adapter.java | 187 +++++++ .../main/java/inji/utils/ScreenRecording.java | 46 ++ .../src/main/java/inji/utils/StringUtils.java | 2 + .../main/java/inji/utils/TestDataReader.java | 72 +++ .../mosip/test/mob/inji/api/pojo/Headers.java | 4 - .../test/mob/inji/driver/DriverManager.java | 75 --- .../test/mob/inji/driver/TestRunner.java | 71 --- .../test/mob/inji/testcases/BaseTest.java | 48 -- .../test/mob/inji/utils/ScreenRecording.java | 30 -- .../test/mob/inji/utils/TestDataReader.java | 24 - .../main/resources/DesiredCapabilities.json | 29 ++ injitest/src/main/resources/TestData.json | 52 +- injitest/src/main/resources/config.properties | 4 +- .../test/java/BaseTest/AndroidBaseTest.java | 36 ++ injitest/src/test/java/BaseTest/BaseTest.java | 30 ++ .../src/test/java/BaseTest/IosBaseTest.java | 36 ++ .../java/androidTestCases}/AboutInjiTest.java | 18 +- .../java/androidTestCases/ActivateVcTest.java | 173 +++++++ .../androidTestCases/ChangeLanguageTest.java | 123 +++++ .../CredentialRegistryTest.java | 74 ++- .../java/androidTestCases/DeletingVcTest.java | 173 +++++++ .../GenerateUinOrVidTest.java | 99 ++++ .../NoNetworkAndroidTest.java | 356 +++++++++++++ .../test/java/androidTestCases/PinVcTest.java | 105 ++++ .../androidTestCases}/ReceiveCardTest.java | 33 +- .../java/androidTestCases/ShareVcTest.java | 66 +++ .../UnlockWithPasscodeTest.java | 85 ++++ .../VcDownloadAndVerifyUsingUinTest.java | 230 +++++++++ .../VcDownloadAndVerifyUsingVidTest.java | 170 +++++++ .../androidTestCases/VerifyHelpPageTest.java | 49 ++ .../androidTestCases/VerifyHistoryTest.java | 209 ++++++++ .../VerifyWelcomePagesTest.java | 165 ++++++ .../test/java/iosTestCases/AboutInjiTest.java | 46 ++ .../java/iosTestCases}/ActivateVcTest.java | 43 +- .../iosTestCases}/ChangeLanguageTest.java | 27 +- .../java/iosTestCases}/DeletingVcTest.java | 50 +- .../iosTestCases}/GenerateUinOrVidTest.java | 28 +- .../iosTestCases}/NoNetworkAndroidTest.java | 61 +-- .../java/iosTestCases}/PinVcTest.java | 29 +- .../java/iosTestCases/ReceiveCardTest.java | 71 +++ .../java/iosTestCases}/ShareVcTest.java | 19 +- .../iosTestCases}/UnlockWithPasscodeTest.java | 23 +- .../VcDownloadAndVerifyUsingUinTest.java | 48 +- .../VcDownloadAndVerifyUsingVidTest.java | 47 +- .../iosTestCases}/VerifyHelpPageTest.java | 15 +- .../java/iosTestCases}/VerifyHistoryTest.java | 54 +- .../iosTestCases}/VerifyWelcomePagesTest.java | 25 +- injitest/testng.xml | 46 +- 109 files changed, 3569 insertions(+), 995 deletions(-) create mode 100644 injitest/src/main/assembly/zip.xml rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/AdminTestUtil.java (95%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/ApplicationLibrary.java (93%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/BaseTestCase.java (96%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/CommonLibrary.java (95%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/ConfigManager.java (99%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/GlobalConstants.java (93%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/GlobalMethods.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/JsonPrecondtion.java (96%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/KernelAuthentication.java (98%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/KeycloakUserManager.java (98%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/MockSMTPListener.java (94%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/OutputValidationDto.java (98%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/ReportUtil.java (98%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/RestClient.java (98%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/pojo/Cc.java (75%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/pojo/From.java (75%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/pojo/HeaderLine.java (63%) create mode 100644 injitest/src/main/java/inji/api/pojo/Headers.java rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/pojo/Root.java (90%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/pojo/To.java (75%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/api/pojo/Value.java (63%) create mode 100644 injitest/src/main/java/inji/constants/StringUtilConstants.java rename injitest/src/main/java/{io/mosip/test/mob => }/inji/constants/Target.java (51%) create mode 100644 injitest/src/main/java/inji/driver/DriverManager.java create mode 100644 injitest/src/main/java/inji/driver/TestRunner.java rename injitest/src/main/java/{io/mosip/test/mob => }/inji/exceptions/PlatformNotSupportException.java (77%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/extentReports/ExtentLogger.java (89%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/extentReports/ExtentReport.java (96%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/listeners/Listeners.java (77%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/AboutInjiPage.java (93%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/AddNewCardPage.java (92%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/AppUnlockMethodPage.java (96%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/BasePage.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/ChooseLanguagePage.java (91%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/ConfirmPasscode.java (93%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/CredentialRegistryPage.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/DetailedVcViewPage.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/EnterYourPasscodePage.java (91%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/GenerateUinOrVidPage.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/HassleFreeAuthenticationPage.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/HelpPage.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/HistoryPage.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/HomePage.java (99%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/MoreOptionsPage.java (98%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/OtpVerificationPage.java (96%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/PleaseConfirmPopupPage.java (96%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/ReceiveCardPage.java (92%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/RetrieveIdPage.java (94%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/ScanPage.java (93%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/SecureSharingPage.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/SetPasscode.java (94%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/SettingsPage.java (98%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/TrustedDigitalWalletPage.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/UnlockApplicationPage.java (95%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/pages/WelcomePage.java (97%) create mode 100644 injitest/src/main/java/inji/utils/CapabilitiesReader.java rename injitest/src/main/java/{io/mosip/test/mob => }/inji/utils/CommonMethods.java (80%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/utils/JsonUtil.java (97%) rename injitest/src/main/java/{io/mosip/test/mob => }/inji/utils/PropertiesReader.java (62%) create mode 100644 injitest/src/main/java/inji/utils/S3Adapter.java create mode 100644 injitest/src/main/java/inji/utils/ScreenRecording.java create mode 100644 injitest/src/main/java/inji/utils/StringUtils.java create mode 100644 injitest/src/main/java/inji/utils/TestDataReader.java delete mode 100644 injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Headers.java delete mode 100644 injitest/src/main/java/io/mosip/test/mob/inji/driver/DriverManager.java delete mode 100644 injitest/src/main/java/io/mosip/test/mob/inji/driver/TestRunner.java delete mode 100644 injitest/src/main/java/io/mosip/test/mob/inji/testcases/BaseTest.java delete mode 100644 injitest/src/main/java/io/mosip/test/mob/inji/utils/ScreenRecording.java delete mode 100644 injitest/src/main/java/io/mosip/test/mob/inji/utils/TestDataReader.java create mode 100644 injitest/src/main/resources/DesiredCapabilities.json create mode 100644 injitest/src/test/java/BaseTest/AndroidBaseTest.java create mode 100644 injitest/src/test/java/BaseTest/BaseTest.java create mode 100644 injitest/src/test/java/BaseTest/IosBaseTest.java rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/androidTestCases}/AboutInjiTest.java (82%) create mode 100644 injitest/src/test/java/androidTestCases/ActivateVcTest.java create mode 100644 injitest/src/test/java/androidTestCases/ChangeLanguageTest.java rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/androidTestCases}/CredentialRegistryTest.java (92%) create mode 100644 injitest/src/test/java/androidTestCases/DeletingVcTest.java create mode 100644 injitest/src/test/java/androidTestCases/GenerateUinOrVidTest.java create mode 100644 injitest/src/test/java/androidTestCases/NoNetworkAndroidTest.java create mode 100644 injitest/src/test/java/androidTestCases/PinVcTest.java rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/androidTestCases}/ReceiveCardTest.java (81%) create mode 100644 injitest/src/test/java/androidTestCases/ShareVcTest.java create mode 100644 injitest/src/test/java/androidTestCases/UnlockWithPasscodeTest.java create mode 100644 injitest/src/test/java/androidTestCases/VcDownloadAndVerifyUsingUinTest.java create mode 100644 injitest/src/test/java/androidTestCases/VcDownloadAndVerifyUsingVidTest.java create mode 100644 injitest/src/test/java/androidTestCases/VerifyHelpPageTest.java create mode 100644 injitest/src/test/java/androidTestCases/VerifyHistoryTest.java create mode 100644 injitest/src/test/java/androidTestCases/VerifyWelcomePagesTest.java create mode 100644 injitest/src/test/java/iosTestCases/AboutInjiTest.java rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/ActivateVcTest.java (90%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/ChangeLanguageTest.java (90%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/DeletingVcTest.java (88%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/GenerateUinOrVidTest.java (88%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/NoNetworkAndroidTest.java (92%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/PinVcTest.java (87%) create mode 100644 injitest/src/test/java/iosTestCases/ReceiveCardTest.java rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/ShareVcTest.java (87%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/UnlockWithPasscodeTest.java (88%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/VcDownloadAndVerifyUsingUinTest.java (91%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/VcDownloadAndVerifyUsingVidTest.java (86%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/VerifyHelpPageTest.java (83%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/VerifyHistoryTest.java (90%) rename injitest/src/{main/java/io/mosip/test/mob/inji/testcases => test/java/iosTestCases}/VerifyWelcomePagesTest.java (94%) diff --git a/injitest/pom.xml b/injitest/pom.xml index e0e6bb741b..2485b5156c 100644 --- a/injitest/pom.xml +++ b/injitest/pom.xml @@ -1,149 +1,192 @@ - - 4.0.0 - io.mosip.test.mob.inji - injitest - 0.0.1 - inji-mob-automation - inji-mob-automation - https://github.com/mosip/inji/injitest - - - - MPL 2.0 - https://www.mozilla.org/en-US/MPL/2.0/ - - - - scm:git:git://github.com/mosip/admin-ui.git - scm:git:ssh://github.com:mosip/admin-ui.git - https://github.com/mosip/inji/injitest - HEAD - - - - Mosip - mosip.emailnotifier@gmail.com - io.mosip - https://github.com/mosip/inji/injitest - - - - 11 - 11 - - - - - - org.apache.maven.plugins - maven-assembly-plugin - 3.1.1 - - - jar-with-dependencies - - - - true - io.mosip.test.mob.inji.driver.TestRunner - - - - - - make-assembly - package - - single - - - - - - - - - - selenium-tests - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - attach-javadocs - - jar - - - - - none - - - - maven-compiler-plugin - 3.5.1 - - 11 - 11 - -Dfile.encoding=UTF-8 - - - - - org.apache.maven.plugins - maven-source-plugin - true - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12.4 - - - testng.xml - - - - - - - + + 4.0.0 + inji + injitest + 0.0.1 + jar + inji-mob-automation + inji-mob-automation + https://github.com/mosip/inji/injitest + + + MPL 2.0 + https://www.mozilla.org/en-US/MPL/2.0/ + + + + scm:git:git://github.com/mosip/admin-ui.git + scm:git:ssh://github.com:mosip/admin-ui.git + https://github.com/mosip/inji/injitest + HEAD + + + + Mosip + mosip.emailnotifier@gmail.com + io.mosip + https://github.com/mosip/inji/injitest + + + + 11 + 11 + + + + + ${project.basedir}/src/main/resources + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + test-jar + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.10 + + + copy-dependencies + package + + copy-dependencies + + + ${project.build.directory}/dependency-jars/ + + + + + + maven-assembly-plugin + 2.5.4 + + + package + + single + + + zip-with-dependencies + false + + src/main/assembly/zip.xml + + + + + + + + + + selenium-tests + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.10 + + + copy-dependencies + package + + copy-dependencies + + + ${project.build.directory}/dependency-jars/ + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + attach-javadocs + + jar + + + + + none + + + + maven-compiler-plugin + 3.5.1 + + 11 + 11 + -Dfile.encoding=UTF-8 + + + + org.apache.maven.plugins + maven-source-plugin + true + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12.4 + + + testng.xml + + + + + + + @@ -153,16 +196,16 @@ - com.googlecode.json-simple - json-simple - 1.1.1 - - - org.apache.logging.log4j - log4j-api - 2.11.1 - - + com.googlecode.json-simple + json-simple + 1.1.1 + + + org.apache.logging.log4j + log4j-api + 2.11.1 + + org.testng @@ -194,10 +237,10 @@ 2.15.2 - org.jboss.resteasy - resteasy-jaxrs - 3.15.0.Final - + org.jboss.resteasy + resteasy-jaxrs + 3.15.0.Final + org.json json @@ -215,64 +258,68 @@ extentreports 5.1.0 - - - - junit - junit - 3.8.1 - test - - - - io.rest-assured - rest-assured - 5.3.0 - - - org.apache.logging.log4j - log4j-api - 2.11.1 - - - org.slf4j - slf4j-log4j12 - 1.6.2 - - - javax.ws.rs - javax.ws.rs-api - 2.1.1 - - - org.json - json - 20180130 - - - org.keycloak - keycloak-admin-client - 17.0.1 - - - commons-beanutils - commons-beanutils - 1.9.2 - - - - org.apache.commons - commons-collections4 - 4.3 - - - commons-lang - commons-lang - 2.6 - - - - + + + + junit + junit + 3.8.1 + test + + + + io.rest-assured + rest-assured + 5.3.0 + + + org.apache.logging.log4j + log4j-api + 2.11.1 + + + org.slf4j + slf4j-log4j12 + 1.6.2 + + + javax.ws.rs + javax.ws.rs-api + 2.1.1 + + + org.json + json + 20180130 + + + org.keycloak + keycloak-admin-client + 17.0.1 + + + commons-beanutils + commons-beanutils + 1.9.2 + + + + org.apache.commons + commons-collections4 + 4.3 + + + commons-lang + commons-lang + 2.6 + + + + com.amazonaws + aws-java-sdk-s3 + 1.12.597 + + - + \ No newline at end of file diff --git a/injitest/src/main/assembly/zip.xml b/injitest/src/main/assembly/zip.xml new file mode 100644 index 0000000000..4d0ae67a1b --- /dev/null +++ b/injitest/src/main/assembly/zip.xml @@ -0,0 +1,26 @@ + + zip + + zip + + false + + + ${project.build.directory} + ./ + + *.jar + + + + ${project.build.directory} + ./ + + /dependency-jars/ + + + + \ No newline at end of file diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/AdminTestUtil.java b/injitest/src/main/java/inji/api/AdminTestUtil.java similarity index 95% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/AdminTestUtil.java rename to injitest/src/main/java/inji/api/AdminTestUtil.java index f87761c474..c8469dfc87 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/AdminTestUtil.java +++ b/injitest/src/main/java/inji/api/AdminTestUtil.java @@ -1,5 +1,12 @@ -package io.mosip.test.mob.inji.api; +package inji.api; +import io.restassured.response.Response; +import org.apache.commons.lang.RandomStringUtils; +import org.apache.log4j.Logger; +import org.json.JSONArray; +import org.json.JSONObject; + +import javax.ws.rs.core.MediaType; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -7,15 +14,6 @@ import java.util.HashMap; import java.util.TimeZone; -import javax.ws.rs.core.MediaType; - -import org.apache.log4j.Logger; -import org.json.JSONArray; -import org.json.JSONObject; - -import io.restassured.response.Response; -import org.apache.commons.lang.RandomStringUtils; - public class AdminTestUtil extends BaseTestCase { private static final Logger logger = Logger.getLogger(AdminTestUtil.class); @@ -68,9 +66,9 @@ public static boolean activateUIN(String inputJson, String role) { } public static String buildaddIdentityRequestBody(String schemaJson, String uin, String rid) { - org.json.JSONObject schemaresponseJson = new org.json.JSONObject(schemaJson); + JSONObject schemaresponseJson = new JSONObject(schemaJson); - org.json.JSONObject schemaData = (org.json.JSONObject) schemaresponseJson.get("response"); + JSONObject schemaData = (JSONObject) schemaresponseJson.get("response"); Double schemaVersion = (Double) schemaData.get("idVersion"); String schemaJsonData = schemaData.getString("schemaJson"); String schemaFile = schemaJsonData.toString(); @@ -159,21 +157,21 @@ public static int getOtpExpTimeFromActuator() { if (!BaseTestCase.isTargetEnvLTS()) section = "/mosip-config/sandbox/application-lts.properties"; Response response = null; - org.json.JSONObject responseJson = null; + JSONObject responseJson = null; JSONArray responseArray = null; String url = ApplnURI + propsKernel.getProperty("actuatorIDAEndpoint"); try { response = RestClient.getRequest(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON); - responseJson = new org.json.JSONObject(response.getBody().asString()); + responseJson = new JSONObject(response.getBody().asString()); responseArray = responseJson.getJSONArray("propertySources"); for (int i = 0, size = responseArray.length(); i < size; i++) { - org.json.JSONObject eachJson = responseArray.getJSONObject(i); + JSONObject eachJson = responseArray.getJSONObject(i); logger.info("eachJson is :" + eachJson.toString()); if (eachJson.get("name").toString().contains(section)) { - org.json.JSONObject otpExpiryTime = (org.json.JSONObject) eachJson + JSONObject otpExpiryTime = (JSONObject) eachJson .getJSONObject(GlobalConstants.PROPERTIES).get("mosip.kernel.otp.expiry-time"); otpExpTime = otpExpiryTime.getString(GlobalConstants.VALUE); if (ConfigManager.IsDebugEnabled()) diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/ApplicationLibrary.java b/injitest/src/main/java/inji/api/ApplicationLibrary.java similarity index 93% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/ApplicationLibrary.java rename to injitest/src/main/java/inji/api/ApplicationLibrary.java index 9609d0be18..6c0329417b 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/ApplicationLibrary.java +++ b/injitest/src/main/java/inji/api/ApplicationLibrary.java @@ -1,9 +1,9 @@ -package io.mosip.test.mob.inji.api; - -import javax.ws.rs.core.MediaType; +package inji.api; import io.restassured.response.Response; +import javax.ws.rs.core.MediaType; + public class ApplicationLibrary extends BaseTestCase { private static CommonLibrary commonLibrary = new CommonLibrary(); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/BaseTestCase.java b/injitest/src/main/java/inji/api/BaseTestCase.java similarity index 96% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/BaseTestCase.java rename to injitest/src/main/java/inji/api/BaseTestCase.java index 0d094c0762..1f9ddce744 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/BaseTestCase.java +++ b/injitest/src/main/java/inji/api/BaseTestCase.java @@ -1,5 +1,12 @@ -package io.mosip.test.mob.inji.api; +package inji.api; +import inji.driver.TestRunner; +import inji.utils.TestDataReader; +import io.restassured.response.Response; +import org.apache.log4j.PropertyConfigurator; +import org.json.simple.JSONObject; + +import javax.ws.rs.core.MediaType; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -7,15 +14,6 @@ import java.util.Arrays; import java.util.List; import java.util.Properties; -import io.restassured.response.Response; - -import javax.ws.rs.core.MediaType; - -import org.apache.log4j.PropertyConfigurator; -import org.json.simple.JSONObject; - -import io.mosip.test.mob.inji.driver.TestRunner; -import io.mosip.test.mob.inji.utils.TestDataReader; //import org.apache.log4j.Logger; @@ -180,12 +178,13 @@ private static Properties getLoggerPropertyConfig() { logProp.setProperty("log4j.appender.Appender2.layout.ConversionPattern", "%-7p %d [%t] %c %x - %m%n"); return logProp; } - + + //ToDo - Need to address this public static String getOtp() { - String otp=""; + /*String otp=""; String externalemail = TestDataReader.readData("externalemail"); - otp = MockSMTPListener.getOtp(externalemail); - return otp; + otp = MockSMTPListener.getOtp(externalemail);*/ + return "111111"; } public static JSONObject getRequestJson(String filepath) { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/CommonLibrary.java b/injitest/src/main/java/inji/api/CommonLibrary.java similarity index 95% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/CommonLibrary.java rename to injitest/src/main/java/inji/api/CommonLibrary.java index 8a26b86736..70876c4142 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/CommonLibrary.java +++ b/injitest/src/main/java/inji/api/CommonLibrary.java @@ -1,24 +1,18 @@ -package io.mosip.test.mob.inji.api; +package inji.api; -import static io.restassured.RestAssured.given; +import inji.driver.TestRunner; +import io.restassured.http.Cookie; +import io.restassured.response.Response; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.*; import java.util.Map; import java.util.Properties; import java.util.stream.Collectors; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - -import io.mosip.test.mob.inji.driver.TestRunner; -import io.restassured.http.Cookie; -import io.restassured.response.Response; +import static io.restassured.RestAssured.given; public class CommonLibrary extends BaseTestCase { private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(CommonLibrary.class); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/ConfigManager.java b/injitest/src/main/java/inji/api/ConfigManager.java similarity index 99% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/ConfigManager.java rename to injitest/src/main/java/inji/api/ConfigManager.java index 063d498d94..cec929bae1 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/ConfigManager.java +++ b/injitest/src/main/java/inji/api/ConfigManager.java @@ -1,12 +1,13 @@ -package io.mosip.test.mob.inji.api; +package inji.api; + +import inji.driver.TestRunner; +import inji.utils.TestDataReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; -import io.mosip.test.mob.inji.driver.TestRunner; - public class ConfigManager { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/GlobalConstants.java b/injitest/src/main/java/inji/api/GlobalConstants.java similarity index 93% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/GlobalConstants.java rename to injitest/src/main/java/inji/api/GlobalConstants.java index 7d22b22dc7..7d7a9d851d 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/GlobalConstants.java +++ b/injitest/src/main/java/inji/api/GlobalConstants.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.api; +package inji.api; public class GlobalConstants { public static final String EXCEPTION_STRING_2 = "Exception "; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/GlobalMethods.java b/injitest/src/main/java/inji/api/GlobalMethods.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/GlobalMethods.java rename to injitest/src/main/java/inji/api/GlobalMethods.java index 655acd32d2..4be90e7a89 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/GlobalMethods.java +++ b/injitest/src/main/java/inji/api/GlobalMethods.java @@ -1,7 +1,7 @@ -package io.mosip.test.mob.inji.api; -import org.testng.Reporter; +package inji.api; import io.restassured.response.Response; +import org.testng.Reporter; public class GlobalMethods { public static void reportResponse(String responseHeader, String url, Response response) { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/JsonPrecondtion.java b/injitest/src/main/java/inji/api/JsonPrecondtion.java similarity index 96% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/JsonPrecondtion.java rename to injitest/src/main/java/inji/api/JsonPrecondtion.java index e26fc798e8..c36364f13c 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/JsonPrecondtion.java +++ b/injitest/src/main/java/inji/api/JsonPrecondtion.java @@ -1,13 +1,12 @@ -package io.mosip.test.mob.inji.api; +package inji.api; -import org.apache.commons.beanutils.PropertyUtils; - -import org.apache.log4j.Logger; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonParser; +import org.apache.commons.beanutils.PropertyUtils; +import org.apache.log4j.Logger; public class JsonPrecondtion { private static final Logger JSONPRECONDATION_LOGGER = Logger.getLogger(JsonPrecondtion.class); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/KernelAuthentication.java b/injitest/src/main/java/inji/api/KernelAuthentication.java similarity index 98% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/KernelAuthentication.java rename to injitest/src/main/java/inji/api/KernelAuthentication.java index bff2fe4b5d..0d329a2a53 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/KernelAuthentication.java +++ b/injitest/src/main/java/inji/api/KernelAuthentication.java @@ -1,10 +1,9 @@ -package io.mosip.test.mob.inji.api; - -import java.util.Map; +package inji.api; +import io.restassured.response.Response; import org.json.simple.JSONObject; -import io.restassured.response.Response; +import java.util.Map; public class KernelAuthentication extends BaseTestCase { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/KeycloakUserManager.java b/injitest/src/main/java/inji/api/KeycloakUserManager.java similarity index 98% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/KeycloakUserManager.java rename to injitest/src/main/java/inji/api/KeycloakUserManager.java index 72ea52c8a2..7536926867 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/KeycloakUserManager.java +++ b/injitest/src/main/java/inji/api/KeycloakUserManager.java @@ -1,14 +1,7 @@ -package io.mosip.test.mob.inji.api; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import javax.ws.rs.core.Response; +package inji.api; +import inji.driver.TestRunner; +import inji.utils.TestDataReader; import org.keycloak.OAuth2Constants; import org.keycloak.admin.client.CreatedResponseUtil; import org.keycloak.admin.client.Keycloak; @@ -20,7 +13,13 @@ import org.keycloak.representations.idm.RoleRepresentation; import org.keycloak.representations.idm.UserRepresentation; -import io.mosip.test.mob.inji.driver.TestRunner; +import javax.ws.rs.core.Response; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; public class KeycloakUserManager { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/MockSMTPListener.java b/injitest/src/main/java/inji/api/MockSMTPListener.java similarity index 94% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/MockSMTPListener.java rename to injitest/src/main/java/inji/api/MockSMTPListener.java index 7d748deba4..f518493e90 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/MockSMTPListener.java +++ b/injitest/src/main/java/inji/api/MockSMTPListener.java @@ -1,4 +1,9 @@ -package io.mosip.test.mob.inji.api; +package inji.api; + +import com.fasterxml.jackson.databind.ObjectMapper; +import inji.api.pojo.Root; +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; import java.net.URI; import java.net.http.HttpClient; @@ -11,10 +16,6 @@ import java.util.concurrent.CompletionStage; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang3.StringUtils; -import org.apache.log4j.Logger; -import com.fasterxml.jackson.databind.ObjectMapper; -import io.mosip.test.mob.inji.api.pojo.Root; public class MockSMTPListener{ @@ -45,7 +46,7 @@ public void run() { } - private static class WebSocketClient implements WebSocket.Listener { + private static class WebSocketClient implements Listener { Long count = (long) 00; Root root = new Root(); @@ -57,7 +58,7 @@ public WebSocketClient() { @Override public void onOpen(WebSocket webSocket) { logger.info("onOpen using subprotocol " + webSocket.getSubprotocol()); - WebSocket.Listener.super.onOpen(webSocket); + Listener.super.onOpen(webSocket); } @Override @@ -91,7 +92,7 @@ public CompletionStage onText(WebSocket webSocket, CharSequence data, boolean logger.error(e.getMessage()); } - return WebSocket.Listener.super.onText(webSocket, data, last); + return Listener.super.onText(webSocket, data, last); } @Override @@ -99,7 +100,7 @@ public void onError(WebSocket webSocket, Throwable error) { logger.info("Bad day! " + webSocket.toString()); logger.error(error.getMessage()); - WebSocket.Listener.super.onError(webSocket, error); + Listener.super.onError(webSocket, error); } } diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/OutputValidationDto.java b/injitest/src/main/java/inji/api/OutputValidationDto.java similarity index 98% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/OutputValidationDto.java rename to injitest/src/main/java/inji/api/OutputValidationDto.java index 310b8ab1f2..8f4ea6e76f 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/OutputValidationDto.java +++ b/injitest/src/main/java/inji/api/OutputValidationDto.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.api; +package inji.api; public class OutputValidationDto { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/ReportUtil.java b/injitest/src/main/java/inji/api/ReportUtil.java similarity index 98% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/ReportUtil.java rename to injitest/src/main/java/inji/api/ReportUtil.java index 1691139d12..26399ffe92 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/ReportUtil.java +++ b/injitest/src/main/java/inji/api/ReportUtil.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.api; +package inji.api; import java.util.List; import java.util.Map; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/RestClient.java b/injitest/src/main/java/inji/api/RestClient.java similarity index 98% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/RestClient.java rename to injitest/src/main/java/inji/api/RestClient.java index eb048f632b..49cfca0efd 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/RestClient.java +++ b/injitest/src/main/java/inji/api/RestClient.java @@ -1,12 +1,12 @@ -package io.mosip.test.mob.inji.api; - -import org.testng.log4testng.Logger; -import static io.restassured.RestAssured.given; +package inji.api; import io.restassured.RestAssured; import io.restassured.config.HttpClientConfig; import io.restassured.config.RestAssuredConfig; import io.restassured.response.Response; +import org.testng.log4testng.Logger; + +import static io.restassured.RestAssured.given; public class RestClient { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Cc.java b/injitest/src/main/java/inji/api/pojo/Cc.java similarity index 75% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Cc.java rename to injitest/src/main/java/inji/api/pojo/Cc.java index 66de2db0b3..e1e17ca869 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Cc.java +++ b/injitest/src/main/java/inji/api/pojo/Cc.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.api.pojo; +package inji.api.pojo; import java.util.ArrayList; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/From.java b/injitest/src/main/java/inji/api/pojo/From.java similarity index 75% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/From.java rename to injitest/src/main/java/inji/api/pojo/From.java index 114f572c4c..e25fff9244 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/From.java +++ b/injitest/src/main/java/inji/api/pojo/From.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.api.pojo; +package inji.api.pojo; import java.util.ArrayList; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/HeaderLine.java b/injitest/src/main/java/inji/api/pojo/HeaderLine.java similarity index 63% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/HeaderLine.java rename to injitest/src/main/java/inji/api/pojo/HeaderLine.java index 2344b3bfa6..1fefdde743 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/HeaderLine.java +++ b/injitest/src/main/java/inji/api/pojo/HeaderLine.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.api.pojo; +package inji.api.pojo; public class HeaderLine{ public String key; diff --git a/injitest/src/main/java/inji/api/pojo/Headers.java b/injitest/src/main/java/inji/api/pojo/Headers.java new file mode 100644 index 0000000000..3b16d072d6 --- /dev/null +++ b/injitest/src/main/java/inji/api/pojo/Headers.java @@ -0,0 +1,4 @@ +package inji.api.pojo; + +public class Headers{ +} \ No newline at end of file diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Root.java b/injitest/src/main/java/inji/api/pojo/Root.java similarity index 90% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Root.java rename to injitest/src/main/java/inji/api/pojo/Root.java index 5c78a3124e..2a7789aa6a 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Root.java +++ b/injitest/src/main/java/inji/api/pojo/Root.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.api.pojo; +package inji.api.pojo; import java.util.ArrayList; import java.util.Date; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/To.java b/injitest/src/main/java/inji/api/pojo/To.java similarity index 75% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/To.java rename to injitest/src/main/java/inji/api/pojo/To.java index e0f932658b..103f61870a 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/To.java +++ b/injitest/src/main/java/inji/api/pojo/To.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.api.pojo; +package inji.api.pojo; import java.util.ArrayList; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Value.java b/injitest/src/main/java/inji/api/pojo/Value.java similarity index 63% rename from injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Value.java rename to injitest/src/main/java/inji/api/pojo/Value.java index 3b68422479..0014a85e5d 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Value.java +++ b/injitest/src/main/java/inji/api/pojo/Value.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.api.pojo; +package inji.api.pojo; public class Value{ public String address; diff --git a/injitest/src/main/java/inji/constants/StringUtilConstants.java b/injitest/src/main/java/inji/constants/StringUtilConstants.java new file mode 100644 index 0000000000..66d26003a6 --- /dev/null +++ b/injitest/src/main/java/inji/constants/StringUtilConstants.java @@ -0,0 +1,2 @@ +package inji.constants;public enum StringUtilConstants { +} diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/constants/Target.java b/injitest/src/main/java/inji/constants/Target.java similarity index 51% rename from injitest/src/main/java/io/mosip/test/mob/inji/constants/Target.java rename to injitest/src/main/java/inji/constants/Target.java index a5ac7e6f8e..52084ff1af 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/constants/Target.java +++ b/injitest/src/main/java/inji/constants/Target.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.constants; +package inji.constants; public enum Target { ANDROID, diff --git a/injitest/src/main/java/inji/driver/DriverManager.java b/injitest/src/main/java/inji/driver/DriverManager.java new file mode 100644 index 0000000000..cc225bbc58 --- /dev/null +++ b/injitest/src/main/java/inji/driver/DriverManager.java @@ -0,0 +1,81 @@ +package inji.driver; + +import inji.constants.Target; +import inji.exceptions.PlatformNotSupportException; +import inji.utils.CapabilitiesReader; +import inji.utils.PropertiesReader; +import io.appium.java_client.AppiumDriver; +import io.appium.java_client.android.AndroidDriver; +import io.appium.java_client.ios.IOSDriver; +import io.appium.java_client.service.local.AppiumDriverLocalService; +import io.appium.java_client.service.local.AppiumServiceBuilder; +import io.appium.java_client.service.local.flags.GeneralServerFlag; +import org.openqa.selenium.remote.DesiredCapabilities; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; + +public class DriverManager { + private static ThreadLocal platform = new ThreadLocal<>(); + private static ThreadLocal appiumDriver = new ThreadLocal<>(); + private static AppiumDriverLocalService service = null; + + private static AppiumDriver getAndroidDriver(Boolean isDeviceFarmRun) { + if (isDeviceFarmRun) { + DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); + try { + appiumDriver.set(new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), desiredCapabilities)); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } else { + DesiredCapabilities desiredCapabilities = CapabilitiesReader.getDesiredCapabilities("androidDevice", "src/main/resources/DesiredCapabilities.json"); + appiumDriver.set(new AndroidDriver(service.getUrl(), desiredCapabilities)); + } + return appiumDriver.get(); + } + + private static AppiumDriver getIosDriver(Boolean isDeviceFarmRun) { + if (isDeviceFarmRun) { + DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); + try { + appiumDriver.set(new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), desiredCapabilities)); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } else { + DesiredCapabilities desiredCapabilities = CapabilitiesReader.getDesiredCapabilities("iosDevice", "src/main/resources/DesiredCapabilities.json"); + appiumDriver.set(new AndroidDriver(service.getUrl(), desiredCapabilities)); + } + return appiumDriver.get(); + } + + public static AppiumDriver getDriver(Target target, Boolean isDeviceFarmRun) throws MalformedURLException, PlatformNotSupportException, InterruptedException { + platform.set(target); + switch (target) { + case ANDROID: + return getAndroidDriver(isDeviceFarmRun); + case IOS: + return getIosDriver(isDeviceFarmRun); + } + throw new PlatformNotSupportException("Please provide supported OS"); + } + + public static void startAppiumServer() { + PropertiesReader propertiesReader = new PropertiesReader(); + String ipAddress = System.getProperty("ipAddress") != null ? System.getProperty("ipAddress") : propertiesReader.getIpAddress(); + AppiumServiceBuilder builder = new AppiumServiceBuilder().withAppiumJS(new File(propertiesReader.getAppiumServerExecutable())).usingDriverExecutable(new File(propertiesReader.getNodePath())).withIPAddress(ipAddress).usingAnyFreePort().withArgument(GeneralServerFlag.LOCAL_TIMEZONE).withLogFile(new File(propertiesReader.getAppiumLogFilePath())); + service = AppiumDriverLocalService.buildService(builder); + service.start(); + } + + public static void stopAppiumServer() { + if (service != null) + service.stop(); + } + + public static Target getPlatform() { + return platform.get(); + } +} diff --git a/injitest/src/main/java/inji/driver/TestRunner.java b/injitest/src/main/java/inji/driver/TestRunner.java new file mode 100644 index 0000000000..c6dc986bf1 --- /dev/null +++ b/injitest/src/main/java/inji/driver/TestRunner.java @@ -0,0 +1,66 @@ +package inji.driver; + + +import inji.api.BaseTestCase; +import org.testng.TestListenerAdapter; +import org.testng.TestNG; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + + +public class TestRunner { + public static String jarUrl = TestRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath(); + + static TestListenerAdapter tla = new TestListenerAdapter(); + + + public static void main(String[] args) throws Exception { + //BaseTestCase.intiateUINGenration(); + startTestRunner(); + } + + public static String getResourcePath() { + if (checkRunType().equalsIgnoreCase("JAR")) + return (new File(jarUrl)).getParentFile().getAbsolutePath().toString() + "/resources/"; + if (checkRunType().equalsIgnoreCase("IDE")) { + String path = System.getProperty("user.dir") + "/src/test/resources"; + if (path.contains("test-classes")) + path = path.replace("test-classes", "classes"); + return path; + } + return "Global Resource File Path Not Found"; + } + + public static String checkRunType() { + if (TestRunner.class.getResource("TestRunner.class").getPath().toString().contains(".jar")) + return "JAR"; + return "IDE"; + } + + public static void startTestRunner() { + File homeDir = null; + TestNG runner = new TestNG(); + List suitefiles = new ArrayList<>(); + String os = System.getProperty("os.name"); + homeDir = new File(System.getProperty("user.dir") + "/testng.xml"); + suitefiles.add(homeDir.getAbsolutePath()); + runner.setTestSuites(suitefiles); + System.getProperties().setProperty("testng.outpur.dir", "testng-report"); + runner.setOutputDirectory("testng-report"); + runner.run(); + } + + public static String GetKernalFilename() { + String path = System.getProperty("env.user"); + String kernalpath = null; + if (System.getProperty("env.user") == null) { + kernalpath = "Kernel.properties"; + + } else { + kernalpath = "Kernel_" + path + ".properties"; + } + return kernalpath; + } +} \ No newline at end of file diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/exceptions/PlatformNotSupportException.java b/injitest/src/main/java/inji/exceptions/PlatformNotSupportException.java similarity index 77% rename from injitest/src/main/java/io/mosip/test/mob/inji/exceptions/PlatformNotSupportException.java rename to injitest/src/main/java/inji/exceptions/PlatformNotSupportException.java index b12a89e5c1..31fb258f7d 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/exceptions/PlatformNotSupportException.java +++ b/injitest/src/main/java/inji/exceptions/PlatformNotSupportException.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.exceptions; +package inji.exceptions; public class PlatformNotSupportException extends Exception{ public PlatformNotSupportException(String message) { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/extentReports/ExtentLogger.java b/injitest/src/main/java/inji/extentReports/ExtentLogger.java similarity index 89% rename from injitest/src/main/java/io/mosip/test/mob/inji/extentReports/ExtentLogger.java rename to injitest/src/main/java/inji/extentReports/ExtentLogger.java index fbf0c9cb63..3725ddea7d 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/extentReports/ExtentLogger.java +++ b/injitest/src/main/java/inji/extentReports/ExtentLogger.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.extentReports; +package inji.extentReports; public final class ExtentLogger { private ExtentLogger() { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/extentReports/ExtentReport.java b/injitest/src/main/java/inji/extentReports/ExtentReport.java similarity index 96% rename from injitest/src/main/java/io/mosip/test/mob/inji/extentReports/ExtentReport.java rename to injitest/src/main/java/inji/extentReports/ExtentReport.java index 0d13795b85..8e76411eb1 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/extentReports/ExtentReport.java +++ b/injitest/src/main/java/inji/extentReports/ExtentReport.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.extentReports; +package inji.extentReports; import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/listeners/Listeners.java b/injitest/src/main/java/inji/listeners/Listeners.java similarity index 77% rename from injitest/src/main/java/io/mosip/test/mob/inji/listeners/Listeners.java rename to injitest/src/main/java/inji/listeners/Listeners.java index d4682e8dbc..af17bb2c8f 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/listeners/Listeners.java +++ b/injitest/src/main/java/inji/listeners/Listeners.java @@ -1,13 +1,9 @@ -package io.mosip.test.mob.inji.listeners; - -import io.mosip.test.mob.inji.driver.DriverManager; -import io.mosip.test.mob.inji.extentReports.ExtentLogger; -import io.mosip.test.mob.inji.extentReports.ExtentReport; -import org.testng.ISuite; -import org.testng.ISuiteListener; -import org.testng.ITestContext; -import org.testng.ITestListener; -import org.testng.ITestResult; +package inji.listeners; + +import inji.driver.DriverManager; +import inji.extentReports.ExtentLogger; +import inji.extentReports.ExtentReport; +import org.testng.*; public class Listeners implements ITestListener, ISuiteListener { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/AboutInjiPage.java b/injitest/src/main/java/inji/pages/AboutInjiPage.java similarity index 93% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/AboutInjiPage.java rename to injitest/src/main/java/inji/pages/AboutInjiPage.java index 9ab226c825..72f8695561 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/AboutInjiPage.java +++ b/injitest/src/main/java/inji/pages/AboutInjiPage.java @@ -1,10 +1,10 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import org.openqa.selenium.WebElement; -public class AboutInjiPage extends BasePage{ +public class AboutInjiPage extends BasePage { @AndroidFindBy(accessibility = "aboutInji") private WebElement aboutInjiHeader; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/AddNewCardPage.java b/injitest/src/main/java/inji/pages/AddNewCardPage.java similarity index 92% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/AddNewCardPage.java rename to injitest/src/main/java/inji/pages/AddNewCardPage.java index 9741ff7289..aef6f6c6c3 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/AddNewCardPage.java +++ b/injitest/src/main/java/inji/pages/AddNewCardPage.java @@ -1,11 +1,11 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; import org.openqa.selenium.WebElement; -public class AddNewCardPage extends BasePage{ +public class AddNewCardPage extends BasePage { @AndroidFindBy(accessibility = "issuersScreenHeader") @iOSXCUITFindBy(accessibility = "title") diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/AppUnlockMethodPage.java b/injitest/src/main/java/inji/pages/AppUnlockMethodPage.java similarity index 96% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/AppUnlockMethodPage.java rename to injitest/src/main/java/inji/pages/AppUnlockMethodPage.java index 24a2dd7853..4521829874 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/AppUnlockMethodPage.java +++ b/injitest/src/main/java/inji/pages/AppUnlockMethodPage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/BasePage.java b/injitest/src/main/java/inji/pages/BasePage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/BasePage.java rename to injitest/src/main/java/inji/pages/BasePage.java index a3341e36d3..870d6abe7b 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/BasePage.java +++ b/injitest/src/main/java/inji/pages/BasePage.java @@ -1,8 +1,8 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; -import io.mosip.test.mob.inji.extentReports.ExtentLogger; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AppiumFieldDecorator; +import inji.extentReports.ExtentLogger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.PageFactory; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/ChooseLanguagePage.java b/injitest/src/main/java/inji/pages/ChooseLanguagePage.java similarity index 91% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/ChooseLanguagePage.java rename to injitest/src/main/java/inji/pages/ChooseLanguagePage.java index c8470fca88..0a18e6b33b 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/ChooseLanguagePage.java +++ b/injitest/src/main/java/inji/pages/ChooseLanguagePage.java @@ -1,10 +1,9 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; -import io.mosip.test.mob.inji.utils.CommonMethods; - +import inji.utils.CommonMethods; import org.openqa.selenium.WebElement; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/ConfirmPasscode.java b/injitest/src/main/java/inji/pages/ConfirmPasscode.java similarity index 93% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/ConfirmPasscode.java rename to injitest/src/main/java/inji/pages/ConfirmPasscode.java index 08991eb126..1542595e29 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/ConfirmPasscode.java +++ b/injitest/src/main/java/inji/pages/ConfirmPasscode.java @@ -1,9 +1,9 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; -import io.mosip.test.mob.inji.constants.Target; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; +import inji.constants.Target; import org.openqa.selenium.WebElement; public class ConfirmPasscode extends BasePage { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/CredentialRegistryPage.java b/injitest/src/main/java/inji/pages/CredentialRegistryPage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/CredentialRegistryPage.java rename to injitest/src/main/java/inji/pages/CredentialRegistryPage.java index 5ff13321b6..11e82fd1f1 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/CredentialRegistryPage.java +++ b/injitest/src/main/java/inji/pages/CredentialRegistryPage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/DetailedVcViewPage.java b/injitest/src/main/java/inji/pages/DetailedVcViewPage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/DetailedVcViewPage.java rename to injitest/src/main/java/inji/pages/DetailedVcViewPage.java index 400300f181..ba4c4ee94e 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/DetailedVcViewPage.java +++ b/injitest/src/main/java/inji/pages/DetailedVcViewPage.java @@ -1,12 +1,11 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; -import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -public class DetailedVcViewPage extends BasePage{ +public class DetailedVcViewPage extends BasePage { @AndroidFindBy(xpath = "//*[contains(@text,'ID Details')]") @iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeStaticText[`label == \"ID Details\"`]") private WebElement detailedVcViewPageTitle; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/EnterYourPasscodePage.java b/injitest/src/main/java/inji/pages/EnterYourPasscodePage.java similarity index 91% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/EnterYourPasscodePage.java rename to injitest/src/main/java/inji/pages/EnterYourPasscodePage.java index 2e10208f52..9f2935ad61 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/EnterYourPasscodePage.java +++ b/injitest/src/main/java/inji/pages/EnterYourPasscodePage.java @@ -1,9 +1,9 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; -import io.mosip.test.mob.inji.constants.Target; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; +import inji.constants.Target; import org.openqa.selenium.WebElement; public class EnterYourPasscodePage extends BasePage { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/GenerateUinOrVidPage.java b/injitest/src/main/java/inji/pages/GenerateUinOrVidPage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/GenerateUinOrVidPage.java rename to injitest/src/main/java/inji/pages/GenerateUinOrVidPage.java index 67d5549b5b..bfed9961df 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/GenerateUinOrVidPage.java +++ b/injitest/src/main/java/inji/pages/GenerateUinOrVidPage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/HassleFreeAuthenticationPage.java b/injitest/src/main/java/inji/pages/HassleFreeAuthenticationPage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/HassleFreeAuthenticationPage.java rename to injitest/src/main/java/inji/pages/HassleFreeAuthenticationPage.java index 0fac446719..35bd84865f 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/HassleFreeAuthenticationPage.java +++ b/injitest/src/main/java/inji/pages/HassleFreeAuthenticationPage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/HelpPage.java b/injitest/src/main/java/inji/pages/HelpPage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/HelpPage.java rename to injitest/src/main/java/inji/pages/HelpPage.java index 0c5378caf5..27a646390c 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/HelpPage.java +++ b/injitest/src/main/java/inji/pages/HelpPage.java @@ -1,9 +1,8 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; - import org.openqa.selenium.WebElement; public class HelpPage extends BasePage { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/HistoryPage.java b/injitest/src/main/java/inji/pages/HistoryPage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/HistoryPage.java rename to injitest/src/main/java/inji/pages/HistoryPage.java index 6b5ce2f0ff..2b70216eb5 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/HistoryPage.java +++ b/injitest/src/main/java/inji/pages/HistoryPage.java @@ -1,14 +1,16 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; -import io.mosip.test.mob.inji.constants.Target; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; +import inji.constants.Target; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; import java.util.List; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; +import static inji.constants.Target.ANDROID; +import static inji.constants.Target.IOS; public class HistoryPage extends BasePage { @AndroidFindBy(xpath = "//*[contains(@text,'History')]") diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/HomePage.java b/injitest/src/main/java/inji/pages/HomePage.java similarity index 99% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/HomePage.java rename to injitest/src/main/java/inji/pages/HomePage.java index d51913622b..05f127615b 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/HomePage.java +++ b/injitest/src/main/java/inji/pages/HomePage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/MoreOptionsPage.java b/injitest/src/main/java/inji/pages/MoreOptionsPage.java similarity index 98% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/MoreOptionsPage.java rename to injitest/src/main/java/inji/pages/MoreOptionsPage.java index b5a74017cc..2209e79ce0 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/MoreOptionsPage.java +++ b/injitest/src/main/java/inji/pages/MoreOptionsPage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/OtpVerificationPage.java b/injitest/src/main/java/inji/pages/OtpVerificationPage.java similarity index 96% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/OtpVerificationPage.java rename to injitest/src/main/java/inji/pages/OtpVerificationPage.java index 015a967e22..63ccc0112a 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/OtpVerificationPage.java +++ b/injitest/src/main/java/inji/pages/OtpVerificationPage.java @@ -1,9 +1,9 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; -import io.mosip.test.mob.inji.constants.Target; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; +import inji.constants.Target; import org.openqa.selenium.WebElement; public class OtpVerificationPage extends BasePage { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/PleaseConfirmPopupPage.java b/injitest/src/main/java/inji/pages/PleaseConfirmPopupPage.java similarity index 96% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/PleaseConfirmPopupPage.java rename to injitest/src/main/java/inji/pages/PleaseConfirmPopupPage.java index e0466c3689..69a7cf3a3e 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/PleaseConfirmPopupPage.java +++ b/injitest/src/main/java/inji/pages/PleaseConfirmPopupPage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/ReceiveCardPage.java b/injitest/src/main/java/inji/pages/ReceiveCardPage.java similarity index 92% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/ReceiveCardPage.java rename to injitest/src/main/java/inji/pages/ReceiveCardPage.java index dd91b6c3c8..25400709a8 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/ReceiveCardPage.java +++ b/injitest/src/main/java/inji/pages/ReceiveCardPage.java @@ -1,9 +1,7 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; -import io.mosip.test.mob.inji.constants.Target; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; -import io.appium.java_client.pagefactory.iOSXCUITFindBy; import org.openqa.selenium.WebElement; public class ReceiveCardPage extends BasePage { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/RetrieveIdPage.java b/injitest/src/main/java/inji/pages/RetrieveIdPage.java similarity index 94% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/RetrieveIdPage.java rename to injitest/src/main/java/inji/pages/RetrieveIdPage.java index be9db62ae6..03329af1b8 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/RetrieveIdPage.java +++ b/injitest/src/main/java/inji/pages/RetrieveIdPage.java @@ -1,9 +1,9 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; -import io.mosip.test.mob.inji.constants.Target; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; +import inji.constants.Target; import org.openqa.selenium.WebElement; @@ -21,7 +21,6 @@ public class RetrieveIdPage extends BasePage { private WebElement generateCardButton; @iOSXCUITFindBy(className = "XCUIElementTypePickerWheel") - @iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeStaticText[`label == \"UIN invalid\"`]") private WebElement vidDropDownValueIos; @AndroidFindBy(xpath = "//*[contains(@text,'VID')]") diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/ScanPage.java b/injitest/src/main/java/inji/pages/ScanPage.java similarity index 93% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/ScanPage.java rename to injitest/src/main/java/inji/pages/ScanPage.java index f7334e8307..27347fbb37 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/ScanPage.java +++ b/injitest/src/main/java/inji/pages/ScanPage.java @@ -1,11 +1,10 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; -import io.appium.java_client.pagefactory.iOSXCUITFindBy; import org.openqa.selenium.WebElement; -public class ScanPage extends BasePage{ +public class ScanPage extends BasePage { @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"com.android.permissioncontroller:id/permission_allow_foreground_only_button\")") private WebElement allowPermissionPopupButton; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/SecureSharingPage.java b/injitest/src/main/java/inji/pages/SecureSharingPage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/SecureSharingPage.java rename to injitest/src/main/java/inji/pages/SecureSharingPage.java index 6c627f23c6..a24f2d1018 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/SecureSharingPage.java +++ b/injitest/src/main/java/inji/pages/SecureSharingPage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/SetPasscode.java b/injitest/src/main/java/inji/pages/SetPasscode.java similarity index 94% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/SetPasscode.java rename to injitest/src/main/java/inji/pages/SetPasscode.java index b85684d9f2..cfc3bb7cc5 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/SetPasscode.java +++ b/injitest/src/main/java/inji/pages/SetPasscode.java @@ -1,11 +1,11 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; +import inji.constants.Target; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import io.mosip.test.mob.inji.constants.Target; public class SetPasscode extends BasePage { diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/SettingsPage.java b/injitest/src/main/java/inji/pages/SettingsPage.java similarity index 98% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/SettingsPage.java rename to injitest/src/main/java/inji/pages/SettingsPage.java index ec2a8c4771..8c243dfdf4 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/SettingsPage.java +++ b/injitest/src/main/java/inji/pages/SettingsPage.java @@ -1,11 +1,10 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; import org.openqa.selenium.WebElement; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/TrustedDigitalWalletPage.java b/injitest/src/main/java/inji/pages/TrustedDigitalWalletPage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/TrustedDigitalWalletPage.java rename to injitest/src/main/java/inji/pages/TrustedDigitalWalletPage.java index 327b6d7e52..95e255f706 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/TrustedDigitalWalletPage.java +++ b/injitest/src/main/java/inji/pages/TrustedDigitalWalletPage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/UnlockApplicationPage.java b/injitest/src/main/java/inji/pages/UnlockApplicationPage.java similarity index 95% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/UnlockApplicationPage.java rename to injitest/src/main/java/inji/pages/UnlockApplicationPage.java index a06577097f..6ca813a61e 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/UnlockApplicationPage.java +++ b/injitest/src/main/java/inji/pages/UnlockApplicationPage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/pages/WelcomePage.java b/injitest/src/main/java/inji/pages/WelcomePage.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/pages/WelcomePage.java rename to injitest/src/main/java/inji/pages/WelcomePage.java index 535ebe460c..dce185b5f6 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/pages/WelcomePage.java +++ b/injitest/src/main/java/inji/pages/WelcomePage.java @@ -1,4 +1,4 @@ -package io.mosip.test.mob.inji.pages; +package inji.pages; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; diff --git a/injitest/src/main/java/inji/utils/CapabilitiesReader.java b/injitest/src/main/java/inji/utils/CapabilitiesReader.java new file mode 100644 index 0000000000..d96ad4e5a7 --- /dev/null +++ b/injitest/src/main/java/inji/utils/CapabilitiesReader.java @@ -0,0 +1,44 @@ +package inji.utils; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.openqa.selenium.remote.DesiredCapabilities; + +import java.io.FileReader; +import java.util.HashMap; + +public class CapabilitiesReader { + private static JSONArray parseJSON(String jsonLocation) throws Exception { + JSONParser jsonParser = new JSONParser(); + return (JSONArray) jsonParser.parse(new FileReader(jsonLocation)); + } + + private static JSONObject getCapability(String capabilityName, String jsonLocation) throws Exception { + JSONArray capabilitiesArray = parseJSON(jsonLocation); + for (Object jsonObj : capabilitiesArray) { + JSONObject capability = (JSONObject) jsonObj; + if (capability.get("name").toString().equalsIgnoreCase(capabilityName)) { + return (JSONObject) capability.get("caps"); + } + } + return null; + } + + private static HashMap convertCapsToHashMap(String capabilityName, String jsonLocation) throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.readValue(getCapability(capabilityName, jsonLocation).toString(), HashMap.class); + } + + public static DesiredCapabilities getDesiredCapabilities(String capabilityName, String capsContentRootLocation) { + String jsonLocation = System.getProperty("user.dir") + "/" + capsContentRootLocation; + HashMap caps = null; + try { + caps = convertCapsToHashMap(capabilityName, jsonLocation); + } catch (Exception e) { + throw new RuntimeException(e); + } + return new DesiredCapabilities(caps); + } +} diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/utils/CommonMethods.java b/injitest/src/main/java/inji/utils/CommonMethods.java similarity index 80% rename from injitest/src/main/java/io/mosip/test/mob/inji/utils/CommonMethods.java rename to injitest/src/main/java/inji/utils/CommonMethods.java index fe53af2bfa..c27d8a4f4f 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/utils/CommonMethods.java +++ b/injitest/src/main/java/inji/utils/CommonMethods.java @@ -1,7 +1,7 @@ -package io.mosip.test.mob.inji.utils; +package inji.utils; -import io.mosip.test.mob.inji.driver.DriverManager; -import io.mosip.test.mob.inji.exceptions.PlatformNotSupportException; +import inji.driver.DriverManager; +import inji.exceptions.PlatformNotSupportException; import org.openqa.selenium.OutputType; import java.io.IOException; @@ -9,14 +9,6 @@ public class CommonMethods { - public String getBase64Image() { - try { - return DriverManager.getDriver(DriverManager.getPlatform()).getScreenshotAs(OutputType.BASE64); - } catch (MalformedURLException | PlatformNotSupportException | InterruptedException e) { - throw new RuntimeException(e); - } - } - public static void invokeAppFromBackGroundAndroid() { try { ProcessBuilder processBuilder = new ProcessBuilder("/bin/bash", "-c", "adb shell am start -n io.mosip.residentapp/io.mosip.residentapp.MainActivity"); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/utils/JsonUtil.java b/injitest/src/main/java/inji/utils/JsonUtil.java similarity index 97% rename from injitest/src/main/java/io/mosip/test/mob/inji/utils/JsonUtil.java rename to injitest/src/main/java/inji/utils/JsonUtil.java index 2b7347ef87..e8c9d4ccbb 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/utils/JsonUtil.java +++ b/injitest/src/main/java/inji/utils/JsonUtil.java @@ -1,4 +1,12 @@ -package io.mosip.test.mob.inji.utils; +package inji.utils; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import inji.driver.TestRunner; +import org.apache.commons.io.IOUtils; +import org.json.JSONArray; +import org.json.JSONObject; import java.io.File; import java.io.FileInputStream; @@ -7,16 +15,6 @@ import java.util.LinkedList; import java.util.List; -import org.apache.commons.io.IOUtils; -import org.json.JSONArray; -import org.json.JSONObject; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import io.mosip.test.mob.inji.driver.TestRunner; - public class JsonUtil { private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(JsonUtil.class); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/utils/PropertiesReader.java b/injitest/src/main/java/inji/utils/PropertiesReader.java similarity index 62% rename from injitest/src/main/java/io/mosip/test/mob/inji/utils/PropertiesReader.java rename to injitest/src/main/java/inji/utils/PropertiesReader.java index 25b2f7e6d1..db962fefd2 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/utils/PropertiesReader.java +++ b/injitest/src/main/java/inji/utils/PropertiesReader.java @@ -1,14 +1,16 @@ -package io.mosip.test.mob.inji.utils; +package inji.utils; +import inji.driver.TestRunner; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Objects; import java.util.Properties; -import io.mosip.test.mob.inji.driver.TestRunner; - public class PropertiesReader { - private static final String PROPERTY_FILE = TestRunner.getResourcePath()+"/config.properties"; + private static final String PROPERTY_FILE = System.getProperty("user.dir") + "/src/main/resources/config.properties"; private final Properties props; @@ -18,14 +20,16 @@ public PropertiesReader() { private Properties loadPropertyFile() { Properties properties = new Properties(); - try (InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(PROPERTY_FILE)) { - if (stream != null) { - properties.load(stream); - } else { - throw new IOException("Property file not found: " + PROPERTY_FILE); - } + InputStream input = null; + try { + input = new FileInputStream(PROPERTY_FILE); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } + try { + properties.load(input); } catch (IOException e) { - throw new RuntimeException("Error loading properties file: " + e.getMessage(), e); + throw new RuntimeException(e); } return properties; } @@ -53,4 +57,8 @@ public String getAppiumServerExecutable() { public String getAppiumLogFilePath() { return getProperty("appiumLogFilePath"); } + + public String getAppiumServerStartStatus() { + return getProperty("startAppiumServer"); + } } diff --git a/injitest/src/main/java/inji/utils/S3Adapter.java b/injitest/src/main/java/inji/utils/S3Adapter.java new file mode 100644 index 0000000000..16f9174421 --- /dev/null +++ b/injitest/src/main/java/inji/utils/S3Adapter.java @@ -0,0 +1,187 @@ +package inji.api.pojo; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import inji.api.ConfigManager; +import inji.utils.StringUtils; +import org.apache.log4j.Logger; +import org.joda.time.DateTime; + +import com.amazonaws.ClientConfiguration; +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.client.builder.AwsClientBuilder; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import com.amazonaws.services.s3.model.ObjectMetadata; +import com.amazonaws.services.s3.model.PutObjectRequest; + + +public class S3Adapter { + private static final Logger logger = Logger.getLogger(S3Adapter.class); + + private AmazonS3 connection = null; + + private int maxRetry = 20; + + private int maxConnection = 200; + + private int retry = 0; + + private boolean useAccountAsBucketname = true; + + private static final String SEPARATOR = "/"; + + private int reportExpirationInDays = Integer.parseInt(ConfigManager.getReportExpirationInDays()); + + private List existingBuckets = new ArrayList<>(); + + private AmazonS3 getConnection(String bucketName) { + if (connection != null) + return connection; + + logger.info("ConfigManager.getS3UserKey() :: " + ConfigManager.getS3UserKey()); + logger.info("ConfigManager.getS3Host() :: " + ConfigManager.getS3Host()); + logger.info("ConfigManager.getS3Region() :: " + ConfigManager.getS3Region()); + logger.info("ConfigManager.getS3SecretKey() :: " + ConfigManager.getS3SecretKey()); + try { + AWSCredentials awsCredentials = new BasicAWSCredentials(ConfigManager.getS3UserKey(), + ConfigManager.getS3SecretKey()); + connection = AmazonS3ClientBuilder.standard() + .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).enablePathStyleAccess() + .withClientConfiguration( + new ClientConfiguration().withMaxConnections(maxConnection).withMaxErrorRetry(maxRetry)) + .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(ConfigManager.getS3Host(), + ConfigManager.getS3Region())) + .build(); + + connection.doesBucketExistV2(bucketName); + retry = 0; + } catch (Exception e) { + if (retry >= maxRetry) { + // reset the connection and retry count + retry = 0; + connection = null; +// LOGGER.error(SESSIONID, REGISTRATIONID,"Maximum retry limit exceeded. Could not obtain connection for "+ bucketName +". Retry count :" + retry, ExceptionUtils.getStackTrace(e)); +// throw new ObjectStoreAdapterException(OBJECT_STORE_NOT_ACCESSIBLE.getErrorCode(), OBJECT_STORE_NOT_ACCESSIBLE.getErrorMessage(), e); + } else { + connection = null; + retry = retry + 1; +// LOGGER.error(SESSIONID, REGISTRATIONID,"Exception occured while obtaining connection for "+ bucketName +". Will try again. Retry count : " + retry, ExceptionUtils.getStackTrace(e)); + getConnection(bucketName); + } + } + return connection; + } + + /* + * public boolean putObject(String account, final String container, String + * source, String process, String objectName, File file) { String + * finalObjectName = null; String bucketName = null; + * logger.info("useAccountAsBucketname:: "+useAccountAsBucketname); if + * (useAccountAsBucketname) { finalObjectName = getName(container, source, + * process, objectName); bucketName = account; } else { finalObjectName = + * getName(source, process, objectName); bucketName = container; } + * logger.info("bucketName :: "+bucketName); AmazonS3 connection = + * getConnection(bucketName); if (!doesBucketExists(bucketName)) { + * connection.createBucket(bucketName); if (useAccountAsBucketname) + * existingBuckets.add(bucketName); } + * + * connection.putObject(bucketName, finalObjectName, file); return true; } + */ + + public boolean putObject(String account, final String container, String source, String process, String objectName, File file) { + String finalObjectName = null; + String bucketName = null; + boolean bReturn = false; + logger.info("useAccountAsBucketname:: " + useAccountAsBucketname); + if (useAccountAsBucketname) { + finalObjectName = getName(container, source, process, objectName); + bucketName = account; + } else { + finalObjectName = getName(source, process, objectName); + bucketName = container; + } + logger.info("bucketName :: " + bucketName); + AmazonS3 connection = getConnection(bucketName); + if (connection != null) { + if (!doesBucketExists(bucketName)) { + connection.createBucket(bucketName); + if (useAccountAsBucketname) + existingBuckets.add(bucketName); + } + PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, finalObjectName, file); + ObjectMetadata objectMetadata = new ObjectMetadata(); + objectMetadata.setHttpExpiresDate(new DateTime().plusDays(reportExpirationInDays).toDate()); + putObjectRequest.setMetadata(objectMetadata); + connection.putObject(putObjectRequest); + bReturn = true; + } + return bReturn; + } + + private boolean doesBucketExists(String bucketName) { + // use account as bucket name and bucket name is present in existing bucket list + if (useAccountAsBucketname && existingBuckets.contains(bucketName)) + return true; + // use account as bucket name and bucket name is not present in existing bucket + // list + else if (useAccountAsBucketname && !existingBuckets.contains(bucketName)) { + boolean doesBucketExistsInObjectStore = connection.doesBucketExistV2(bucketName); + if (doesBucketExistsInObjectStore) + existingBuckets.add(bucketName); + return doesBucketExistsInObjectStore; + } else + return connection.doesBucketExistV2(bucketName); + } + + /* + * public boolean reportRetentionPolicy(String bucketName) { + * + * ObjectMetadata metadata = new ObjectMetadata(); logger.info("size:" + + * bytes.length); metadata.setContentLength(bytes.length); + * metadata.setContentType(contentType); Date expirationTime = new Date(2025, 5, + * 10); metadata.setExpirationTime(DateTime.now().toDate()); + * metadata.setHeader("x-amz-object-lock-retain-until-date", closerDate + + * "T00:00:00.000Z"); metadata.setHeader("x-amz-object-lock-mode", + * "COMPLIANCE"); byte[] md5 = Md5Utils.computeMD5Hash(baInputStream); String + * md5Base64 = BinaryUtils.toBase64(md5); metadata.setHeader("Content-MD5", + * md5Base64); baInputStream.reset(); PutObjectRequest putRequest = new + * PutObjectRequest(bucketName, finalObjectName, baInputStream, metadata); + * s3client.putObject(putRequest); + * + * + * return true; + * + * } + */ + + public static String getName(String container, String source, String process, String objectName) { + String finalObjectName = ""; + if (StringUtils.isNotEmpty(container)) + finalObjectName = container + SEPARATOR; + if (StringUtils.isNotEmpty(source)) + finalObjectName = finalObjectName + source + SEPARATOR; + if (StringUtils.isNotEmpty(process)) + finalObjectName = finalObjectName + process + SEPARATOR; + + finalObjectName = finalObjectName + objectName; + + return finalObjectName; + } + + public static String getName(String source, String process, String objectName) { + String finalObjectName = ""; + if (StringUtils.isNotEmpty(source)) + finalObjectName = source + SEPARATOR; + if (StringUtils.isNotEmpty(process)) + finalObjectName = finalObjectName + process + SEPARATOR; + + finalObjectName = finalObjectName + objectName; + + return finalObjectName; + } +} \ No newline at end of file diff --git a/injitest/src/main/java/inji/utils/ScreenRecording.java b/injitest/src/main/java/inji/utils/ScreenRecording.java new file mode 100644 index 0000000000..792f1aad5f --- /dev/null +++ b/injitest/src/main/java/inji/utils/ScreenRecording.java @@ -0,0 +1,46 @@ +package inji.utils; + +import io.appium.java_client.AppiumDriver; +import io.appium.java_client.screenrecording.CanRecordScreen; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Base64; + +public class ScreenRecording { + public static void startAndroidScreenRecording(AppiumDriver driver){ + ((CanRecordScreen)driver).startRecordingScreen(); + } + + public static void stopAndroidScreenRecording(AppiumDriver driver, String methodName){ + String base64String = ((CanRecordScreen)driver).stopRecordingScreen(); + byte[] data = Base64.getDecoder().decode(base64String); + String + destinationPath="report/recordings/android/"+methodName+".mp4"; + Path path = Paths.get(destinationPath); + try { + Files.write(path, data); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static void startIosScreenRecording(AppiumDriver driver){ + ((CanRecordScreen)driver).startRecordingScreen(); + } + + public static void stopIosScreenRecording(AppiumDriver driver, String methodName){ + String base64String = ((CanRecordScreen)driver).stopRecordingScreen(); + byte[] data = Base64.getDecoder().decode(base64String); + String + destinationPath="report/recordings/ios/"+methodName+".mp4"; + Path path = Paths.get(destinationPath); + try { + Files.write(path, data); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/injitest/src/main/java/inji/utils/StringUtils.java b/injitest/src/main/java/inji/utils/StringUtils.java new file mode 100644 index 0000000000..6d47f700c4 --- /dev/null +++ b/injitest/src/main/java/inji/utils/StringUtils.java @@ -0,0 +1,2 @@ +package inji.utils;public class StringUtils { +} diff --git a/injitest/src/main/java/inji/utils/TestDataReader.java b/injitest/src/main/java/inji/utils/TestDataReader.java new file mode 100644 index 0000000000..cf87497867 --- /dev/null +++ b/injitest/src/main/java/inji/utils/TestDataReader.java @@ -0,0 +1,72 @@ +package inji.utils; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import inji.driver.TestRunner; + +import java.io.File; +import java.io.IOException; + +public class TestDataReader { + public static String readData(String key) { + return getValueForKey(key); + } + + //ToDo - Need to remove this once path issue is fixed on device farm + private static String getValueForKey(String key) { + switch (key) { + case "externalemail": + return "Resident_AddIdentity_ValidParam_smoke_Pos@mosip.net"; + case "passcode": + return "111111"; + case "otp": + return "111111"; + case "invalidOtp": + return "666666"; + case "newuin": + return "7059849273"; + case "revokevid": + return "6205860394830280"; + case "newaid": + return "10001100400008120231110021527"; + case "invalidpasscode": + return "123456"; + case "invaliduin": + return "1234567891"; + case "fullName": + return "TEST_FULLNAMEeng"; + case "idType": + return "National Card"; + case "gender": + return "MLEeng"; + case "status": + return "Valid"; + case "phoneNumber": + return "9876543210"; + case "generatedOn": + return "9/5/2023"; + case "dateOfBirth": + return "01/01/1996"; + case "aid": + return "10001100660000620230714065538"; + case "setExcludedGroups": + return "AVT,PVT"; + case "uin": + return "6920386351"; + case "uin2": + return "5740943928"; + case "uin2FullName": + return "fbgfhgfhghd"; + case "newEnv": + return "https://api.qa-trinity.mosip.net"; + case "injiEnv": + return "https://api.qa-inji.mosip.net"; + case "invalidenv": + return "https://api.dev3.mosip"; + case "isDeviceFarmRun": + return "false"; + default: + return "Key not found"; + } + } +} diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Headers.java b/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Headers.java deleted file mode 100644 index 37c2dfdd2b..0000000000 --- a/injitest/src/main/java/io/mosip/test/mob/inji/api/pojo/Headers.java +++ /dev/null @@ -1,4 +0,0 @@ -package io.mosip.test.mob.inji.api.pojo; - -public class Headers{ -} \ No newline at end of file diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/driver/DriverManager.java b/injitest/src/main/java/io/mosip/test/mob/inji/driver/DriverManager.java deleted file mode 100644 index 88fa1d3988..0000000000 --- a/injitest/src/main/java/io/mosip/test/mob/inji/driver/DriverManager.java +++ /dev/null @@ -1,75 +0,0 @@ -package io.mosip.test.mob.inji.driver; - -import io.appium.java_client.AppiumDriver; -import io.appium.java_client.android.AndroidDriver; -import io.appium.java_client.android.options.UiAutomator2Options; -import io.appium.java_client.ios.IOSDriver; -import io.appium.java_client.ios.options.XCUITestOptions; -import io.appium.java_client.service.local.AppiumDriverLocalService; -import io.mosip.test.mob.inji.constants.Target; -import io.mosip.test.mob.inji.exceptions.PlatformNotSupportException; -import io.mosip.test.mob.inji.utils.PropertiesReader; -import io.mosip.test.mob.inji.utils.TestDataReader; -import java.net.MalformedURLException; -import java.net.URL; -import org.openqa.selenium.Capabilities; - -public class DriverManager { - private static ThreadLocal platform = new ThreadLocal<>(); - - private static ThreadLocal appiumDriver = new ThreadLocal<>(); - - private static AppiumDriverLocalService service; - - private static AppiumDriver getAndroidDriver() throws MalformedURLException { - UiAutomator2Options options = new UiAutomator2Options(); - options.setUdid(TestDataReader.readData("androidDevice")); - options.setApp(TestDataReader.readData("androidAppPath")); - options.setAutoGrantPermissions(true); - appiumDriver.set(new AndroidDriver(new URL("http://127.0.0.1:4723"), (Capabilities)options)); - return appiumDriver.get(); - } - - private static AppiumDriver getIosDriver() { - XCUITestOptions options = new XCUITestOptions(); - options.setDeviceName("iPhone 14 Pro"); - options.setApp(System.getProperty("user.dir") + "/apps/ios/Inji_0.9.1.zip"); - options.autoAcceptAlerts(); - options.autoDismissAlerts(); - appiumDriver.set(new IOSDriver(service.getUrl(), (Capabilities)options)); - return appiumDriver.get(); - } - - public static AppiumDriver getDriver(Target target) throws MalformedURLException, PlatformNotSupportException, InterruptedException { - platform.set(target); - switch (target) { - case ANDROID: - return getAndroidDriver(); - case IOS: - return getIosDriver(); - } - throw new PlatformNotSupportException("Please provide supported OS"); - } - - public static void startAppiumServer() { - -// PropertiesReader propertiesReader = new PropertiesReader(); - // -// String ipAddress = System.getProperty("ipAddress") != null ? System.getProperty("ipAddress") : propertiesReader.getIpAddress(); -// int port = System.getProperty("port") != null ? Integer.parseInt(Objects.requireNonNull(System.getProperty("ipAddress"))) : propertiesReader.getPortNumber(); - // -// AppiumServiceBuilder builder = new AppiumServiceBuilder().withAppiumJS(new File(propertiesReader.getAppiumServerExecutable())).usingDriverExecutable(new File(propertiesReader.getNodePath())).withIPAddress(ipAddress).usingPort(port).withArgument(GeneralServerFlag.LOCAL_TIMEZONE).withLogFile(new File(propertiesReader.getAppiumLogFilePath())); - // -// service = AppiumDriverLocalService.buildService(builder); -// service.start(); - } - - public static void stopAppiumServer() { - if (service != null) - service.stop(); - } - - public static Target getPlatform() { - return platform.get(); - } -} diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/driver/TestRunner.java b/injitest/src/main/java/io/mosip/test/mob/inji/driver/TestRunner.java deleted file mode 100644 index 12ccd94d9a..0000000000 --- a/injitest/src/main/java/io/mosip/test/mob/inji/driver/TestRunner.java +++ /dev/null @@ -1,71 +0,0 @@ -package io.mosip.test.mob.inji.driver; - - - -import java.io.File; -import java.util.*; -import java.util.ArrayList; -import java.util.List; - -import org.testng.TestListenerAdapter; -import org.testng.TestNG; - -import io.mosip.test.mob.inji.api.AdminTestUtil; -import io.mosip.test.mob.inji.api.BaseTestCase; - - -public class TestRunner { - public static String jarUrl = TestRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath(); - - static TestListenerAdapter tla = new TestListenerAdapter(); - - - public static void main(String[] args) throws Exception { - BaseTestCase.intiateUINGenration(); - - startTestRunner(); - } - - public static String getResourcePath() { - if (checkRunType().equalsIgnoreCase("JAR")) - return (new File(jarUrl)).getParentFile().getAbsolutePath().toString() + "/resources/"; - if (checkRunType().equalsIgnoreCase("IDE")) { - String path = System.getProperty("user.dir") + System.getProperty("path.config"); - if (path.contains("test-classes")) - path = path.replace("test-classes", "classes"); - return path; - } - return "Global Resource File Path Not Found"; - } - - public static String checkRunType() { - if (TestRunner.class.getResource("TestRunner.class").getPath().toString().contains(".jar")) - return "JAR"; - return "IDE"; - } - - public static void startTestRunner() { - File homeDir = null; - TestNG runner = new TestNG(); - List suitefiles = new ArrayList<>(); - String os = System.getProperty("os.name"); - homeDir = new File(System.getProperty("user.dir") + "/testng.xml"); - suitefiles.add(homeDir.getAbsolutePath()); - runner.setTestSuites(suitefiles); - System.getProperties().setProperty("testng.outpur.dir", "testng-report"); - runner.setOutputDirectory("testng-report"); - runner.run(); - } - - public static String GetKernalFilename(){ - String path = System.getProperty("env.user"); - String kernalpath=null; - if(System.getProperty("env.user")==null) { - kernalpath="Kernel.properties"; - - }else { - kernalpath="Kernel_"+path+".properties"; - } - return kernalpath; - } -} \ No newline at end of file diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/BaseTest.java b/injitest/src/main/java/io/mosip/test/mob/inji/testcases/BaseTest.java deleted file mode 100644 index 0dd11209eb..0000000000 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/BaseTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.mosip.test.mob.inji.testcases; - - -import io.appium.java_client.AppiumDriver; -import io.mosip.test.mob.inji.api.MockSMTPListener; -import io.mosip.test.mob.inji.constants.Target; -import io.mosip.test.mob.inji.driver.DriverManager; -import io.mosip.test.mob.inji.exceptions.PlatformNotSupportException; -import io.mosip.test.mob.inji.utils.TestDataReader; - -import org.testng.annotations.*; - - -import java.net.MalformedURLException; - -public class BaseTest { - protected AppiumDriver driver; - Target target = null; - - @BeforeSuite(alwaysRun = true) - public void beforeSuite() { - DriverManager.startAppiumServer(); - } - - @Parameters("platformName") - @BeforeMethod(alwaysRun = true) - public void setup(String platformName) { - try { - target = Target.valueOf(platformName); - this.driver = DriverManager.getDriver(target); - } catch (MalformedURLException | PlatformNotSupportException | InterruptedException e) { - throw new RuntimeException(e); - } - //ScreenRecording.startScreenRecording(driver); - } - - @AfterMethod(alwaysRun = true) - public void teardown() { - //ScreenRecording.stopScreenRecording(driver); - driver.quit(); - } - - @AfterSuite(alwaysRun = true) - public void afterSuite() { - DriverManager.stopAppiumServer(); - } - -} \ No newline at end of file diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/utils/ScreenRecording.java b/injitest/src/main/java/io/mosip/test/mob/inji/utils/ScreenRecording.java deleted file mode 100644 index 4914bb8b3c..0000000000 --- a/injitest/src/main/java/io/mosip/test/mob/inji/utils/ScreenRecording.java +++ /dev/null @@ -1,30 +0,0 @@ -package io.mosip.test.mob.inji.utils; - -import io.appium.java_client.AppiumDriver; -import io.appium.java_client.screenrecording.CanRecordScreen; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Base64; - -public class ScreenRecording { - - public static void startScreenRecording(AppiumDriver driver){ - ((CanRecordScreen)driver).startRecordingScreen(); - } - - public static void stopScreenRecording(AppiumDriver driver){ - String base64String = ((CanRecordScreen)driver).stopRecordingScreen(); - byte[] data = Base64.getDecoder().decode(base64String); - String - destinationPath="report/videoRecording.mp4"; - Path path = Paths.get(destinationPath); - try { - Files.write(path, data); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/utils/TestDataReader.java b/injitest/src/main/java/io/mosip/test/mob/inji/utils/TestDataReader.java deleted file mode 100644 index 14201cf285..0000000000 --- a/injitest/src/main/java/io/mosip/test/mob/inji/utils/TestDataReader.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.mosip.test.mob.inji.utils; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -import io.mosip.test.mob.inji.driver.TestRunner; - -import java.io.File; -import java.io.IOException; - -public class TestDataReader { - public static String readData(String key) { - ObjectMapper objectMapper = new ObjectMapper(); - String data = null; - try { - JsonNode jsonNode = objectMapper.readTree( - new File(TestRunner.getResourcePath()+"/TestData.json")); - data = jsonNode.get(key).asText(); - } catch (IOException e) { - e.printStackTrace(); - } - return data; - } -} diff --git a/injitest/src/main/resources/DesiredCapabilities.json b/injitest/src/main/resources/DesiredCapabilities.json new file mode 100644 index 0000000000..4bcc41b4ac --- /dev/null +++ b/injitest/src/main/resources/DesiredCapabilities.json @@ -0,0 +1,29 @@ +[ + { + "name": "androidDevice", + "caps": { + "appium:deviceName": "nightwatch-android-11", + "appium:automationName": "UiAutomator2", + "appium:app": "/Users/kamalsingh/TestAutomation/Inji/inji/injitest/apps/android/Inji.apk", + "platformName": "android", + "appium:appPackage": "io.mosip.residentapp", + "appium:appActivity": "io.mosip.residentapp.MainActivity", + "appium:noReset": false, + "appium:autoGrantPermissions": true + } + }, + { + "name": "iosDevice", + "caps": { + "appium:deviceName": "iPhone 15 Pro", + "appium:automationName": "XCUITest", + "appium:app": "/Users/kamalsingh/TestAutomation/Inji/inji/injitest/apps/ios/Inji_ios.zip", + "platformName": "ios", + "appium:noReset": false, + "appium:includeSafariInWebviews": true, + "appium:newCommandTimeout": 3600, + "appium:connectHardwareKeyboard": true, + "maxTypingFrequency": 30 + } + } +] \ No newline at end of file diff --git a/injitest/src/main/resources/TestData.json b/injitest/src/main/resources/TestData.json index 3446f93176..ae446f3380 100644 --- a/injitest/src/main/resources/TestData.json +++ b/injitest/src/main/resources/TestData.json @@ -1,28 +1,26 @@ -{ - "externalemail": "Resident_AddIdentity_ValidParam_smoke_Pos@mosip.net", - "passcode": "111111", - "otp":"111111", - "invalidOtp":"666666", - "newuin":"7059849273", - "revokevid":"6205860394830280", - "newaid":"10001100400008120231110021527", - "invalidpasscode": "123456", - "invaliduin": "1234567891", - "fullName": "TEST_FULLNAMEeng", - "idType": "National Card", - "gender": "MLEeng", - "status": "Valid", - "phoneNumber": "9876543210", - "generatedOn": "9/5/2023", - "dateOfBirth": "01/01/1996", - "aid": "10001100660000620230714065538", - "setExcludedGroups":"AVT,PVT", - "androidAppPath":"/Users/kamalsingh/TestAutomation/Inji/inji/injitest/apps/android/Inji.apk", - "androidDevice": "emulator-5554", - "uin": "6920386351", - "uin2": "5740943928", - "uin2FullName": "fbgfhgfhghd", - "newEnv":"https://api.qa-trinity.mosip.net", - "injiEnv":"https://api.qa-inji.mosip.net", - "invalidenv":"https://api.dev3.mosip" +{ + "externalemail": "Resident_AddIdentity_ValidParam_smoke_Pos@mosip.net", + "passcode": "111111", + "otp":"111111", + "invalidOtp":"666666", + "newuin":"7059849273", + "revokevid":"6205860394830280", + "newaid":"10001100400008120231110021527", + "invalidpasscode": "123456", + "invaliduin": "1234567891", + "fullName": "TEST_FULLNAMEeng", + "idType": "National Card", + "gender": "MLEeng", + "status": "Valid", + "phoneNumber": "9876543210", + "generatedOn": "9/5/2023", + "dateOfBirth": "01/01/1996", + "aid": "10001100660000620230714065538", + "setExcludedGroups":"AVT,PVT", + "uin": "6920386351", + "uin2": "5740943928", + "uin2FullName": "fbgfhgfhghd", + "newEnv":"https://api.qa-trinity.mosip.net", + "injiEnv":"https://api.qa-inji.mosip.net", + "invalidenv":"https://api.dev3.mosip" } \ No newline at end of file diff --git a/injitest/src/main/resources/config.properties b/injitest/src/main/resources/config.properties index 1a7c48af38..c01c686543 100644 --- a/injitest/src/main/resources/config.properties +++ b/injitest/src/main/resources/config.properties @@ -1,5 +1,5 @@ ipAddress=127.0.0.1 -port=4723 nodePath=/opt/homebrew/bin/node appiumServerExecutable=/opt/homebrew/lib/node_modules/appium/build/lib/main.js -appiumLogFilePath=report/appiumLogs.txt \ No newline at end of file +appiumLogFilePath=report/appiumLogs.txt +startAppiumServer=true \ No newline at end of file diff --git a/injitest/src/test/java/BaseTest/AndroidBaseTest.java b/injitest/src/test/java/BaseTest/AndroidBaseTest.java new file mode 100644 index 0000000000..8951d03f0d --- /dev/null +++ b/injitest/src/test/java/BaseTest/AndroidBaseTest.java @@ -0,0 +1,36 @@ +package BaseTest; + +import inji.constants.Target; +import inji.driver.DriverManager; +import inji.exceptions.PlatformNotSupportException; +import inji.utils.ScreenRecording; +import org.testng.ITestResult; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Parameters; + +import java.net.MalformedURLException; + +public class AndroidBaseTest extends BaseTest { + @Parameters("platformName") + @BeforeMethod(alwaysRun = true) + public void setup(String platformName) { + try { + //target = Target.valueOf(platformName); + this.driver = DriverManager.getDriver(Target.ANDROID, isDeviceFarmRun); + } catch (MalformedURLException | PlatformNotSupportException | InterruptedException e) { + throw new RuntimeException(e); + } + if (!isDeviceFarmRun) { + ScreenRecording.startAndroidScreenRecording(driver); + } + } + + @AfterMethod(alwaysRun = true) + public void teardown(ITestResult result) { + if (!isDeviceFarmRun) { + ScreenRecording.stopAndroidScreenRecording(driver, result.getMethod().getMethodName()); + } + driver.quit(); + } +} diff --git a/injitest/src/test/java/BaseTest/BaseTest.java b/injitest/src/test/java/BaseTest/BaseTest.java new file mode 100644 index 0000000000..c97a302bd8 --- /dev/null +++ b/injitest/src/test/java/BaseTest/BaseTest.java @@ -0,0 +1,30 @@ +package BaseTest; + + +import inji.api.BaseTestCase; +import inji.utils.TestDataReader; +import io.appium.java_client.AppiumDriver; +import inji.driver.DriverManager; +import org.testng.annotations.AfterSuite; +import org.testng.annotations.BeforeSuite; + +public class BaseTest { + protected AppiumDriver driver; + protected Boolean isDeviceFarmRun = Boolean.parseBoolean(TestDataReader.readData("isDeviceFarmRun")); + + @BeforeSuite(alwaysRun = true) + public void beforeSuite() { + if (!isDeviceFarmRun) { + DriverManager.startAppiumServer(); + //BaseTestCase.intiateUINGenration(); + } + } + + @AfterSuite(alwaysRun = true) + public void afterSuite() { + if (!isDeviceFarmRun) { + DriverManager.stopAppiumServer(); + } + } + +} \ No newline at end of file diff --git a/injitest/src/test/java/BaseTest/IosBaseTest.java b/injitest/src/test/java/BaseTest/IosBaseTest.java new file mode 100644 index 0000000000..e7971a95fc --- /dev/null +++ b/injitest/src/test/java/BaseTest/IosBaseTest.java @@ -0,0 +1,36 @@ +package BaseTest; + +import inji.constants.Target; +import inji.driver.DriverManager; +import inji.exceptions.PlatformNotSupportException; +import inji.utils.ScreenRecording; +import org.testng.ITestResult; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Parameters; + +import java.net.MalformedURLException; + +public class IosBaseTest extends BaseTest { + @Parameters("platformName") + @BeforeMethod(alwaysRun = true) + public void setup(String platformName) { + try { + //Target target = Target.valueOf(platformName); + this.driver = DriverManager.getDriver(Target.IOS, isDeviceFarmRun); + } catch (MalformedURLException | PlatformNotSupportException | InterruptedException e) { + throw new RuntimeException(e); + } + if (!isDeviceFarmRun) { + ScreenRecording.startIosScreenRecording(driver); + } + } + + @AfterMethod(alwaysRun = true) + public void teardown(ITestResult result) { + if (!isDeviceFarmRun) { + ScreenRecording.stopIosScreenRecording(driver,result.getMethod().getMethodName()); + } + driver.quit(); + } +} diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/AboutInjiTest.java b/injitest/src/test/java/androidTestCases/AboutInjiTest.java similarity index 82% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/AboutInjiTest.java rename to injitest/src/test/java/androidTestCases/AboutInjiTest.java index 778aac58fb..736a4c3ec1 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/AboutInjiTest.java +++ b/injitest/src/test/java/androidTestCases/AboutInjiTest.java @@ -1,14 +1,16 @@ -package io.mosip.test.mob.inji.testcases; +package androidTestCases; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; +import BaseTest.AndroidBaseTest; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import static org.testng.Assert.*; +import static org.testng.Assert.assertTrue; -public class AboutInjiTest extends BaseTest { +public class AboutInjiTest extends AndroidBaseTest { @Test - public void copyAppId() throws InterruptedException { + public void copyAppId() { ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); @@ -21,10 +23,10 @@ public void copyAppId() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); diff --git a/injitest/src/test/java/androidTestCases/ActivateVcTest.java b/injitest/src/test/java/androidTestCases/ActivateVcTest.java new file mode 100644 index 0000000000..14efa1ab5f --- /dev/null +++ b/injitest/src/test/java/androidTestCases/ActivateVcTest.java @@ -0,0 +1,173 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +public class ActivateVcTest extends AndroidBaseTest { + @Test + public void activateVc() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnActivationPending(); + + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); + + assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerificationPage.enterOtp(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(moreOptionsPage.isVcActivatedForOnlineLogin(), "Verify if VC is activated"); + + } + + @Test + public void noPreDownloadedVCAndNoHistoryInFreshInstallation() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + assertTrue(homePage.isNoVCDownloaded(), "Verify if no VC is downloaded"); + + HistoryPage historyPage = homePage.clickOnHistoryButton(); + assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); + + assertTrue(historyPage.noHistoryAvailable()); + + } + + @Test + public void verifyInvalidOtpMessage() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(TestDataReader.readData("invalidOtp"), Target.ANDROID); + + assertTrue(otpVerification.invalidOtpMessageDisplayed(), "Verify if OTP is invalid message is displayed"); + + } + + @Test + public void activateVcFromDetailedViewPage() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + DetailedVcViewPage detailedVcViewPage = homePage.openDetailedVcView(TestDataReader.readData("fullName")); + assertTrue(detailedVcViewPage.isDetailedVcViewPageLoaded(), "Verify if detailed Vc view page is displayed"); + PleaseConfirmPopupPage pleaseConfirmPopupPage = detailedVcViewPage.clickOnActivateButton(); + + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); + + assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerificationPage.enterOtp(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(detailedVcViewPage.isProfileAuthenticatedDisplayed(), "Verify if VC is activated"); + } +} diff --git a/injitest/src/test/java/androidTestCases/ChangeLanguageTest.java b/injitest/src/test/java/androidTestCases/ChangeLanguageTest.java new file mode 100644 index 0000000000..142c8bde0e --- /dev/null +++ b/injitest/src/test/java/androidTestCases/ChangeLanguageTest.java @@ -0,0 +1,123 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +public class ChangeLanguageTest extends AndroidBaseTest { + + @Test + public void changeLanguage() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + settingsPage.clickOnLanguage().clickOnFilipinoLanguage(); + + assertTrue(settingsPage.verifyFilipinoLanguage(), "Verify if language is changed to filipino"); + } + + @Test + public void languageShouldBeInNativeLanguages() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + settingsPage.clickOnLanguage(); + + assertTrue(settingsPage.verifyLanguagesInLanguageFilter(), "Verify if all languages are shown in language filter"); + } + + @Test + public void verifyTuvaliVersion() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + assertTrue(settingsPage.clickOnAboutInji().isTuvaliVersionPresent()); + } + + @Test + public void changeLanguageToArabic() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + settingsPage.clickOnLanguage().clickOnArabicLanguageButton(); + + assertTrue(settingsPage.verifyArabicLanguage(), "Verify if language is changed to arabic"); + } +} diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/CredentialRegistryTest.java b/injitest/src/test/java/androidTestCases/CredentialRegistryTest.java similarity index 92% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/CredentialRegistryTest.java rename to injitest/src/test/java/androidTestCases/CredentialRegistryTest.java index 41f6d186ea..339bc5de14 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/CredentialRegistryTest.java +++ b/injitest/src/test/java/androidTestCases/CredentialRegistryTest.java @@ -1,28 +1,16 @@ -package io.mosip.test.mob.inji.testcases; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +package androidTestCases; +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.api.BaseTestCase; -import io.mosip.test.mob.inji.pages.AddNewCardPage; -import io.mosip.test.mob.inji.pages.AppUnlockMethodPage; -import io.mosip.test.mob.inji.pages.ChooseLanguagePage; -import io.mosip.test.mob.inji.pages.ConfirmPasscode; -import io.mosip.test.mob.inji.pages.CredentialRegistryPage; -import io.mosip.test.mob.inji.pages.GenerateUinOrVidPage; -import io.mosip.test.mob.inji.pages.HomePage; -import io.mosip.test.mob.inji.pages.MoreOptionsPage; -import io.mosip.test.mob.inji.pages.OtpVerificationPage; -import io.mosip.test.mob.inji.pages.PleaseConfirmPopupPage; -import io.mosip.test.mob.inji.pages.RetrieveIdPage; -import io.mosip.test.mob.inji.pages.SetPasscode; -import io.mosip.test.mob.inji.pages.SettingsPage; -import io.mosip.test.mob.inji.pages.WelcomePage; -import io.mosip.test.mob.inji.utils.TestDataReader; - -public class CredentialRegistryTest extends BaseTest { +import static org.testng.Assert.assertTrue; +import static org.testng.AssertJUnit.assertEquals; + +public class CredentialRegistryTest extends AndroidBaseTest { @Test public void downloadAndVerifyVcInNewEnv() throws InterruptedException { @@ -38,10 +26,10 @@ public void downloadAndVerifyVcInNewEnv() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -63,7 +51,7 @@ public void downloadAndVerifyVcInNewEnv() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("newuin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(TestDataReader.readData("otp"), target); + otpVerification.enterOtp(TestDataReader.readData("otp"), Target.ANDROID); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); @@ -75,7 +63,7 @@ public void downloadAndVerifyVcInNewEnv() throws InterruptedException { OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerificationPage.enterOtp(TestDataReader.readData("otp"), target); + otpVerificationPage.enterOtp(TestDataReader.readData("otp"), Target.ANDROID); assertTrue(moreOptionsPage.isVcActivatedForOnlineLogin(), "Verify if VC is activated"); } @@ -94,10 +82,10 @@ public void cancelChangeEnvAndVerify() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -132,10 +120,10 @@ public void downloadAndVerifyVcInInvalidEnv() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -167,10 +155,10 @@ public void generateUinInNewEnv() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -195,13 +183,13 @@ public void generateUinInNewEnv() throws InterruptedException { OtpVerificationPage otpVerification = generateUinOrVidPage.enterApplicationID(TestDataReader.readData("newaid")).clickOnGetUinOrVidButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(TestDataReader.readData("otp"), target); + otpVerification.enterOtp(TestDataReader.readData("otp"), Target.ANDROID); assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); retrieveIdPage.clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(TestDataReader.readData("otp"), target); + otpVerification.enterOtp(TestDataReader.readData("otp"), Target.ANDROID); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); } @@ -220,10 +208,10 @@ public void retrivingUinInOtherEnv() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -264,10 +252,10 @@ public void downloadAndVerifyVcInTwoEnv() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -289,7 +277,7 @@ public void downloadAndVerifyVcInTwoEnv() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("newuin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(TestDataReader.readData("otp"), target); + otpVerification.enterOtp(TestDataReader.readData("otp"), Target.ANDROID); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); homePage.clickOnSettingIcon(); @@ -311,7 +299,7 @@ public void downloadAndVerifyVcInTwoEnv() throws InterruptedException { retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); assertTrue(homePage.isSecondNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -331,10 +319,10 @@ public void downloadVcAndActivateItInOtherEnv() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -356,7 +344,7 @@ public void downloadVcAndActivateItInOtherEnv() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("newuin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(TestDataReader.readData("otp"), target); + otpVerification.enterOtp(TestDataReader.readData("otp"), Target.ANDROID); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); homePage.clickOnSettingIcon(); diff --git a/injitest/src/test/java/androidTestCases/DeletingVcTest.java b/injitest/src/test/java/androidTestCases/DeletingVcTest.java new file mode 100644 index 0000000000..e17c1bcb33 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/DeletingVcTest.java @@ -0,0 +1,173 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +public class DeletingVcTest extends AndroidBaseTest { + @Test + public void deleteVcAndVerifyInHistory() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + + PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnRemoveFromWallet(); + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + + pleaseConfirmPopupPage.clickOnConfirmButton(); + assertTrue(homePage.isNoVCDownloaded(), "Verify if VC is removed"); + + HistoryPage historyPage = homePage.clickOnHistoryButton(); + assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); + historyPage.verifyHistory(TestDataReader.readData("uin") + " Removed from wallet", Target.ANDROID); + assertTrue(historyPage.verifyDeleteHistory(TestDataReader.readData("uin"), Target.ANDROID), "Verify if deleted history is displayed"); + + } + + @Test + public void cancelDeleteVc() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + + PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnRemoveFromWallet(); + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + + pleaseConfirmPopupPage.clickOnNoButton(); + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + + moreOptionsPage.clickOnCloseButton(); + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + } + + @Test + public void DownloadingDeletedVc() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + + PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnRemoveFromWallet(); + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + + pleaseConfirmPopupPage.clickOnConfirmButton(); + assertFalse(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if VC is removed"); + + homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + HistoryPage historyPage = homePage.clickOnHistoryButton(); + assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); + + assertTrue(historyPage.verifyHistory(TestDataReader.readData("uin"), Target.ANDROID)); + + assertEquals(historyPage.getNumberOfRecordsInHistory(TestDataReader.readData("uin"), Target.ANDROID), 2,"Verify two download records in history page"); + assertTrue(historyPage.verifyDeleteHistory(TestDataReader.readData("uin"), Target.ANDROID), "Verify if deleted history is displayed"); + } +} \ No newline at end of file diff --git a/injitest/src/test/java/androidTestCases/GenerateUinOrVidTest.java b/injitest/src/test/java/androidTestCases/GenerateUinOrVidTest.java new file mode 100644 index 0000000000..e4a69f9b67 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/GenerateUinOrVidTest.java @@ -0,0 +1,99 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +import static org.testng.Assert.assertTrue; + +public class GenerateUinOrVidTest extends AndroidBaseTest { + + @Test + public void generateUinOrVidUsingAid() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + GenerateUinOrVidPage generateUinOrVidPage = retrieveIdPage.clickOnGetItNowText(); + + assertTrue(generateUinOrVidPage.isGenerateUinOrVidPageLoaded(), "Verify if generate uin or vid page page is displayed"); + OtpVerificationPage otpVerification = generateUinOrVidPage.enterApplicationID(TestDataReader.readData("aid")).clickOnGetUinOrVidButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + retrieveIdPage.clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + } + + @Test + public void goBackToGenerateUinOrVidUsingAidFromOtpVerificationPage() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + GenerateUinOrVidPage generateUinOrVidPage = retrieveIdPage.clickOnGetItNowText(); + + assertTrue(generateUinOrVidPage.isGenerateUinOrVidPageLoaded(), "Verify if generate uin or vid page page is displayed"); + OtpVerificationPage otpVerification = generateUinOrVidPage.enterApplicationID(TestDataReader.readData("aid")).clickOnGetUinOrVidButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.clickOnCrossIcon(); + assertTrue(generateUinOrVidPage.isGenerateUinOrVidPageLoaded(), "Verify if generate uin or vid page page is displayed"); + + } + +} \ No newline at end of file diff --git a/injitest/src/test/java/androidTestCases/NoNetworkAndroidTest.java b/injitest/src/test/java/androidTestCases/NoNetworkAndroidTest.java new file mode 100644 index 0000000000..6722a609b9 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/NoNetworkAndroidTest.java @@ -0,0 +1,356 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.CommonMethods; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +import static org.testng.Assert.assertTrue; + +public class NoNetworkAndroidTest extends AndroidBaseTest { + + @Test + public void setupPasscodeAndDownloadCardWithoutInternet() { + CommonMethods.enableAirplaneMode(); + + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(homePage.isNoInternetConnectionDisplayed(), "Verify if no internet connection is displayed"); + assertTrue(homePage.isTryAgainButtonDisplayed(), "Verify if Try again button displayed"); + CommonMethods.disableAirplaneMode(); + + assertTrue(homePage.isTryAgainButtonDisplayed(), "Verify if Try again button displayed"); + + homePage.clickOnTryAgainButton(); + assertTrue(homePage.isTryAgainButtonDisplayed(), "Verify if Try again button displayed"); + + addNewCardPage.clickOnBack(); + assertTrue(homePage.isNoVCDownloaded(), "Verify if VC is removed"); + } + + @Test + public void openCameraOnFlightMode() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + CommonMethods.enableAirplaneMode(); + assertTrue(homePage.clickOnScanButton().acceptPermissionPopup().isCameraOpen()); + CommonMethods.disableAirplaneMode(); + } + @Test + public void activateVcWithoutInternet() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + CommonMethods.enableAirplaneMode(); + + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnActivationPending(); + + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); + + assertTrue(otpVerificationPage.somethingWetWrongInVcActivationDisplayed(), "Verify if Something is wrong. Please try again later! is displayed"); + CommonMethods.disableAirplaneMode(); + + } + + @Test + public void verifyListOfLanguagesInOfflineMode() { + CommonMethods.enableAirplaneMode(); + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + settingsPage.clickOnLanguage(); + + assertTrue(settingsPage.verifyLanguagesInLanguageFilter(), "Verify if all languages are shown in language filter"); + CommonMethods.disableAirplaneMode(); + } + + @Test + public void verifyHelpPageOfflineMode() { + CommonMethods.enableAirplaneMode(); + + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + HelpPage helpPage = homePage.clickOnHelpIcon(); + + assertTrue(helpPage.isHelpPageLoaded(), "Verify if help page is displayed"); + helpPage.exitHelpPage(); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + CommonMethods.disableAirplaneMode(); + } + + @Test + public void deleteDownloadedVcInOfflineMode() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + CommonMethods.enableAirplaneMode(); + + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + + PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnRemoveFromWallet(); + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + + pleaseConfirmPopupPage.clickOnConfirmButton(); + + CommonMethods.disableAirplaneMode(); + assertTrue(homePage.isNoVCDownloaded(), "Verify if VC is removed"); + } + + @Test + public void openQrOffline() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + CommonMethods.enableAirplaneMode(); + + DetailedVcViewPage detailedVcViewPage = homePage.openDetailedVcView(TestDataReader.readData("fullName")); + detailedVcViewPage.clickOnQrCodeButton(); + assertTrue(detailedVcViewPage.isQrCodeDisplayed(), "Verify if QR Code header is displayed"); + + detailedVcViewPage.clickOnQrCrossIcon(); + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + CommonMethods.disableAirplaneMode(); + } + + @Test + public void verifyRecivedCardOffline() throws InterruptedException { + CommonMethods.enableAirplaneMode(); + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + ReceiveCardPage receiveCardPage = settingsPage.clickOnReceiveCard(); + assertTrue(receiveCardPage.isReceiveCardHederDisplayed(), "Verify if QR code header is displayed"); + + assertTrue(receiveCardPage.isWaitingForConnectionDisplayed(), "Verify if waiting for connection displayed"); + CommonMethods.disableAirplaneMode(); + } + + @Test + public void downloadCardWithoutInternetRetryWithInternet() throws InterruptedException { + CommonMethods.enableAirplaneMode(); + + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(homePage.isNoInternetConnectionDisplayed(), "Verify if no internet connection is displayed"); + assertTrue(homePage.isTryAgainButtonDisplayed(), "Verify if try again button displayed"); + + CommonMethods.disableAirplaneMode(); + assertTrue(homePage.isTryAgainButtonNotDisplayed(), "Wating for network come online"); + + homePage.clickOnTryAgainButton(); + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + } +} \ No newline at end of file diff --git a/injitest/src/test/java/androidTestCases/PinVcTest.java b/injitest/src/test/java/androidTestCases/PinVcTest.java new file mode 100644 index 0000000000..843635debb --- /dev/null +++ b/injitest/src/test/java/androidTestCases/PinVcTest.java @@ -0,0 +1,105 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +import static org.testng.Assert.assertTrue; + +public class PinVcTest extends AndroidBaseTest { + + @Test + public void pinVc() throws InterruptedException { + + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + moreOptionsPage.clickOnPinOrUnPinCard(); + + assertTrue(homePage.isPinIconDisplayed(), "Verify if pin icon on vc is displayed"); + } + + //For IOS bluetooth does not support in simulator, so we can't automate + @Test + public void VerifyCameraOpenAfterPinVc() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + moreOptionsPage.clickOnPinOrUnPinCard(); + + assertTrue(homePage.isPinIconDisplayed(), "Verify if pin icon on vc is displayed"); + ScanPage scanPage=homePage.clickOnScanButton(); + + assertTrue(scanPage.isCameraPageLoaded(), "Verify if pin icon on vc is displayed"); + assertTrue(scanPage.isFlipCameraClickable(),"Verify if flip camera is enabled"); + + } + +} diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/ReceiveCardTest.java b/injitest/src/test/java/androidTestCases/ReceiveCardTest.java similarity index 81% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/ReceiveCardTest.java rename to injitest/src/test/java/androidTestCases/ReceiveCardTest.java index 6f9ad87523..f998549dd8 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/ReceiveCardTest.java +++ b/injitest/src/test/java/androidTestCases/ReceiveCardTest.java @@ -1,20 +1,19 @@ -package io.mosip.test.mob.inji.testcases; +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; import static org.testng.Assert.assertTrue; -import org.testng.annotations.Test; +import static org.testng.Assert.*; + +import static org.testng.Assert.assertTrue; -import io.mosip.test.mob.inji.pages.AppUnlockMethodPage; -import io.mosip.test.mob.inji.pages.ChooseLanguagePage; -import io.mosip.test.mob.inji.pages.ConfirmPasscode; -import io.mosip.test.mob.inji.pages.HomePage; -import io.mosip.test.mob.inji.pages.ReceiveCardPage; -import io.mosip.test.mob.inji.pages.SetPasscode; -import io.mosip.test.mob.inji.pages.SettingsPage; -import io.mosip.test.mob.inji.pages.WelcomePage; -import io.mosip.test.mob.inji.utils.TestDataReader; - -public class ReceiveCardTest extends BaseTest { +public class ReceiveCardTest extends AndroidBaseTest { @Test public void verifyRecivedCardAndQrCode() { @@ -30,10 +29,10 @@ public void verifyRecivedCardAndQrCode() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -57,10 +56,10 @@ public void verifyRecivedCardAndQrCodeInFilipinoLanguage() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); diff --git a/injitest/src/test/java/androidTestCases/ShareVcTest.java b/injitest/src/test/java/androidTestCases/ShareVcTest.java new file mode 100644 index 0000000000..92c7427985 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/ShareVcTest.java @@ -0,0 +1,66 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +public class ShareVcTest extends AndroidBaseTest { + + @Test + public void noCardsAvailableToShare() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + ScanPage scanPage = homePage.clickOnScanButton(); + assertTrue(scanPage.isNoShareableCardsMessageDisplayed(), "Verify if no shareable cards are available message is displayed"); + } + + @Test + public void verifyReceivedCardTabPresent() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + assertTrue(settingsPage.isReceivedCardsPresent(), "Verify if received cards tab is displayed"); + + } +} diff --git a/injitest/src/test/java/androidTestCases/UnlockWithPasscodeTest.java b/injitest/src/test/java/androidTestCases/UnlockWithPasscodeTest.java new file mode 100644 index 0000000000..beafd5d469 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/UnlockWithPasscodeTest.java @@ -0,0 +1,85 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +public class UnlockWithPasscodeTest extends AndroidBaseTest { + + @Test + public void logoutAndLoginWithPasscode() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + UnlockApplicationPage unlockApplicationPage = settingsPage.clickOnLogoutButton(); + + assertTrue(unlockApplicationPage.isUnlockApplicationPageLoaded(), "Verify if unlock application page is displayed"); + EnterYourPasscodePage enterYourPasscodePage = unlockApplicationPage.clickOnUnlockApplicationButton(); + + assertTrue(enterYourPasscodePage.isEnterYourPasscodePageLoaded(), "Verify if enter your passcode page is displayed"); + enterYourPasscodePage.enterYourPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + } + + @Test + public void loginWithInvalidPasscode() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + UnlockApplicationPage unlockApplicationPage = settingsPage.clickOnLogoutButton(); + + assertTrue(unlockApplicationPage.isUnlockApplicationPageLoaded(), "Verify if unlock application page is displayed"); + EnterYourPasscodePage enterYourPasscodePage = unlockApplicationPage.clickOnUnlockApplicationButton(); + + assertTrue(enterYourPasscodePage.isEnterYourPasscodePageLoaded(), "Verify if enter your passcode page is displayed"); + enterYourPasscodePage.enterYourPasscode(TestDataReader.readData("invalidPasscode"), Target.ANDROID); + + assertTrue(confirmPasscode.isPasscodeInvalidMessageDisplayed(), "verify if invalid passcode is displayed"); + + } +} diff --git a/injitest/src/test/java/androidTestCases/VcDownloadAndVerifyUsingUinTest.java b/injitest/src/test/java/androidTestCases/VcDownloadAndVerifyUsingUinTest.java new file mode 100644 index 0000000000..e75eb08fe2 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/VcDownloadAndVerifyUsingUinTest.java @@ -0,0 +1,230 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +public class VcDownloadAndVerifyUsingUinTest extends AndroidBaseTest { + @Test + public void downloadAndVerifyVcUsingUin() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + assertTrue(homePage.isIdTypeDisplayed(), "Verify if id type is displayed"); + + DetailedVcViewPage detailedVcViewPage = homePage.openDetailedVcView(TestDataReader.readData("fullName")); + detailedVcViewPage.clickOnQrCodeButton(); + assertTrue(detailedVcViewPage.isQrCodeDisplayed(), "Verify if QR Code header is displayed"); + + detailedVcViewPage.clickOnQrCrossIcon(); + assertTrue(detailedVcViewPage.isDetailedVcViewPageLoaded(), "Verify if detailed Vc view page is displayed"); + assertEquals(detailedVcViewPage.getNameInDetailedVcView(), TestDataReader.readData("fullName"), "Verify if full name is displayed"); + assertEquals(detailedVcViewPage.getDateOfBirthInDetailedVcView(), TestDataReader.readData("dateOfBirth"), "Verify if date of birth is displayed"); + assertEquals(detailedVcViewPage.getGenderInDetailedVcView(), TestDataReader.readData("gender"), "Verify if gender is displayed"); + assertEquals(detailedVcViewPage.getIdTypeValueInDetailedVcView(), TestDataReader.readData("idType"), "Verify if id type is displayed"); + assertEquals(detailedVcViewPage.getStatusInDetailedVcView(), TestDataReader.readData("status"), "Verify if status is displayed"); + assertEquals(detailedVcViewPage.getUinInDetailedVcView(), TestDataReader.readData("uin"), "Verify if uin is displayed"); + assertEquals(detailedVcViewPage.getPhoneInDetailedVcView(), TestDataReader.readData("phoneNumber"), "Verify if phone number is displayed"); + assertEquals(detailedVcViewPage.getEmailInDetailedVcView(), TestDataReader.readData("externalemail"), "Verify if email is displayed"); + assertTrue(detailedVcViewPage.isActivateButtonDisplayed(), "Verify if activate vc button displayed"); + } + + @Test + public void downloadMultipleVcUsingDifferentUin() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin2")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("uin2FullName")), "Verify if second VC is displayed"); + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verifying again if first VC is still exists."); + + } + + @Test + public void downloadWithEmptyUin() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox("").clickOnGenerateCardButton(); + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + + } + + @Test + public void generateMultipleVcWithSameUin() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isSecondNameDisplayed(TestDataReader.readData("fullName")), "Verify if second card name is displayed"); + HistoryPage historyPage = homePage.clickOnHistoryButton(); + + assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); + + assertEquals(historyPage.getNumberOfRecordsInHistory(TestDataReader.readData("uin"), Target.ANDROID),2, "Verify two download records in history page"); + + } + + @Test + public void verifyInvalidUinErrorMessage() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + retrieveIdPage.setEnterIdTextBox("00").clickOnGenerateCardButton(); + + assertTrue(retrieveIdPage.isIncorrectInputFormatErrorMessageDisplayed()); + } +} diff --git a/injitest/src/test/java/androidTestCases/VcDownloadAndVerifyUsingVidTest.java b/injitest/src/test/java/androidTestCases/VcDownloadAndVerifyUsingVidTest.java new file mode 100644 index 0000000000..b2385c76d2 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/VcDownloadAndVerifyUsingVidTest.java @@ -0,0 +1,170 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +public class VcDownloadAndVerifyUsingVidTest extends AndroidBaseTest { + @Test + public void downloadAndVerifyVcUsingVid() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(Target.ANDROID).setEnterIdTextBox(BaseTestCase.perpetualVid).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + DetailedVcViewPage detailedVcViewPage = homePage.openDetailedVcView(TestDataReader.readData("fullName")); + assertTrue(detailedVcViewPage.isDetailedVcViewPageLoaded(), "Verify if detailed Vc view page is displayed"); + assertEquals(detailedVcViewPage.getNameInDetailedVcView(), TestDataReader.readData("fullName"), "Verify if full name is displayed"); + } + + @Test + public void downloadTwoVcDeleteOneUsingVid() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(Target.ANDROID).setEnterIdTextBox(BaseTestCase.perpetualVid).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + retrieveIdPage.clickOnVid(Target.ANDROID).setEnterIdTextBox(BaseTestCase.perpetualVid).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + // + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + + PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnRemoveFromWallet(); + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + + pleaseConfirmPopupPage.clickOnConfirmButton(); + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + + } + + @Test + public void verifyInvalidVidErrorMessage() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(Target.ANDROID).setEnterIdTextBox("00").clickOnGenerateCardButton(); + + assertTrue(retrieveIdPage.isIncorrectInputFormatErrorMessageDisplayed()); + } + + @Test + public void downloadAndVerifyVcUsingRevokeVid() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(Target.ANDROID).setEnterIdTextBox(TestDataReader.readData("revokevid")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.vidNotAvailableDisplayed(), "Verify if vid is not available message displayed"); + } +} \ No newline at end of file diff --git a/injitest/src/test/java/androidTestCases/VerifyHelpPageTest.java b/injitest/src/test/java/androidTestCases/VerifyHelpPageTest.java new file mode 100644 index 0000000000..34f515a5b9 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/VerifyHelpPageTest.java @@ -0,0 +1,49 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +public class VerifyHelpPageTest extends AndroidBaseTest { + + @Test + public void verifyHelpPage() { + + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + HelpPage helpPage = homePage.clickOnHelpIcon(); + + assertEquals(helpPage.ishelpPageContentEmpty(),false,"verifying text is not empty"); + helpPage.scrollPerformInHelpPage(); + + assertTrue(helpPage.isHelpPageLoaded(), "Verify if help page is displayed"); + helpPage.exitHelpPage(); + + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + } + +} diff --git a/injitest/src/test/java/androidTestCases/VerifyHistoryTest.java b/injitest/src/test/java/androidTestCases/VerifyHistoryTest.java new file mode 100644 index 0000000000..01dea4f6a1 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/VerifyHistoryTest.java @@ -0,0 +1,209 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +public class VerifyHistoryTest extends AndroidBaseTest { + @Test + public void downloadVcAndVerifyHistory() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + HistoryPage historyPage = homePage.clickOnHistoryButton(); + + assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); + assertTrue(historyPage.verifyHistory(TestDataReader.readData("uin"), Target.ANDROID)); + + } + + @Test + public void verifyActivationFailedRecordInHistory() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnActivationPending(); + + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); + + assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerificationPage.enterOtp(TestDataReader.readData("invalidOtp"), Target.ANDROID); + + assertTrue(otpVerificationPage.somethingWetWrongInVcActivationDisplayed(), "Verify if Something is wrong. Please try again later displayed"); + assertTrue(otpVerificationPage.isCancelButtonDisplayed(), "Verify if cancel button is displayed"); + + HistoryPage historyPage = otpVerificationPage.clickOnCancelButton().clickOnCloseButton().clickOnHistoryButton(); + assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); + assertTrue(historyPage.verifyActivationFailedRecordInHistory(TestDataReader.readData("uin"), Target.ANDROID)); + } + + @Test + public void verifyActivationFailedRecordInHistoryFromDetailedView() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + DetailedVcViewPage detailedVcViewPage = homePage.openDetailedVcView(TestDataReader.readData("fullName")); + assertTrue(detailedVcViewPage.isDetailedVcViewPageLoaded(), "Verify if detailed Vc view page is displayed"); + PleaseConfirmPopupPage pleaseConfirmPopupPage = detailedVcViewPage.clickOnActivateButton(); + + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); + + assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerificationPage.enterOtp(TestDataReader.readData("invalidOtp"), Target.ANDROID); + + assertTrue(otpVerificationPage.somethingWetWrongInVcActivationDisplayed(), "Verify if Something is wrong. Please try again later displayed"); + assertTrue(otpVerificationPage.isCancelButtonDisplayed(), "Verify if cancel button is displayed"); + + otpVerificationPage.clickOnCancelButton(); + HistoryPage historyPage = detailedVcViewPage.clickOnCrossIcon().clickOnHistoryButton(); + assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); + assertTrue(historyPage.verifyActivationFailedRecordInHistory(TestDataReader.readData("uin"), Target.ANDROID)); + } + + @Test + public void activateVcAndVerifyInHistory() throws InterruptedException { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + + AddNewCardPage addNewCardPage = homePage.downloadCard(); + + assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed"); + RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); + + assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); + OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); + + assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.ANDROID); + + assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); + MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); + + assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed"); + PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnActivationPending(); + + assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed"); + OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); + + assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); + otpVerificationPage.enterOtp(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(moreOptionsPage.isVcActivatedForOnlineLogin(), "Verify if VC is activated"); + HistoryPage historyPage = moreOptionsPage.clickOnCloseButton().clickOnHistoryButton(); + assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); + assertTrue(historyPage.verifyActivationSuccessfulRecordInHistory(TestDataReader.readData("uin"), Target.ANDROID)); + + } + +} diff --git a/injitest/src/test/java/androidTestCases/VerifyWelcomePagesTest.java b/injitest/src/test/java/androidTestCases/VerifyWelcomePagesTest.java new file mode 100644 index 0000000000..6ad8a7c3d6 --- /dev/null +++ b/injitest/src/test/java/androidTestCases/VerifyWelcomePagesTest.java @@ -0,0 +1,165 @@ +package androidTestCases; + +import BaseTest.AndroidBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +import static org.testng.Assert.*; + +public class VerifyWelcomePagesTest extends AndroidBaseTest { + + @Test + public void verifyWelcomePagesContent() { + + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + assertEquals(welcomePage.getWelcomeDescription(), "Keep your digital credential with you at all times. Inji helps you manage and use them effectively. To get started, add cards to your profile."); + welcomePage.clickOnNextButton(); + + TrustedDigitalWalletPage trustedDigitalWalletPage = new TrustedDigitalWalletPage(driver); + assertTrue(trustedDigitalWalletPage.isTrustedDigitalWalletPageLoaded(), "Verify if trusted digital wallet page is loaded"); + assertEquals(trustedDigitalWalletPage.getTrustedDigitalWalletDescription(), "Store and carry all your important cards in a single trusted wallet."); + trustedDigitalWalletPage.clickOnNextButton(); + + SecureSharingPage secureSharingPage = new SecureSharingPage(driver); + assertTrue(secureSharingPage.isSecureSharingPageLoaded(), "Verify if secure sharing page is loaded"); + assertEquals(secureSharingPage.getSecureSharingDescription(), "Share your cards securely in a hassle free way and avail various services."); + secureSharingPage.clickOnNextButton(); + + HassleFreeAuthenticationPage hassleFreeAuthenticationPage = new HassleFreeAuthenticationPage(driver); + assertTrue(hassleFreeAuthenticationPage.isHassleFreeAuthenticationPageLoaded(), "Verify if hassle free authentication page is loaded"); + assertEquals(hassleFreeAuthenticationPage.getHassleFreeAuthenticationDescription(), "Authenticate yourself with ease using the stored digital credential."); + } + @Test + public void verifyWelcomePagesFromInjiTourGuide() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + settingsPage.clickOnInjiTourGuide(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + assertEquals(welcomePage.getWelcomeDescription(), "Keep your digital credential with you at all times. Inji helps you manage and use them effectively. To get started, add cards to your profile."); + welcomePage.clickOnNextButton(); + + TrustedDigitalWalletPage trustedDigitalWalletPage = new TrustedDigitalWalletPage(driver); + assertTrue(trustedDigitalWalletPage.isTrustedDigitalWalletPageLoaded(), "Verify if trusted digital wallet page is loaded"); + assertEquals(trustedDigitalWalletPage.getTrustedDigitalWalletDescription(), "Store and carry all your important cards in a single trusted wallet."); + trustedDigitalWalletPage.clickOnNextButton(); + + SecureSharingPage secureSharingPage = new SecureSharingPage(driver); + assertTrue(secureSharingPage.isSecureSharingPageLoaded(), "Verify if secure sharing page is loaded"); + assertEquals(secureSharingPage.getSecureSharingDescription(), "Share your cards securely in a hassle free way and avail various services."); + secureSharingPage.clickOnNextButton(); + + HassleFreeAuthenticationPage hassleFreeAuthenticationPage = new HassleFreeAuthenticationPage(driver); + assertTrue(hassleFreeAuthenticationPage.isHassleFreeAuthenticationPageLoaded(), "Verify if hassle free authentication page is loaded"); + assertEquals(hassleFreeAuthenticationPage.getHassleFreeAuthenticationDescription(), "Authenticate yourself with ease using the stored digital credential."); + } + + @Test + public void verifyGoBackFromInjiTourGuide() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + settingsPage.clickOnInjiTourGuide(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + assertEquals(welcomePage.getWelcomeDescription(), "Keep your digital credential with you at all times. Inji helps you manage and use them effectively. To get started, add cards to your profile."); + welcomePage.clickOnNextButton(); + + TrustedDigitalWalletPage trustedDigitalWalletPage = new TrustedDigitalWalletPage(driver); + assertTrue(trustedDigitalWalletPage.isTrustedDigitalWalletPageLoaded(), "Verify if trusted digital wallet page is loaded"); + + assertEquals(trustedDigitalWalletPage.getTrustedDigitalWalletDescription(), "Store and carry all your important cards in a single trusted wallet."); + trustedDigitalWalletPage.clickOnNextButton(); + + SecureSharingPage secureSharingPage = new SecureSharingPage(driver); + assertTrue(secureSharingPage.isSecureSharingPageLoaded(), "Verify if secure sharing page is loaded"); + + assertEquals(secureSharingPage.getSecureSharingDescription(), "Share your cards securely in a hassle free way and avail various services."); + secureSharingPage.clickOnNextButton(); + + HassleFreeAuthenticationPage hassleFreeAuthenticationPage = new HassleFreeAuthenticationPage(driver); + assertTrue(hassleFreeAuthenticationPage.isHassleFreeAuthenticationPageLoaded(), "Verify if hassle free authentication page is loaded"); + assertEquals(hassleFreeAuthenticationPage.getHassleFreeAuthenticationDescription(), "Authenticate yourself with ease using the stored digital credential."); + + hassleFreeAuthenticationPage.clickOnGoBack(); + assertTrue(homePage.isNoVCDownloaded(), "Verify if get back to home page"); + } + + @Test + public void verifyClickOnBackFromInjiTourGuide() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.ANDROID); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + settingsPage.clickOnInjiTourGuide(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + assertEquals(welcomePage.getWelcomeDescription(), "Keep your digital credential with you at all times. Inji helps you manage and use them effectively. To get started, add cards to your profile."); + + welcomePage.clickOnBackButton(); + assertTrue(homePage.isNoVCDownloaded(), "Verify if get back to home page"); + } +} \ No newline at end of file diff --git a/injitest/src/test/java/iosTestCases/AboutInjiTest.java b/injitest/src/test/java/iosTestCases/AboutInjiTest.java new file mode 100644 index 0000000000..fbdba2a36d --- /dev/null +++ b/injitest/src/test/java/iosTestCases/AboutInjiTest.java @@ -0,0 +1,46 @@ +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +public class AboutInjiTest extends IosBaseTest { + @Test + public void copyAppId() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + AboutInjiPage aboutInjiPage = settingsPage.clickOnAbouInji(); + + assertTrue(aboutInjiPage.isaboutInjiHeaderDisplayed(),"Verify id about inji page displayed"); + + aboutInjiPage.clickOnCopy(); + assertTrue(aboutInjiPage.isAppidIsCopied(),"verify if app id is copied"); + + aboutInjiPage.clickOnBack(); + assertTrue(aboutInjiPage.isCopyTextDisplayed(),"verify if copy text displayed"); + } +} \ No newline at end of file diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/ActivateVcTest.java b/injitest/src/test/java/iosTestCases/ActivateVcTest.java similarity index 90% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/ActivateVcTest.java rename to injitest/src/test/java/iosTestCases/ActivateVcTest.java index 73bdae405e..91301db070 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/ActivateVcTest.java +++ b/injitest/src/test/java/iosTestCases/ActivateVcTest.java @@ -1,13 +1,16 @@ -package io.mosip.test.mob.inji.testcases; - -import io.mosip.test.mob.inji.api.BaseTestCase; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import static org.testng.Assert.*; +import static org.testng.Assert.assertTrue; -public class ActivateVcTest extends BaseTest { +public class ActivateVcTest extends IosBaseTest { @Test public void activateVc() throws InterruptedException { ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); @@ -22,10 +25,10 @@ public void activateVc() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -38,7 +41,7 @@ public void activateVc() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); @@ -50,7 +53,7 @@ public void activateVc() throws InterruptedException { OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerificationPage.enterOtp(TestDataReader.readData("passcode"), target); + otpVerificationPage.enterOtp(TestDataReader.readData("passcode"), Target.IOS); assertTrue(moreOptionsPage.isVcActivatedForOnlineLogin(), "Verify if VC is activated"); @@ -70,10 +73,10 @@ public void noPreDownloadedVCAndNoHistoryInFreshInstallation() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -100,10 +103,10 @@ public void verifyInvalidOtpMessage() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -116,7 +119,7 @@ public void verifyInvalidOtpMessage() { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(TestDataReader.readData("invalidOtp"), target); + otpVerification.enterOtp(TestDataReader.readData("invalidOtp"), Target.IOS); assertTrue(otpVerification.invalidOtpMessageDisplayed(), "Verify if OTP is invalid message is displayed"); @@ -136,10 +139,10 @@ public void activateVcFromDetailedViewPage() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -152,7 +155,7 @@ public void activateVcFromDetailedViewPage() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -164,7 +167,7 @@ public void activateVcFromDetailedViewPage() throws InterruptedException { OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerificationPage.enterOtp(TestDataReader.readData("passcode"), target); + otpVerificationPage.enterOtp(TestDataReader.readData("passcode"), Target.IOS); assertTrue(detailedVcViewPage.isProfileAuthenticatedDisplayed(), "Verify if VC is activated"); } diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/ChangeLanguageTest.java b/injitest/src/test/java/iosTestCases/ChangeLanguageTest.java similarity index 90% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/ChangeLanguageTest.java rename to injitest/src/test/java/iosTestCases/ChangeLanguageTest.java index c018716592..554c7a3974 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/ChangeLanguageTest.java +++ b/injitest/src/test/java/iosTestCases/ChangeLanguageTest.java @@ -1,12 +1,15 @@ -package io.mosip.test.mob.inji.testcases; +package iosTestCases; +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; import static org.testng.Assert.assertTrue; -public class ChangeLanguageTest extends BaseTest { +public class ChangeLanguageTest extends IosBaseTest { @Test public void changeLanguage() { @@ -22,10 +25,10 @@ public void changeLanguage() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -50,10 +53,10 @@ public void languageShouldBeInNativeLanguages() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -78,10 +81,10 @@ public void verifyTuvaliVersion() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -104,10 +107,10 @@ public void changeLanguageToArabic() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/DeletingVcTest.java b/injitest/src/test/java/iosTestCases/DeletingVcTest.java similarity index 88% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/DeletingVcTest.java rename to injitest/src/test/java/iosTestCases/DeletingVcTest.java index ced5f0d415..06dd95cc6d 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/DeletingVcTest.java +++ b/injitest/src/test/java/iosTestCases/DeletingVcTest.java @@ -1,16 +1,16 @@ -package io.mosip.test.mob.inji.testcases; - +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.api.BaseTestCase; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; +import static org.testng.Assert.*; -public class DeletingVcTest extends BaseTest { +public class DeletingVcTest extends IosBaseTest { @Test public void deleteVcAndVerifyInHistory() throws InterruptedException { ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); @@ -25,10 +25,10 @@ public void deleteVcAndVerifyInHistory() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -40,7 +40,7 @@ public void deleteVcAndVerifyInHistory() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -55,8 +55,8 @@ public void deleteVcAndVerifyInHistory() throws InterruptedException { HistoryPage historyPage = homePage.clickOnHistoryButton(); assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); - historyPage.verifyHistory(TestDataReader.readData("uin") + " Removed from wallet", target); - assertTrue(historyPage.verifyDeleteHistory(TestDataReader.readData("uin"), target), "Verify if deleted history is displayed"); + historyPage.verifyHistory(TestDataReader.readData("uin") + " Removed from wallet", Target.IOS); + assertTrue(historyPage.verifyDeleteHistory(TestDataReader.readData("uin"), Target.IOS), "Verify if deleted history is displayed"); } @@ -74,10 +74,10 @@ public void cancelDeleteVc() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -89,7 +89,7 @@ public void cancelDeleteVc() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -120,10 +120,10 @@ public void DownloadingDeletedVc() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -135,7 +135,7 @@ public void DownloadingDeletedVc() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -157,16 +157,16 @@ public void DownloadingDeletedVc() throws InterruptedException { retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); HistoryPage historyPage = homePage.clickOnHistoryButton(); assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); - assertTrue(historyPage.verifyHistory(TestDataReader.readData("uin"), target)); + assertTrue(historyPage.verifyHistory(TestDataReader.readData("uin"), Target.IOS)); - assertEquals(historyPage.getNumberOfRecordsInHistory(TestDataReader.readData("uin"), target), 2,"Verify two download records in history page"); - assertTrue(historyPage.verifyDeleteHistory(TestDataReader.readData("uin"), target), "Verify if deleted history is displayed"); + assertEquals(historyPage.getNumberOfRecordsInHistory(TestDataReader.readData("uin"), Target.IOS), 2,"Verify two download records in history page"); + assertTrue(historyPage.verifyDeleteHistory(TestDataReader.readData("uin"), Target.IOS), "Verify if deleted history is displayed"); } } \ No newline at end of file diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/GenerateUinOrVidTest.java b/injitest/src/test/java/iosTestCases/GenerateUinOrVidTest.java similarity index 88% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/GenerateUinOrVidTest.java rename to injitest/src/test/java/iosTestCases/GenerateUinOrVidTest.java index 4b2dcbe72c..7c7dcdcd38 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/GenerateUinOrVidTest.java +++ b/injitest/src/test/java/iosTestCases/GenerateUinOrVidTest.java @@ -1,14 +1,16 @@ -package io.mosip.test.mob.inji.testcases; - +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.api.BaseTestCase; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; - import static org.testng.Assert.assertTrue; -public class GenerateUinOrVidTest extends BaseTest { +public class GenerateUinOrVidTest extends IosBaseTest { @Test public void generateUinOrVidUsingAid() { @@ -24,10 +26,10 @@ public void generateUinOrVidUsingAid() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -42,13 +44,13 @@ public void generateUinOrVidUsingAid() { OtpVerificationPage otpVerification = generateUinOrVidPage.enterApplicationID(TestDataReader.readData("aid")).clickOnGetUinOrVidButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); retrieveIdPage.clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -68,10 +70,10 @@ public void goBackToGenerateUinOrVidUsingAidFromOtpVerificationPage() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/NoNetworkAndroidTest.java b/injitest/src/test/java/iosTestCases/NoNetworkAndroidTest.java similarity index 92% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/NoNetworkAndroidTest.java rename to injitest/src/test/java/iosTestCases/NoNetworkAndroidTest.java index e763fea37d..f013fd6842 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/NoNetworkAndroidTest.java +++ b/injitest/src/test/java/iosTestCases/NoNetworkAndroidTest.java @@ -1,14 +1,17 @@ -package io.mosip.test.mob.inji.testcases; - -import io.mosip.test.mob.inji.api.BaseTestCase; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.CommonMethods; -import io.mosip.test.mob.inji.utils.TestDataReader; +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.CommonMethods; +import inji.utils.TestDataReader; import org.testng.annotations.Test; import static org.testng.Assert.assertTrue; -public class NoNetworkAndroidTest extends BaseTest { +public class NoNetworkAndroidTest extends IosBaseTest { @Test public void setupPasscodeAndDownloadCardWithoutInternet() { @@ -26,10 +29,10 @@ public void setupPasscodeAndDownloadCardWithoutInternet() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -61,10 +64,10 @@ public void openCameraOnFlightMode() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -76,7 +79,7 @@ public void openCameraOnFlightMode() { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -98,10 +101,10 @@ public void activateVcWithoutInternet() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -114,7 +117,7 @@ public void activateVcWithoutInternet() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); CommonMethods.enableAirplaneMode(); @@ -147,10 +150,10 @@ public void verifyListOfLanguagesInOfflineMode() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -178,10 +181,10 @@ public void verifyHelpPageOfflineMode() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); HelpPage helpPage = homePage.clickOnHelpIcon(); @@ -207,10 +210,10 @@ public void deleteDownloadedVcInOfflineMode() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -222,7 +225,7 @@ public void deleteDownloadedVcInOfflineMode() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); CommonMethods.enableAirplaneMode(); @@ -253,10 +256,10 @@ public void openQrOffline() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -269,7 +272,7 @@ public void openQrOffline() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); CommonMethods.enableAirplaneMode(); @@ -299,10 +302,10 @@ public void verifyRecivedCardOffline() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -330,10 +333,10 @@ public void downloadCardWithoutInternetRetryWithInternet() throws InterruptedExc SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/PinVcTest.java b/injitest/src/test/java/iosTestCases/PinVcTest.java similarity index 87% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/PinVcTest.java rename to injitest/src/test/java/iosTestCases/PinVcTest.java index a46aafc5aa..e17daf5aed 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/PinVcTest.java +++ b/injitest/src/test/java/iosTestCases/PinVcTest.java @@ -1,14 +1,16 @@ -package io.mosip.test.mob.inji.testcases; - +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.api.BaseTestCase; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; - import static org.testng.Assert.assertTrue; -public class PinVcTest extends BaseTest { +public class PinVcTest extends IosBaseTest { @Test public void pinVc() throws InterruptedException { @@ -25,10 +27,10 @@ public void pinVc() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -40,7 +42,7 @@ public void pinVc() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); @@ -51,6 +53,7 @@ public void pinVc() throws InterruptedException { assertTrue(homePage.isPinIconDisplayed(), "Verify if pin icon on vc is displayed"); } + //For IOS bluetooth does not support in simulator, so we can't automate @Test public void VerifyCameraOpenAfterPinVc() throws InterruptedException { ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); @@ -65,10 +68,10 @@ public void VerifyCameraOpenAfterPinVc() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -80,7 +83,7 @@ public void VerifyCameraOpenAfterPinVc() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); diff --git a/injitest/src/test/java/iosTestCases/ReceiveCardTest.java b/injitest/src/test/java/iosTestCases/ReceiveCardTest.java new file mode 100644 index 0000000000..8ab153bbe5 --- /dev/null +++ b/injitest/src/test/java/iosTestCases/ReceiveCardTest.java @@ -0,0 +1,71 @@ +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +public class ReceiveCardTest extends IosBaseTest { + + @Test + public void verifyRecivedCardAndQrCode() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + ReceiveCardPage receiveCardPage = settingsPage.clickOnReceiveCard(); + assertTrue(receiveCardPage.isReceiveCardHederDisplayed(), "Verify if QR code header is displayed"); + assertTrue(receiveCardPage.isWaitingForConnectionDisplayed(), "Verify if waiting for connection displayed"); + } + + @Test + public void verifyRecivedCardAndQrCodeInFilipinoLanguage() { + ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); + + assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed"); + WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference(); + + assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded"); + AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton(); + + assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed"); + SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); + + assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); + + assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); + + assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); + SettingsPage settingsPage = homePage.clickOnSettingIcon(); + + assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed"); + settingsPage.clickOnLanguage().clickOnFilipinoLanguage(); + + assertTrue(settingsPage.verifyFilipinoLanguage(), "Verify if language is changed to filipino"); + ReceiveCardPage receiveCardPage =settingsPage.clickOnReceiveCardFilipinoLanguage(); + + assertTrue(receiveCardPage.isReceiveCardHederInFilipinoLanguageDisplayed(), "Verify if QR code header is displayed filipino"); + } +} diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/ShareVcTest.java b/injitest/src/test/java/iosTestCases/ShareVcTest.java similarity index 87% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/ShareVcTest.java rename to injitest/src/test/java/iosTestCases/ShareVcTest.java index c900f41ed2..15c7ef0d5a 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/ShareVcTest.java +++ b/injitest/src/test/java/iosTestCases/ShareVcTest.java @@ -1,12 +1,15 @@ -package io.mosip.test.mob.inji.testcases; +package iosTestCases; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; import static org.testng.Assert.assertTrue; -public class ShareVcTest extends BaseTest{ +public class ShareVcTest extends IosBaseTest { @Test public void noCardsAvailableToShare() { @@ -22,10 +25,10 @@ public void noCardsAvailableToShare() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); ScanPage scanPage = homePage.clickOnScanButton(); @@ -46,10 +49,10 @@ public void verifyReceivedCardTabPresent() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/UnlockWithPasscodeTest.java b/injitest/src/test/java/iosTestCases/UnlockWithPasscodeTest.java similarity index 88% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/UnlockWithPasscodeTest.java rename to injitest/src/test/java/iosTestCases/UnlockWithPasscodeTest.java index 1e8f96b496..6f4623995f 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/UnlockWithPasscodeTest.java +++ b/injitest/src/test/java/iosTestCases/UnlockWithPasscodeTest.java @@ -1,12 +1,15 @@ -package io.mosip.test.mob.inji.testcases; +package iosTestCases; +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; import static org.testng.Assert.assertTrue; -public class UnlockWithPasscodeTest extends BaseTest { +public class UnlockWithPasscodeTest extends IosBaseTest { @Test public void logoutAndLoginWithPasscode() { @@ -22,10 +25,10 @@ public void logoutAndLoginWithPasscode() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -37,7 +40,7 @@ public void logoutAndLoginWithPasscode() { EnterYourPasscodePage enterYourPasscodePage = unlockApplicationPage.clickOnUnlockApplicationButton(); assertTrue(enterYourPasscodePage.isEnterYourPasscodePageLoaded(), "Verify if enter your passcode page is displayed"); - enterYourPasscodePage.enterYourPasscode(TestDataReader.readData("passcode"), target); + enterYourPasscodePage.enterYourPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -57,10 +60,10 @@ public void loginWithInvalidPasscode() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -72,7 +75,7 @@ public void loginWithInvalidPasscode() { EnterYourPasscodePage enterYourPasscodePage = unlockApplicationPage.clickOnUnlockApplicationButton(); assertTrue(enterYourPasscodePage.isEnterYourPasscodePageLoaded(), "Verify if enter your passcode page is displayed"); - enterYourPasscodePage.enterYourPasscode(TestDataReader.readData("invalidPasscode"), target); + enterYourPasscodePage.enterYourPasscode(TestDataReader.readData("invalidPasscode"), Target.IOS); assertTrue(confirmPasscode.isPasscodeInvalidMessageDisplayed(), "verify if invalid passcode is displayed"); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VcDownloadAndVerifyUsingUinTest.java b/injitest/src/test/java/iosTestCases/VcDownloadAndVerifyUsingUinTest.java similarity index 91% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/VcDownloadAndVerifyUsingUinTest.java rename to injitest/src/test/java/iosTestCases/VcDownloadAndVerifyUsingUinTest.java index 7350bad702..218401c0ae 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VcDownloadAndVerifyUsingUinTest.java +++ b/injitest/src/test/java/iosTestCases/VcDownloadAndVerifyUsingUinTest.java @@ -1,15 +1,17 @@ -package io.mosip.test.mob.inji.testcases; - +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.api.BaseTestCase; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; - import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; -public class VcDownloadAndVerifyUsingUinTest extends BaseTest { +public class VcDownloadAndVerifyUsingUinTest extends IosBaseTest { @Test public void downloadAndVerifyVcUsingUin() { ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); @@ -24,10 +26,10 @@ public void downloadAndVerifyVcUsingUin() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -39,7 +41,7 @@ public void downloadAndVerifyVcUsingUin() { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); assertTrue(homePage.isIdTypeDisplayed(), "Verify if id type is displayed"); @@ -75,10 +77,10 @@ public void downloadMultipleVcUsingDifferentUin() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -90,7 +92,7 @@ public void downloadMultipleVcUsingDifferentUin() { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -103,7 +105,7 @@ public void downloadMultipleVcUsingDifferentUin() { retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin2")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("uin2FullName")), "Verify if second VC is displayed"); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verifying again if first VC is still exists."); @@ -124,10 +126,10 @@ public void downloadWithEmptyUin() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -155,10 +157,10 @@ public void generateMultipleVcWithSameUin() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -170,7 +172,7 @@ public void generateMultipleVcWithSameUin() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -183,14 +185,14 @@ public void generateMultipleVcWithSameUin() throws InterruptedException { retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isSecondNameDisplayed(TestDataReader.readData("fullName")), "Verify if second card name is displayed"); HistoryPage historyPage = homePage.clickOnHistoryButton(); assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); - assertEquals(historyPage.getNumberOfRecordsInHistory(TestDataReader.readData("uin"), target),2, "Verify two download records in history page"); + assertEquals(historyPage.getNumberOfRecordsInHistory(TestDataReader.readData("uin"), Target.IOS),2, "Verify two download records in history page"); } @@ -208,10 +210,10 @@ public void verifyInvalidUinErrorMessage() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VcDownloadAndVerifyUsingVidTest.java b/injitest/src/test/java/iosTestCases/VcDownloadAndVerifyUsingVidTest.java similarity index 86% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/VcDownloadAndVerifyUsingVidTest.java rename to injitest/src/test/java/iosTestCases/VcDownloadAndVerifyUsingVidTest.java index ae80cd8ea7..554bb06217 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VcDownloadAndVerifyUsingVidTest.java +++ b/injitest/src/test/java/iosTestCases/VcDownloadAndVerifyUsingVidTest.java @@ -1,14 +1,17 @@ -package io.mosip.test.mob.inji.testcases; - +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.api.BaseTestCase; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; -public class VcDownloadAndVerifyUsingVidTest extends BaseTest { +public class VcDownloadAndVerifyUsingVidTest extends IosBaseTest { @Test public void downloadAndVerifyVcUsingVid() { ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); @@ -23,10 +26,10 @@ public void downloadAndVerifyVcUsingVid() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -35,10 +38,10 @@ public void downloadAndVerifyVcUsingVid() { RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); - OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(target).setEnterIdTextBox(BaseTestCase.perpetualVid).clickOnGenerateCardButton(); + OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(Target.IOS).setEnterIdTextBox(BaseTestCase.perpetualVid).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); DetailedVcViewPage detailedVcViewPage = homePage.openDetailedVcView(TestDataReader.readData("fullName")); @@ -60,10 +63,10 @@ public void downloadTwoVcDeleteOneUsingVid() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -72,10 +75,10 @@ public void downloadTwoVcDeleteOneUsingVid() throws InterruptedException { RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); - OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(target).setEnterIdTextBox(BaseTestCase.perpetualVid).clickOnGenerateCardButton(); + OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(Target.IOS).setEnterIdTextBox(BaseTestCase.perpetualVid).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); @@ -85,10 +88,10 @@ public void downloadTwoVcDeleteOneUsingVid() throws InterruptedException { addNewCardPage.clickOnDownloadViaUin(); assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); - retrieveIdPage.clickOnVid(target).setEnterIdTextBox(BaseTestCase.perpetualVid).clickOnGenerateCardButton(); + retrieveIdPage.clickOnVid(Target.IOS).setEnterIdTextBox(BaseTestCase.perpetualVid).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); // @@ -117,10 +120,10 @@ public void verifyInvalidVidErrorMessage() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -129,7 +132,7 @@ public void verifyInvalidVidErrorMessage() { RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); - OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(target).setEnterIdTextBox("00").clickOnGenerateCardButton(); + OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(Target.IOS).setEnterIdTextBox("00").clickOnGenerateCardButton(); assertTrue(retrieveIdPage.isIncorrectInputFormatErrorMessageDisplayed()); } @@ -148,10 +151,10 @@ public void downloadAndVerifyVcUsingRevokeVid() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -160,7 +163,7 @@ public void downloadAndVerifyVcUsingRevokeVid() { RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin(); assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed"); - OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(target).setEnterIdTextBox(TestDataReader.readData("revokevid")).clickOnGenerateCardButton(); + OtpVerificationPage otpVerification = retrieveIdPage.clickOnVid(Target.IOS).setEnterIdTextBox(TestDataReader.readData("revokevid")).clickOnGenerateCardButton(); assertTrue(otpVerification.vidNotAvailableDisplayed(), "Verify if vid is not available message displayed"); } diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VerifyHelpPageTest.java b/injitest/src/test/java/iosTestCases/VerifyHelpPageTest.java similarity index 83% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/VerifyHelpPageTest.java rename to injitest/src/test/java/iosTestCases/VerifyHelpPageTest.java index 54a00f7cc4..8ddd0c363a 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VerifyHelpPageTest.java +++ b/injitest/src/test/java/iosTestCases/VerifyHelpPageTest.java @@ -1,13 +1,16 @@ -package io.mosip.test.mob.inji.testcases; +package iosTestCases; +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; -public class VerifyHelpPageTest extends BaseTest { +public class VerifyHelpPageTest extends IosBaseTest { @Test public void verifyHelpPage() { @@ -24,10 +27,10 @@ public void verifyHelpPage() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); HelpPage helpPage = homePage.clickOnHelpIcon(); diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VerifyHistoryTest.java b/injitest/src/test/java/iosTestCases/VerifyHistoryTest.java similarity index 90% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/VerifyHistoryTest.java rename to injitest/src/test/java/iosTestCases/VerifyHistoryTest.java index 87bd026d5f..f40971d39a 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VerifyHistoryTest.java +++ b/injitest/src/test/java/iosTestCases/VerifyHistoryTest.java @@ -1,14 +1,16 @@ -package io.mosip.test.mob.inji.testcases; - +package iosTestCases; + +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.api.BaseTestCase; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.api.BaseTestCase; -import io.mosip.test.mob.inji.pages.*; -import io.mosip.test.mob.inji.utils.TestDataReader; - import static org.testng.Assert.assertTrue; -public class VerifyHistoryTest extends BaseTest { +public class VerifyHistoryTest extends IosBaseTest { @Test public void downloadVcAndVerifyHistory() { ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver); @@ -23,10 +25,10 @@ public void downloadVcAndVerifyHistory() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); AddNewCardPage addNewCardPage = homePage.downloadCard(); @@ -38,13 +40,13 @@ public void downloadVcAndVerifyHistory() { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); HistoryPage historyPage = homePage.clickOnHistoryButton(); assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); - assertTrue(historyPage.verifyHistory(TestDataReader.readData("uin"), target)); + assertTrue(historyPage.verifyHistory(TestDataReader.readData("uin"), Target.IOS)); } @@ -62,10 +64,10 @@ public void verifyActivationFailedRecordInHistory() throws InterruptedException SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -78,7 +80,7 @@ public void verifyActivationFailedRecordInHistory() throws InterruptedException OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); @@ -90,14 +92,14 @@ public void verifyActivationFailedRecordInHistory() throws InterruptedException OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerificationPage.enterOtp(TestDataReader.readData("invalidOtp"), target); + otpVerificationPage.enterOtp(TestDataReader.readData("invalidOtp"), Target.IOS); assertTrue(otpVerificationPage.somethingWetWrongInVcActivationDisplayed(), "Verify if Something is wrong. Please try again later displayed"); assertTrue(otpVerificationPage.isCancelButtonDisplayed(), "Verify if cancel button is displayed"); HistoryPage historyPage = otpVerificationPage.clickOnCancelButton().clickOnCloseButton().clickOnHistoryButton(); assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); - assertTrue(historyPage.verifyActivationFailedRecordInHistory(TestDataReader.readData("uin"), target)); + assertTrue(historyPage.verifyActivationFailedRecordInHistory(TestDataReader.readData("uin"), Target.IOS)); } @Test @@ -114,10 +116,10 @@ public void verifyActivationFailedRecordInHistoryFromDetailedView() throws Inter SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -130,7 +132,7 @@ public void verifyActivationFailedRecordInHistoryFromDetailedView() throws Inter OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); DetailedVcViewPage detailedVcViewPage = homePage.openDetailedVcView(TestDataReader.readData("fullName")); @@ -141,7 +143,7 @@ public void verifyActivationFailedRecordInHistoryFromDetailedView() throws Inter OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerificationPage.enterOtp(TestDataReader.readData("invalidOtp"), target); + otpVerificationPage.enterOtp(TestDataReader.readData("invalidOtp"), Target.IOS); assertTrue(otpVerificationPage.somethingWetWrongInVcActivationDisplayed(), "Verify if Something is wrong. Please try again later displayed"); assertTrue(otpVerificationPage.isCancelButtonDisplayed(), "Verify if cancel button is displayed"); @@ -149,7 +151,7 @@ public void verifyActivationFailedRecordInHistoryFromDetailedView() throws Inter otpVerificationPage.clickOnCancelButton(); HistoryPage historyPage = detailedVcViewPage.clickOnCrossIcon().clickOnHistoryButton(); assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); - assertTrue(historyPage.verifyActivationFailedRecordInHistory(TestDataReader.readData("uin"), target)); + assertTrue(historyPage.verifyActivationFailedRecordInHistory(TestDataReader.readData("uin"), Target.IOS)); } @Test @@ -166,10 +168,10 @@ public void activateVcAndVerifyInHistory() throws InterruptedException { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); @@ -182,7 +184,7 @@ public void activateVcAndVerifyInHistory() throws InterruptedException { OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(TestDataReader.readData("uin")).clickOnGenerateCardButton(); assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerification.enterOtp(BaseTestCase.getOtp(), target); + otpVerification.enterOtp(BaseTestCase.getOtp(), Target.IOS); assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed"); MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton(); @@ -194,12 +196,12 @@ public void activateVcAndVerifyInHistory() throws InterruptedException { OtpVerificationPage otpVerificationPage = pleaseConfirmPopupPage.clickOnConfirmButton(); assertTrue(otpVerificationPage.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed"); - otpVerificationPage.enterOtp(TestDataReader.readData("passcode"), target); + otpVerificationPage.enterOtp(TestDataReader.readData("passcode"), Target.IOS); assertTrue(moreOptionsPage.isVcActivatedForOnlineLogin(), "Verify if VC is activated"); HistoryPage historyPage = moreOptionsPage.clickOnCloseButton().clickOnHistoryButton(); assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed"); - assertTrue(historyPage.verifyActivationSuccessfulRecordInHistory(TestDataReader.readData("uin"), target)); + assertTrue(historyPage.verifyActivationSuccessfulRecordInHistory(TestDataReader.readData("uin"), Target.IOS)); } diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VerifyWelcomePagesTest.java b/injitest/src/test/java/iosTestCases/VerifyWelcomePagesTest.java similarity index 94% rename from injitest/src/main/java/io/mosip/test/mob/inji/testcases/VerifyWelcomePagesTest.java rename to injitest/src/test/java/iosTestCases/VerifyWelcomePagesTest.java index 7337d78fa9..6c598f028d 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/testcases/VerifyWelcomePagesTest.java +++ b/injitest/src/test/java/iosTestCases/VerifyWelcomePagesTest.java @@ -1,13 +1,16 @@ -package io.mosip.test.mob.inji.testcases; +package iosTestCases; -import io.mosip.test.mob.inji.utils.TestDataReader; +import BaseTest.AndroidBaseTest; +import BaseTest.IosBaseTest; +import inji.constants.Target; +import inji.pages.*; +import inji.utils.TestDataReader; import org.testng.annotations.Test; -import io.mosip.test.mob.inji.pages.*; -import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; -public class VerifyWelcomePagesTest extends BaseTest { +public class VerifyWelcomePagesTest extends IosBaseTest { @Test public void verifyWelcomePagesContent() { @@ -48,10 +51,10 @@ public void verifyWelcomePagesFromInjiTourGuide() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -92,10 +95,10 @@ public void verifyGoBackFromInjiTourGuide() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); @@ -141,10 +144,10 @@ public void verifyClickOnBackFromInjiTourGuide() { SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode(); assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed"); - ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target); + ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed"); - HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target); + HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), Target.IOS); assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed"); SettingsPage settingsPage = homePage.clickOnSettingIcon(); diff --git a/injitest/testng.xml b/injitest/testng.xml index 0e9c7b76eb..cfc25f2390 100644 --- a/injitest/testng.xml +++ b/injitest/testng.xml @@ -2,55 +2,55 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -58,13 +58,13 @@ - + - + @@ -72,40 +72,40 @@ - + - + - + - + - + - - + + - + @@ -117,13 +117,13 @@ - + - +