Best JavaScript code snippet using appium-xcuitest-driver
TC_Reg_06.registration.test.js
Source:TC_Reg_06.registration.test.js
...66 networkProfile: networkSet.highInternet67 }))68 console.log('--- ---- Device: ' + DeviceName)69 console.log('--- ---- PlatformVersion: ' + PlatformVersion)70 await driver.setImplicitWaitTimeout(10000)71 ssid = await driver.getSessionId()72 console.log('--started-->' + ssid)73 const registerBtn = await driver.elementByAccessibilityId(registerAccessibilityId.register)74 const btnLogin = await driver.elementByAccessibilityId(registerAccessibilityId.login)75 assert.equal(await registerBtn.isDisplayed() && await btnLogin.isDisplayed(), true, 'Application launch successfully.')76 })77 it('TC_Reg_02 : To Verify "Register" button functionality', async function () {78 await driver.setImplicitWaitTimeout(3000)79 const register = await driver.elementByAccessibilityId(registerAccessibilityId.register)80 await register.click()81 console.log('Clicked on \'Register\' button.')82 const mobileNo = await driver.elementByAccessibilityId(registerAccessibilityId.phone)83 const pswd = await driver.elementByAccessibilityId(registerAccessibilityId.password)84 const checkBox = await driver.elementByAccessibilityId(registerAccessibilityId.aggrementCheckbox)85 //const login = await driver.elementByXPath(registerXPath.login)86 const login = await driver.elementByAccessibilityId(registerAccessibilityId.loginlink)87 assert.equal(await mobileNo.isDisplayed() && await pswd.isDisplayed() && await checkBox.isDisplayed() && await login.isDisplayed(), true, 'Successfully Redirected to Register page.')88 })89 it('TC_Reg_23 : To Verify "Register" button functionality with valid details.', async function () {90 await driver.setImplicitWaitTimeout(3000)91 const mobileNo = await driver.elementByAccessibilityId(registerAccessibilityId.phone)92 await sendKey(driver, mobileNo, mobileNumber)93 console.log('Entered Mobile number : ' + mobileNumber)94 await driver.setImplicitWaitTimeout(1000)95 const password = await driver.elementByAccessibilityId(registerAccessibilityId.password)96 await sendKey(driver, password, registrationDS.password)97 console.log('Entered Password. :' + registrationDS.password)98 await driver.setImplicitWaitTimeout(1000)99 const checkBox = await driver.elementByAccessibilityId(registerAccessibilityId.aggrementCheckbox)100 await checkBox.click()101 console.log('Checked licence-agreement checkbox.')102 await driver.setImplicitWaitTimeout(1000)103 const registerBtn = await driver.elementByAccessibilityId(registerAccessibilityId.register)104 await registerBtn.click()105 console.log('Clicked on register Button.')106 await driver.setImplicitWaitTimeout(5000)107 const otp = await driver.elementByAccessibilityId(registerAccessibilityId.otp)108 assert.equal(await otp.isDisplayed(), true, 'Verification Code page displayed Successfully.')109 })110 it('TC_Reg_28, TC_Reg_29, TC_Reg_32 : To Verify by adding 6 digit code.', async function () {111 await driver.setImplicitWaitTimeout(3000)112 const otpField = await driver.elementByAccessibilityId(registerAccessibilityId.otp)113 await sendKey(driver, otpField, registrationDS.validOTP)114 console.log('Entered OTP number.' + registrationDS.validOTP)115 await driver.setImplicitWaitTimeout(1000)116 const tickMark = await driver.elementByAccessibilityId(registerAccessibilityId.tickMark)117 assert.equal(await tickMark.isDisplayed(), true, 'Tick Mark displayed Successfully.')118 await driver.setImplicitWaitTimeout(2000)119 const nextBtn = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)120 assert.equal(await nextBtn.isDisplayed(), true, 'Next Button displayed Successfully.')121 await nextBtn.click()122 console.log('Clicked on next button.')123 await driver.setImplicitWaitTimeout(5000)124 const personalDetails = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)125 assert.equal(await personalDetails.isDisplayed(), true, 'Successfully Personal Detail screen displayed.')126 })127 it('TC_Reg_33, TC_Reg_54 : To Verify details on personal details screen.', async function () {128 await driver.setImplicitWaitTimeout(1000)129 const firstNameField = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)130 await sendKey(driver, firstNameField, registrationDS.firstname)131 console.log('Entered firstName : ' + registrationDS.firstname)132 await driver.setImplicitWaitTimeout(1000)133 const lastNameField = await driver.elementByAccessibilityId(registerAccessibilityId.lastname)134 await sendKey(driver, lastNameField, registrationDS.lastname)135 console.log('Entered lastName :' + registrationDS.lastname)136 if (configuration.runOs == 'android') {137 await driver.setImplicitWaitTimeout(1000)138 const dobField = await driver.elementByAccessibilityId(registerAccessibilityId.birthdate)139 await dobField.click()140 console.log('Clicked on DOB text field.')141 await driver.setImplicitWaitTimeout(1000)142 const dobFieldOK = await driver.elementById(registerAccessibilityId.okbutton)143 await dobFieldOK.click()144 console.log('Clicked on DOB ok button.')145 } else {146 await driver.setImplicitWaitTimeout(1000)147 const dobField = await driver.elementByAccessibilityId(registerAccessibilityId.birthdate)148 await dobField.click()149 console.log('Clicked on DOB text field.')150 await driver.setImplicitWaitTimeout(2000)151 let dobmonth152 try {153 console.log('Inside Try.')154 dobmonth = await driver.elementByXPath(registerXPath.dobmonth)155 } catch {156 console.log('Inside catch.')157 dobmonth = await driver.elementByXPath(registerXPath.dobmonth1)158 }159 await sendKey(driver, dobmonth, registrationDS.DOBMonth)160 await driver.setImplicitWaitTimeout(1000)161 console.log('Select September month.')162 const blankSpace = await driver.elementByXPath(registerXPath.blankSpace)163 await blankSpace.click()164 console.log('Clicked on Blank Space.')165 }166 await driver.setImplicitWaitTimeout(1000)167 const emailField = await driver.elementByAccessibilityId(registerAccessibilityId.email)168 await sendKey(driver, emailField, registrationDS.email)169 console.log('Entered EmailID : ' + registrationDS.email)170 await driver.setImplicitWaitTimeout(1000)171 const backButton = await driver.elementByAccessibilityId(registerAccessibilityId.backButton)172 assert.equal(await backButton.isDisplayed(), true, 'Successfully back button displayed.')173 const nextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)174 await nextButton.click()175 console.log('Clicked on Next button.')176 await driver.setImplicitWaitTimeout(4000)177 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)178 const addressDetailsText = await driver.elementByAccessibilityId(registerAccessibilityId.addressDetailsText)179 const postalCodeNextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)180 assert.equal(await postalCode.isDisplayed() && await addressDetailsText.isDisplayed() && await postalCodeNextButton.isDisplayed(), true, 'Postal Code and Address details text is displayed successfully.')181 })182 it('TC_Reg_61, TC_Reg_62 : To Verify search icon functionality for valid postal code.', async function () {183 await driver.setImplicitWaitTimeout(2000)184 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)185 await sendKey(driver, postalCode, registrationDS.postalCode)186 console.log('Entered Postal Code : ' + registrationDS.postalCode)187 await driver.setImplicitWaitTimeout(2000)188 const searchIcon = await driver.elementByAccessibilityId(registerAccessibilityId.search)189 await searchIcon.click()190 console.log('Clicked on Search icon.')191 await driver.setImplicitWaitTimeout(10000)192 const selectAddress = await driver.elementByAccessibilityId(registerAccessibilityId.selectAddress)193 registrationVM.selectedAddressText = await selectAddress.text()194 console.log('Selected Address.' + registrationVM.selectedAddressText)195 var str1 = registrationVM.selectedAddressText.split(',')196 registrationVM.expectedBuildingName = str1[0].trim()197 registrationVM.expectedCityName = str1[1].trim()198 registrationVM.expectedCountryName = str1[2].trim()199 console.log('Expected Building Name, City Name, Country Name......')200 console.log('Expected Building Name : ' + registrationVM.expectedBuildingName)201 console.log('Expected City Name : ' + registrationVM.expectedCityName)202 console.log('Expected Country Name : ' + registrationVM.expectedCountryName)203 await selectAddress.click()204 console.log('Address Selected Successfully.')205 await driver.setImplicitWaitTimeout(3000)206 console.log('Actual Building Name, City Name, Country Name......')207 const buildingField = await driver.elementByAccessibilityId(registerAccessibilityId.building)208 registrationVM.actualBuildingName = await buildingField.text()209 console.log('Actual Building Name : ' + registrationVM.actualBuildingName)210 assert.equal(registrationVM.actualBuildingName, registrationVM.expectedBuildingName, ' Building Name is verified.')211 await driver.setImplicitWaitTimeout(2000)212 const cityField = await driver.elementByAccessibilityId(registerAccessibilityId.city)213 registrationVM.actualCityName = await cityField.text()214 console.log('Actual City Name : ' + registrationVM.actualCityName)215 assert.equal(registrationVM.actualCityName, registrationVM.expectedCityName, ' City Name is verified.')216 await driver.setImplicitWaitTimeout(2000)217 const countryField = await driver.elementByAccessibilityId(registerAccessibilityId.country)218 registrationVM.actualCountryName = await countryField.text()219 console.log('Actual Country Name : ' + registrationVM.actualCountryName)220 assert.equal(registrationVM.actualCountryName, registrationVM.expectedCountryName, ' Country Name is verified.')221 await driver.setImplicitWaitTimeout(2000)222 const nextButtonAddressDetailsScreen = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)223 await nextButtonAddressDetailsScreen.click()224 console.log('Clicked on Next button of Address Details screen.')225 })226 it('TC_Reg_67 : To verify back button functionality from "NEWS AND UPDATES" screen.', async function () {227 await driver.setImplicitWaitTimeout(4000)228 await driver.waitForElementByAccessibilityId(registerAccessibilityId.backButton, 15000)229 const backButtonOfNewsandUpdatesScreen = await driver.elementByAccessibilityId(registerAccessibilityId.backButton)230 await backButtonOfNewsandUpdatesScreen.click()231 console.log('Clicked on Back button.')232 console.log('Verify address Details Screen..... ')233 await driver.waitForElementByAccessibilityId(registerAccessibilityId.headerTitle, 20000)234 const headerOfAddressDetailsScreen = await driver.elementByAccessibilityId(registerAccessibilityId.headerTitle)235 registrationVM.actualHeaderTextOfAddressDetailsScreen = await headerOfAddressDetailsScreen.text()236 console.log('Actual Header of Address Details Screen :' + registrationVM.actualHeaderTextOfAddressDetailsScreen)237 assert.equal(registrationVM.actualHeaderTextOfAddressDetailsScreen, registrationVM.expectedHeaderTextOfAddressDetailsScreen, 'Header Text is same as expected : ADDRESS DETAILS')238 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)239 registrationVM.actualpostalCodeValue = await postalCode.text()240 console.log('Actual Postal Code Value : ' + registrationVM.actualpostalCodeValue)241 assert.equal(registrationVM.actualpostalCodeValue, registrationDS.postalCode, ' Postal code is verified.')242 await driver.setImplicitWaitTimeout(2000)243 const buildingField = await driver.elementByAccessibilityId(registerAccessibilityId.building)244 registrationVM.actualBuildingName = await buildingField.text()245 console.log('Actual Building Name : ' + registrationVM.actualBuildingName)246 assert.equal(registrationVM.actualBuildingName, registrationVM.expectedBuildingName, ' Building Name is verified.')247 await driver.setImplicitWaitTimeout(2000)248 const cityField = await driver.elementByAccessibilityId(registerAccessibilityId.city)249 registrationVM.actualCityName = await cityField.text()250 console.log('Actual City Name : ' + registrationVM.actualCityName)251 assert.equal(registrationVM.actualCityName, registrationVM.expectedCityName, ' City Name is verified.')252 await driver.setImplicitWaitTimeout(2000)253 const countryField = await driver.elementByAccessibilityId(registerAccessibilityId.country)254 registrationVM.actualCountryName = await countryField.text()255 console.log('Actual Country Name : ' + registrationVM.actualCountryName)256 assert.equal(registrationVM.actualCountryName, registrationVM.expectedCountryName, ' Country Name is verified.')257 const nextButtOnAddressDetailsScreen = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)258 assert.equal(await nextButtOnAddressDetailsScreen.isDisplayed(), true, 'Next button is displayed Successfully')259 })260 it('TC_Reg_68 : To verify "skip" button functionality from News and Updates screen.', async function () {261 await driver.setImplicitWaitTimeout(2000)262 const nextButtOnAddressDetailsScreen = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)263 await nextButtOnAddressDetailsScreen.click()264 console.log('Clicked on Next button of Address Details Screen.')265 await driver.setImplicitWaitTimeout(2000)266 const skipButtonOnNewsandUpdatesScreen = await driver.elementByAccessibilityId(registerAccessibilityId.skip)267 await skipButtonOnNewsandUpdatesScreen.click()268 console.log('Clicked on Skip button News and Updates Screen.')269 await driver.setImplicitWaitTimeout(1000)270 await driver.waitForElementByAccessibilityId(registerAccessibilityId.allow, 10000)271 const allowButtonOnYourNotificationScreen = await driver.elementByAccessibilityId(registerAccessibilityId.allow)272 await driver.waitForElementByAccessibilityId(registerAccessibilityId.skip, 10000)273 const skipButtonOnYourNotificationScreen = await driver.elementByAccessibilityId(registerAccessibilityId.skip)274 assert.equal(await allowButtonOnYourNotificationScreen.isDisplayed && await skipButtonOnYourNotificationScreen.isDisplayed(), true, 'User is redirected to Your Notification Page Successfully.')275 })276 it('TC_Reg_70 : To verify back button functionality from "YOUR NOTIFICATIONS" screen.', async function () {277 await driver.setImplicitWaitTimeout(2000)278 const backButtonOnYourNotificationScreen = await driver.elementByAccessibilityId(registerAccessibilityId.backButton)279 await backButtonOnYourNotificationScreen.click()280 console.log('Clicked on Back button.')281 await driver.setImplicitWaitTimeout(3000)282 const headerOfNewsandUpdateScreen = await driver.elementByAccessibilityId(registerAccessibilityId.headerTitle)283 registrationVM.actualHeaderTextOfNewsandUpdateScreen = await headerOfNewsandUpdateScreen.text()284 console.log('Actual Header text of News and Updates Screen :' + registrationVM.actualHeaderTextOfNewsandUpdateScreen)285 assert.equal(registrationVM.actualHeaderTextOfNewsandUpdateScreen, registrationVM.expectedHeaderTextOfNewsandUpdateScreen, 'Header Text is same as expected : News and Updates')286 const signMeUp = await driver.elementByAccessibilityId(registerAccessibilityId.signmeup)287 const skipButton = await driver.elementByAccessibilityId(registerAccessibilityId.skip)288 assert.equal(await signMeUp.isDisplayed && await skipButton.isDisplayed(), true, 'User is redirected to Your Notification Page Successfully.')289 })290 it('TC_Reg_71 : To verify "skip" link functionality from Your notifications screen.', async function () {291 await driver.setImplicitWaitTimeout(2000)292 const skipButtonOnNewsandUpdates = await driver.elementByAccessibilityId(registerAccessibilityId.skip)293 await skipButtonOnNewsandUpdates.click()294 console.log('Clicked on skip button of News and Updates Screen.')295 await driver.setImplicitWaitTimeout(3000)296 const skipButtonOnNotificationScreen = await driver.elementByAccessibilityId(registerAccessibilityId.skip)297 await skipButtonOnNotificationScreen.click()298 console.log('Clicked on skip button of Your Notification Screen.')299 await driver.setImplicitWaitTimeout(3000)300 const headerText = await driver.elementByAccessibilityId(registerAccessibilityId.headerTitle)301 registrationVM.actualHeaderTextOfVerifyYourIdentityScreen = await headerText.text()302 console.log('Actual header text of verify your identity screen : ' + registrationVM.actualHeaderTextOfVerifyYourIdentityScreen)303 assert.equal(registrationVM.actualHeaderTextOfVerifyYourIdentityScreen, registrationVM.expectedHeaderTextOfVerifyYourIdentityScreen, 'Header Text is same as expected : VERIFY YOUR IDENTITY\'')304 const step3and4Text = await driver.elementByAccessibilityId(registerAccessibilityId.step3and4Text)305 registrationVM.actualStep3and4Text = await step3and4Text.text()306 console.log('Step 3 and 4 Text : ' + registrationVM.actualStep3and4Text)307 assert.equal(registrationVM.actualStep3and4Text, registrationVM.expectedStep3and4Text, 'Text is verified successfully.')308 const takeaSelfie = await driver.elementByAccessibilityId(registerAccessibilityId.takeaselfie)309 assert.equal(await takeaSelfie.isDisplayed(), true, 'User is redirected to verify your identity screen')310 })311 it('TC_Reg_73 : To verify back button functionality from "VERIFY YOUR IDENTITY" screen.', async function () {312 await driver.setImplicitWaitTimeout(2000)313 const backButtonOnVerifyYourIdentityScreen = await driver.elementByAccessibilityId(registerAccessibilityId.backButton)314 await backButtonOnVerifyYourIdentityScreen.click()315 console.log('Clicked on Back Button of Verify Your Identity Screen.')316 await driver.setImplicitWaitTimeout(2000)317 const headerOnYourNotificationScreen = await driver.elementByAccessibilityId(registerAccessibilityId.headerTitle)318 registrationVM.actualHeaderTextOnYourNotificationScreen = await headerOnYourNotificationScreen.text()319 console.log('Actual Header Text on Your Notification Screen' + registrationVM.actualHeaderTextOnYourNotificationScreen)320 assert.equal(registrationVM.actualHeaderTextOnYourNotificationScreen, registrationVM.expectedHeaderTextOnYourNotificationScreen, 'Header Text is same as Expected : YOUR NOTIFICATIONS')321 await driver.setImplicitWaitTimeout(1000)322 const skipButtonOnNotificationScreen = await driver.elementByAccessibilityId(registerAccessibilityId.skip)323 const allowButtonOnNotificationScreen = await driver.elementByAccessibilityId(registerAccessibilityId.allow)324 assert.equal(await skipButtonOnNotificationScreen.isDisplayed() && await allowButtonOnNotificationScreen.isDisplayed(), true, 'User redirected to "YOUR NOTIFICATIONS" screen Successfully.')325 })326 it('TC_Reg_74, TC_Reg_77 : To Verify TAKE A SELFIE button functionality from verify your identity screen.', async function () {327 await driver.setImplicitWaitTimeout(1000)328 const skipButtonOnNotificationScreen = await driver.elementByAccessibilityId(registerAccessibilityId.skip)329 await skipButtonOnNotificationScreen.click()330 console.log('Clicked on Skip Button of Your Notifications Screen.')331 await driver.setImplicitWaitTimeout(2000)332 const takeaSelfie = await driver.elementByAccessibilityId(registerAccessibilityId.takeaselfie)333 await takeaSelfie.click()334 console.log('Taped on take selfie button.')335 await driver.setImplicitWaitTimeout(1000)336 const capture = await driver.elementByAccessibilityId(registerAccessibilityId.capture)337 await capture.click()338 console.log('Taped on Capture button.')339 await driver.setImplicitWaitTimeout(1000)340 await driver.waitForElementByAccessibilityId(registerAccessibilityId.done, 25000)341 await driver.setImplicitWaitTimeout(1000)342 const done = await driver.elementByAccessibilityId(registerAccessibilityId.done)343 assert.equal(await done.isDisplayed(), true, 'Done Button displayed successfully.')344 })345 it('TC_Reg_78 : To Verify DONE button functionality from finished screen.', async function () {346 await driver.setImplicitWaitTimeout(5000)347 const done = await driver.elementByAccessibilityId(registerAccessibilityId.done)348 await done.click()349 console.log('Taped on Done button.')350 await driver.setImplicitWaitTimeout(2000)351 })352 it('TC_Reg_78 : To Verify apply screen.', async function () {353 await driver.setImplicitWaitTimeout(3000)354 const apply = await driver.elementByAccessibilityId(registerAccessibilityId.apply)355 const dashboard = await driver.elementByAccessibilityId(registerAccessibilityId.dashboard)356 const cards = await driver.elementByAccessibilityId(registerAccessibilityId.card)357 const profile = await driver.elementByAccessibilityId(registerAccessibilityId.profile)358 const more = await driver.elementByAccessibilityId(registerAccessibilityId.more)359 //const sport = await driver.elementByXPath(registerXPath.sport)360 //assert.equal(await apply.isDisplayed() && await dashboard.isDisplayed() && await cards.isDisplayed() && await profile.isDisplayed() && await more.isDisplayed() && await sport.isDisplayed(), true, 'all elements displayed successfully on apply screen.')361 assert.equal(await apply.isDisplayed() && await dashboard.isDisplayed() && await cards.isDisplayed() && await profile.isDisplayed() && await more.isDisplayed(), true, 'all elements displayed successfully on apply screen.')362 await driver.setImplicitWaitTimeout(2000)363 })364 it('TC_Reg_79 : To Verify user profile screen after successfully registration.', async function () {365 await driver.setImplicitWaitTimeout(2000)366 const profile = await driver.elementByAccessibilityId(registerAccessibilityId.profile)367 await profile.click()368 console.log('Taped on profile button.')369 await driver.setImplicitWaitTimeout(2000)370 if (configuration.runOs == 'android') {371 const firstname = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)372 registrationVM.actualfirstname = await firstname.getAttribute('text')373 console.log('Actual First Name : ' + registrationVM.actualfirstname)374 const lastname = await driver.elementByAccessibilityId(registerAccessibilityId.lastname)375 registrationVM.actuallastname = await lastname.getAttribute('text')376 console.log('Actual Last Name : ' + registrationVM.actuallastname)377 const email = await driver.elementByAccessibilityId(registerAccessibilityId.email)378 registrationVM.actualemailID = await email.getAttribute('text')379 console.log('Actual Email ID : ' + registrationVM.actualemailID)380 const mobile = await driver.elementByAccessibilityId(registerAccessibilityId.actualmobileNo)381 registrationVM.actualmobileNo = await mobile.getAttribute('text')382 console.log('Actual Mobile : ' + registrationVM.actualmobileNo)383 } else {384 const firstname = await driver.elementByXPath(registerXPath.firstName)385 registrationVM.actualfirstname = await firstname.getAttribute('text')386 console.log('Actual First Name : ' + registrationVM.actualfirstname)387 const lastname = await driver.elementByXPath(registerXPath.lastName)388 registrationVM.actuallastname = await lastname.getAttribute('text')389 console.log('Actual Last Name : ' + registrationVM.actuallastname)390 const email = await driver.elementByXPath(registerXPath.email)391 registrationVM.actualemailID = await email.getAttribute('text')392 console.log('Actual Email ID : ' + registrationVM.actualemailID)393 const mobile = await driver.elementByXPath(registerXPath.phone)394 registrationVM.actualmobileNo = await mobile.getAttribute('text')395 console.log('Actual Mobile : ' + registrationVM.actualmobileNo)396 }397 let mob = '+44' + mobileNumber398 assert.equal(registrationVM.actualfirstname, registrationDS.firstname, 'First Name Matched successfully')399 assert.equal(registrationVM.actuallastname, registrationDS.lastname, 'Last Name Matched successfully')400 assert.equal(registrationVM.actualemailID, registrationDS.email, 'Email Id Matched successfully')401 assert.equal(registrationVM.actualmobileNo, mob, 'Mobile Number Matched successfully')402 await driver.setImplicitWaitTimeout(2000)403 })404 })405}...
testCases.js
Source:testCases.js
...75 after(async function () {76 await driver.quit();77 });78 it('To verify the look and feel of the Register screen ', async function () {79 await driver.setImplicitWaitTimeout(10000);80 this.timeout(3000000)81 //Accept Popup82 await driver.execute('mobile:alert', { action: 'accept' });83 // UI Elements config for registeration page84 for (let i = 0; i < registrationElements.length; i++) {85 let element = registrationElements[i];86 utils.elementByAccessibilityId(driver, element.name)87 }88 });89 it('Check for all the fields and their placeholders in the register screen.', async function () {90 this.timeout(3000000)91 await driver.setImplicitWaitTimeout(1000);92 for (let i = 0; i < registrationElements.length; i++) {93 let element = registrationElements[i];94 if (element.type === "textfield") {95 //Element exists96 let ele = await utils.elementByAccessibilityId(driver, element.name);97 let placeholder = await ele.text();98 assert.equal(placeholder, element.placeholder);99 } else if (element.type === "button") {100 utils.elementByAccessibilityId(driver, element.name);101 }102 }103 })104 /** TODO Check this Testcase */105 it('To verify error messages are displayed for all the fields when are left blank and submit button is clicked by user', async function () {106 this.timeout(3000000)107 await driver.setImplicitWaitTimeout(10000);108 //Send Verification Code button exists109 let sendVerificationCodeButton = await utils.elementByAccessibilityId(driver, "signup_submit");110 await sendVerificationCodeButton.click();111 // await driver.setImplicitWaitTimeout(1000);112 let errorMessageElement = await driver.element("name", "Password should be minimum 8 characters.");113 const errorMessage = await errorMessageElement.text();114 assert.equal(errorMessage, `Password should be minimum 8 characters.`);115 // await driver.setImplicitWaitTimeout(1000);116 // Close the popup117 let close = await utils.elementByAccessibilityId(driver, "OK");118 await close.click();119 });120 it('To verify error message when user tries to register with already registered email id ', async function () {121 this.timeout(3000000)122 await driver.setImplicitWaitTimeout(10000);123 for (let i = 0; i < registrationElements.length; i++) {124 let el = registrationElements[i];125 if (el.type == "textfield") {126 let element = await driver.waitForElementByAccessibilityId(el.name);127 await element.clear();128 await element.sendKeys(el.value);129 }130 }131 let sendVerificationCodeButton = await driver.waitForElementByAccessibilityId("signup_submit");132 await sendVerificationCodeButton.click();133 let alertTitleElement = await driver.element("name", "Error!");134 let alertTitle = await alertTitleElement.text();135 await assert.equal(alertTitle, `Error!`);136 let alertMessageElement = await driver.element("name", "User already exists. Would you like to reset your password?");137 let alertMessage = await alertMessageElement.text();138 await assert.equal(alertMessage, `User already exists. Would you like to reset your password?`);139 let close = await driver.waitForElementByAccessibilityId("Cancel");140 await close.click();141 });142 it('it should move to registraion page second step and enter dummy verification code and show error popup and should come back to registration page', async function () {143 this.timeout(3000000)144 await driver.setImplicitWaitTimeout(10000);145 for (let i = 0; i < registrationElements.length; i++) {146 let el = registrationElements[i];147 if (el.type == "textfield") {148 // console.log(el, "element@");149 let element = await driver.waitForElementByAccessibilityId(el.name);150 await element.clear();151 await element.sendKeys(el.nonRegisteredValue);152 }153 }154 let sendVerificationCodeButton = await driver.waitForElementByAccessibilityId("signup_submit");155 await sendVerificationCodeButton.click();156 let el1 = await utils.elementByAccessibilityId(driver, "verificationcode");157 await el1.sendKeys(config.constants.registrationVerificationCode);158 let el2 = await utils.elementByAccessibilityId(driver, "verify");159 await el2.click();160 let el3 = await utils.elementByAccessibilityId(driver, "Please enter the correct verification code.");161 await el3.click();162 let el4 = await utils.elementByAccessibilityId(driver, "OK");163 await el4.click();164 let el5 = await utils.elementByAccessibilityId(driver, "back");165 await el5.click();166 })167 it('To verify error message is displayed when user tries to login non registered email id.', async function () {168 this.timeout(3000000)169 await driver.setImplicitWaitTimeout(10000);170 //Click on login171 let login = await utils.elementByAccessibilityId(driver, "login");172 await login.click();173 // entering email and password174 for (let i = 0; i < loginElements.length; i++) {175 let element = loginElements[i];176 let ele = await utils.elementByAccessibilityId(driver, element.name);177 let placeholder = await ele.text();178 await assert.equal(placeholder, element.placeholder);179 await ele.sendKeys(element.nonRegisteredValue);180 }181 //Click Login182 let loginButton = await driver.waitForElementByAccessibilityId("submit");183 await loginButton.click();184 let alertTitleElement = await driver.element("name", "Error!");185 let alertTitle = await alertTitleElement.text();186 await assert.equal(alertTitle, `Error!`);187 let alertMessageElement = await driver.element("name", "User does not exist.");188 let alertMessage = await alertMessageElement.text();189 await assert.equal(alertMessage, `User does not exist.`);190 let close = await driver.waitForElementByAccessibilityId("OK");191 await close.click();192 });193 it('To verify error pop up is displayed when user enters wrong mail id or password and clicks on login button.', async function () {194 this.timeout(3000000)195 await driver.setImplicitWaitTimeout(10000);196 for (let i = 0; i < loginElements.length; i++) {197 let element = loginElements[i];198 let ele = await utils.elementByAccessibilityId(driver, element.name);199 await ele.clear();200 await ele.sendKeys(element.invalidValue);201 }202 //Click Login203 let loginButton = await utils.elementByAccessibilityId(driver, "submit");204 await loginButton.click();205 let alertTitleElement = await driver.element("name", "Error!");206 let alertTitle = await alertTitleElement.text();207 await assert.equal(alertTitle, `Error!`);208 let alertMessageElement = await driver.element("name", "Incorrect username or password.");209 let alertMessage = await alertMessageElement.text();210 await assert.equal(alertMessage, `Incorrect username or password.`);211 let close = await utils.elementByAccessibilityId(driver, "OK");212 await close.click();213 });214 it('Test for email Field Visibility', async function () {215 this.timeout(30000)216 await driver.setImplicitWaitTimeout(10000);217 await driver.setPageLoadTimeout(10000);218 //Click on Forgot Password219 let forgotPwd = await driver.waitForElementByAccessibilityId("forgotPassword");220 await forgotPwd.click();221 let email;222 // console.log("before get the email element");223 email = await utils.elementByAccessibilityId(driver, "email");224 // console.log("After email element", email);225 // await email.click();226 try {227 await email.sendKeys("someone1@duke.com")228 } catch (e) {229 // console.log(e);230 }231 // console.log("After sending keys");232 await email.clear();233 });234 it('Navigate to Forgot Password, enter unregistered email.', async function () {235 this.timeout(30000)236 await driver.setImplicitWaitTimeout(100000);237 let email = await utils.elementByAccessibilityId(driver, "email");238 // console.log("emal2", email);239 await email.sendKeys("abcdea@abc.com");240 //Click Login241 let sendVerificationButton = await utils.elementByAccessibilityId(driver, "sendVerificationCode");242 await sendVerificationButton.click();243 //Check alert Title244 let alertTitleElement = await driver.element("name", "Error!");245 // Check the text246 const alertTitle = await alertTitleElement.text();247 await assert.equal(alertTitle, `Error!`);248 let alertmessageElement = await driver.element("name", "This email is not registered with us. Would you like to register?");249 // Check the text250 const alertmessage = await alertmessageElement.text();251 await assert.equal(alertmessage, `This email is not registered with us. Would you like to register?`);252 //Click Close253 let closeButton = await utils.elementByAccessibilityId(driver, "Close");254 await closeButton.click();255 });256 it('To verify error message pop is displayed when user tries to reset password by entering the email id of non verified but registered ', async function () {257 this.timeout(3000000)258 await driver.setPageLoadTimeout(5000);259 await driver.setImplicitWaitTimeout(10000);260 //Enter Email261 let email = await utils.elementByAccessibilityId(driver, "email");262 await email.clear();263 await email.sendKeys(config.constants.nonVerifiedButRegisteredEmail);264 //Click send verfification code265 let sendVerificationButton = await utils.elementByAccessibilityId(driver, "sendVerificationCode");266 await sendVerificationButton.click();267 //Check alert Title268 let alertTitleElement = await driver.element("name", "Error!");269 // Check the text270 const alertTitle = await alertTitleElement.text();271 await assert.equal(alertTitle, `Error!`);272 //Alert message Element273 let alertmessageElement = await driver.element("name", "Cannot reset password for the user as there is no registered/verified email or phone_number");274 // Check the text275 const alertmessage = await alertmessageElement.text();276 await assert.equal(alertmessage, `Cannot reset password for the user as there is no registered/verified email or phone_number`);277 //Click Close278 let ok = await utils.elementByAccessibilityId(driver, "OK");279 await ok.click();280 //Click Login281 let loginButton = await utils.elementByAccessibilityId(driver, "REMEMBER ? GO BACK TO LOGIN");282 await loginButton.click();283 });284 it('To verify user is navigated to Home screen if email and password are valid', async function () {285 // await driver.setPageLoadTimeout(5000);286 this.timeout(3000000)287 await driver.setImplicitWaitTimeout(10000);288 // entering username and password289 for (let i = 0; i < loginElements.length; i++) {290 let element = loginElements[i];291 let ele = await utils.elementByAccessibilityId(driver, element.name);292 await ele.clear();293 await ele.sendKeys(element.registeredValue);294 }295 //Click Login296 let loginButton = await utils.elementByAccessibilityId(driver, "submit");297 await loginButton.click();298 // await driver.setPageLoadTimeout(5000);299 //wait for element to appear300 let uploadDocument = await utils.elementByAccessibilityId(driver, "uploadDocument");301 });302 it("it should check the change phone number functionality", async function () {303 await driver.setPageLoadTimeout(10000);304 this.timeout(3000000)305 await driver.setImplicitWaitTimeout(100000);306 let profile = await utils.elementByAccessibilityId(driver, "profile");307 await profile.click();308 let el1 = await utils.elementByAccessibilityId(driver, "change-phonenumber");309 await el1.click();310 let el2 = await utils.elementByAccessibilityId(driver, "password");311 await el2.sendKeys("Divami@4");312 let el3 = await utils.elementByAccessibilityId(driver, "done");313 await el3.click();314 let el4 = await utils.elementByAccessibilityId(driver, "phone_number");315 await el4.clear();316 await el4.sendKeys("+7731834175");317 let el5 = await utils.elementByAccessibilityId(driver, "done");318 await el5.click();319 // let el6 = await driver.elementByXPath("//XCUIElementTypeStaticText[@name=\"Success!\"]");320 // await el6.click();321 let alertTitleElement = await driver.element("name", "Success!");322 let alertTitle = await alertTitleElement.text();323 await assert.equal(alertTitle, `Success!`);324 let msg = await driver.element("name", "Your phone number has changed successfully.");325 let msgText = await msg.text();326 await assert.equal(msgText, `Your phone number has changed successfully.`)327 let el8 = await driver.elementByAccessibilityId("OK");328 await el8.click();329 })330 it('it should show error popup when user trying to enter to change the password using wrong old password', async function () {331 this.timeout(3000000)332 await driver.setImplicitWaitTimeout(10000);333 let el2 = await utils.elementByAccessibilityId(driver, "change-password");334 await el2.click();335 let el3 = await utils.elementByAccessibilityId(driver, "oldPassword");336 await el3.sendKeys("WrongPassword@123");337 let el4 = await utils.elementByAccessibilityId(driver, "newPassword");338 await el4.sendKeys("WrongPassword@123");339 let el5 = await utils.elementByAccessibilityId(driver, "done");340 await el5.click();341 let el6 = await utils.elementByAccessibilityId(driver, "Incorrect username or password.");342 await el6.click();343 let el7 = await utils.elementByAccessibilityId(driver, "OK");344 await el7.click();345 });346 it('it should give success message, when user trying to change the password with correct login information', async function () {347 this.timeout(3000000)348 await driver.setImplicitWaitTimeout(10000);349 let el1 = await utils.elementByAccessibilityId(driver, "oldPassword");350 await el1.sendKeys(config.registeredLoginDetails.password);351 let el2 = await utils.elementByAccessibilityId(driver, "newPassword");352 await el2.sendKeys(config.constants.futurePassword);353 let el3 = await utils.elementByAccessibilityId(driver, "done");354 await el3.click();355 let el4 = await driver.element("name", "Success!");356 let text = await el4.text();357 await assert.equal(text, 'Success!')358 let el5 = await driver.element("name", "Your password has changed successfully, Please relogin.");359 text = await el5.text();360 await assert.equal(text, 'Your password has changed successfully, Please relogin.')361 let el6 = await utils.elementByAccessibilityId(driver, "OK");362 await el6.click();363 let el7 = await utils.elementByAccessibilityId(driver, "LOGIN");364 await el7.click();365 });366 it('it should check logout functionality', async function () {367 //Click on login368 await driver.setPageLoadTimeout(5000);369 this.timeout(3000000)370 await driver.setImplicitWaitTimeout(10000);371 let login = await utils.elementByAccessibilityId(driver, "login");372 await login.click();373 // entering email and password374 for (let i = 0; i < loginElements.length; i++) {375 let element = loginElements[i];376 let ele = await utils.elementByAccessibilityId(driver, element.name);377 let placeholder = await ele.text();378 await assert.equal(placeholder, element.placeholder);379 let value;380 if (element.placeholder == 'Password') {381 value = config.constants.futurePassword;382 } else {383 value = element.registeredValue384 }385 await ele.sendKeys(value);386 }387 //Click Login388 let loginButton = await utils.elementByAccessibilityId(driver, "submit");389 await loginButton.click();390 await driver.setPageLoadTimeout(5000);391 let el1 = await utils.elementByAccessibilityId(driver, "profile");392 await el1.click();393 let el2 = await driver.elementByXPath("//XCUIElementTypeApplication[@name=\"DUKE\"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[2]/XCUIElementTypeTable/XCUIElementTypeCell[5]/XCUIElementTypeButton");394 await el2.click();395 let el3 = await driver.elementByAccessibilityId("LOGIN");396 await el3.click();397 })398 it('Should upload Doc', async function () {399 await driver.setPageLoadTimeout(5000);400 this.timeout(3000000)401 await driver.setImplicitWaitTimeout(20000);402 for (let i = 0; i < loginElements.length; i++) {403 let element = loginElements[i];404 let ele = await utils.elementByAccessibilityId(driver, element.name);405 let placeholder = await ele.text();406 await assert.equal(placeholder, element.placeholder);407 let value;408 if (element.placeholder == 'Password') {409 value = config.constants.futurePassword;410 } else {411 value = element.registeredValue412 }413 await ele.sendKeys(value);414 }415 let loginButton = await utils.elementByAccessibilityId(driver, "submit");416 await loginButton.click();417 await driver.setPageLoadTimeout(5000);418 //wait for element to appear419 let uploadDocument = await utils.elementByAccessibilityId(driver, "uploadDocument");420 await uploadDocument.click();421 await driver.setPageLoadTimeout(5000);422 let gallery;423 try {424 gallery = await utils.elementByAccessibilityId(driver, "Gallery");425 } catch (err) {426 await uploadDocument.click();427 gallery = await utils.elementByAccessibilityId(driver, "Gallery");428 } finally {429 await gallery.click();430 }431 let imagesElement = await utils.elementByAccessibilityId(driver, "Camera Roll");432 await imagesElement.click();433 let imageCell = await utils.elementByAccessibilityId(driver, config.constants.documentName);434 await imageCell.click();435 let submit = await utils.elementByAccessibilityId(driver, "submit");436 await submit.click();437 let imageElement = await driver.waitForElementByXPath("//XCUIElementTypeApplication[@name=\"DUKE\"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeImage", 2000);438 await imageElement.click();439 originalImage = await driver.takeScreenshot();440 let upload = await utils.elementByAccessibilityId(driver, "upload");441 await driver.setImplicitWaitTimeout(500000);442 await upload.click();443 await driver.setPageLoadTimeout(5000);444 let nextPageTitle = await driver.element("name", "title");445 });446 it('Checking document upload status', async function () {447 await driver.setPageLoadTimeout(5000);448 this.timeout(3000000)449 await driver.setImplicitWaitTimeout(10000);450 let nextPageTitle = await driver.element("name", "title");451 // Check the text452 const vcTitle = await nextPageTitle.text();453 await driver.setPageLoadTimeout(2000);454 let addAnother = await utils.elementByAccessibilityId(driver, "addAnother");455 await addAnother.click();456 await driver.setPageLoadTimeout(2000);457 let gallery;458 try {459 gallery = await utils.elementByAccessibilityId(driver, "Gallery");460 } catch (err) {461 gallery = await utils.elementByAccessibilityId(driver, "Gallery");462 } finally {463 let cancel = await utils.elementByAccessibilityId(driver, "Cancel");464 await cancel.click();465 let el3 = await utils.elementByAccessibilityId(driver, "goBackHome");466 await el3.click();467 }468 let el4 = await utils.elementByAccessibilityId(driver, "HOME");469 });470 it('it should check image comparision functionality', async function () {471 //Click on login472 await driver.setPageLoadTimeout(5000);473 this.timeout(3000000)474 await driver.setImplicitWaitTimeout(10000);475 let el9 = await utils.elementByAccessibilityId(driver, "viewDocument");476 await el9.click();477 let el10 = await utils.elementByAccessibilityId(driver, "inProcess");478 await driver.setPageLoadTimeout(5000);479 await el10.click();480 let el11 = await driver.elementByXPath("//XCUIElementTypeApplication[@name=\"DUKE\"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther/XCUIElementTypeOther[2]/XCUIElementTypeCollectionView/XCUIElementTypeCell[1]/XCUIElementTypeOther/XCUIElementTypeOther");481 await el11.click();482 let uImage = await driver.waitForElementByXPath("//XCUIElementTypeApplication[@name=\"DUKE\"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[2]/XCUIElementTypeOther[1]/XCUIElementTypeCollectionView/XCUIElementTypeCell/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeImage/XCUIElementTypeImage");483 await uImage.click();484 uploadedImage = await driver.takeScreenshot();485 let diff = await imageCompare.getDiff(originalImage, uploadedImage);486 console.log(diff);487 if (diff.misMatchPercentage > 60) {488 assert.fail("image mismached")...
TC_Reg_05.registration.test.js
Source:TC_Reg_05.registration.test.js
...64 platformVersion: PlatformVersion65 }))66 console.log('--- ---- Device: '+DeviceName)67 console.log('--- ---- PlatformVersion: '+PlatformVersion)68 await driver.setImplicitWaitTimeout(10000)69 ssid = await driver.getSessionId()70 console.log('--started-->' + ssid)71 const registerBtn = await driver.elementByAccessibilityId(registerAccessibilityId.register)72 const btnLogin = await driver.elementByAccessibilityId(registerAccessibilityId.login)73 assert.equal(await registerBtn.isDisplayed() && await btnLogin.isDisplayed(), true, 'Application launch successfully.')74 })75 it('TC_Reg_02 : To Verify "REGISTER" button functionality', async function () {76 await driver.setImplicitWaitTimeout(1000)77 const register = await driver.elementByAccessibilityId(registerAccessibilityId.register)78 await register.click()79 console.log('Clicked on \'Register\' button.')80 await driver.setImplicitWaitTimeout(2000)81 const mobileNo = await driver.elementByAccessibilityId(registerAccessibilityId.phone)82 const pswd = await driver.elementByAccessibilityId(registerAccessibilityId.password)83 const checkBox = await driver.elementByAccessibilityId(registerAccessibilityId.aggrementCheckbox)84 assert.equal(await mobileNo.isDisplayed() && await pswd.isDisplayed() && await checkBox.isDisplayed(), true, 'Successfully Redirected to Register page.')85 })86 it('TC_Reg_23 : To Verify "Register" button functionality with valid details.', async function () {87 await driver.setImplicitWaitTimeout(1000)88 const mobileNo = await driver.elementByAccessibilityId(registerAccessibilityId.phone)89 let mobileNumber = Math.floor(Math.random() * 9000000000) + 100000000090 await sendKey(driver,mobileNo,mobileNumber)91 console.log('Entered Mobile number : ' + mobileNumber)92 await driver.setImplicitWaitTimeout(1000)93 const password = await driver.elementByAccessibilityId(registerAccessibilityId.password)94 await sendKey(driver,password,registrationDS.password)95 console.log('Entered Password :' + registrationDS.password)96 await driver.setImplicitWaitTimeout(1000)97 const checkBox = await driver.elementByAccessibilityId(registerAccessibilityId.aggrementCheckbox)98 await checkBox.click()99 console.log('Checked licence-agreement checkbox.')100 await driver.setImplicitWaitTimeout(1000)101 const registerBtn = await driver.elementByAccessibilityId(registerAccessibilityId.register)102 await registerBtn.click()103 console.log('Clicked on register Button.')104 await driver.setImplicitWaitTimeout(4000)105 })106 it('TC_Reg_28, TC_Reg_29, TC_Reg_32 : To Verify by adding 6 digit code.', async function () {107 await driver.setImplicitWaitTimeout(2000)108 const otpField = await driver.elementByAccessibilityId(registerAccessibilityId.otp)109 await sendKey(driver,otpField,registrationDS.validOTP)110 console.log('Entered OTP number.' + registrationDS.validOTP)111 await driver.setImplicitWaitTimeout(2000)112 const nextBtn = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)113 await nextBtn.click()114 console.log('Clicked on next button.')115 await driver.setImplicitWaitTimeout(5000)116 const personalDetails = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)117 assert.equal(await personalDetails.isDisplayed(), true, 'Successfully Personal Detail screen displayed.')118 })119 it('TC_Reg_52 : To verify by entering valid format Email Id and other valid details.', async function () {120 await driver.setImplicitWaitTimeout(1000)121 console.log('Entering valid Personal details.....')122 const firstNameField = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)123 await sendKey(driver,firstNameField,registrationDS.firstname)124 console.log('Entered firstName : ' + registrationDS.firstname)125 await driver.setImplicitWaitTimeout(1000)126 const lastNameField = await driver.elementByAccessibilityId(registerAccessibilityId.lastname)127 await sendKey(driver,lastNameField,registrationDS.lastname)128 console.log('Entered lastName : ' + registrationDS.lastname)129 await driver.setImplicitWaitTimeout(1000)130 if (configuration.runOs == 'android') {131 await driver.setImplicitWaitTimeout(1000)132 const dobField = await driver.elementByAccessibilityId(registerAccessibilityId.birthdate)133 await dobField.click()134 console.log('Clicked on DOB text field.')135 await driver.setImplicitWaitTimeout(1000)136 const dobFieldOK = await driver.elementById(registerAccessibilityId.okbutton)137 await dobFieldOK.click()138 console.log('Clicked on DOB ok button.')139 } else {140 await driver.setImplicitWaitTimeout(1000)141 const dobField = await driver.elementByAccessibilityId(registerAccessibilityId.birthdate)142 await dobField.click()143 console.log('Clicked on DOB text field.')144 await driver.setImplicitWaitTimeout(2000)145 let dobmonth146 try{147 console.log('Inside Try.')148 dobmonth = await driver.elementByXPath(registerXPath.dobmonth)149 }150 catch{151 console.log('Inside catch.')152 dobmonth = await driver.elementByXPath(registerXPath.dobmonth1)153 }154 await sendKey(driver, dobmonth, registrationDS.DOBMonth)155 await driver.setImplicitWaitTimeout(1000)156 console.log('Select September month.')157 const blankSpace = await driver.elementByXPath(registerXPath.blankSpace)158 await blankSpace.click()159 console.log('Clicked on Blank Space.')160 }161 await driver.setImplicitWaitTimeout(1000)162 const emailField = await driver.elementByAccessibilityId(registerAccessibilityId.email)163 // await emailField.sendKeys(registrationDS.email)164 await sendKey(driver,emailField,registrationDS.email)165 console.log('Entered EmailID : ' + registrationDS.email)166 await driver.setImplicitWaitTimeout(2000)167 const nextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)168 assert.equal(await nextButton.isDisplayed(), true, 'Next Enabled Displayed Successfully.')169 await nextButton.click()170 console.log('Clicked on \'Next\' button after filled valid Personal Details.')171 await driver.setImplicitWaitTimeout(5000)172 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)173 const addressDetailsText = await driver.elementByAccessibilityId(registerAccessibilityId.addressDetailsText)174 const postalCodeNextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)175 assert.equal(await postalCode.isDisplayed() && await addressDetailsText.isDisplayed() && await postalCodeNextButton.isDisplayed(), true, 'Postal Code and Address details text is displayed successfully.')176 console.log('Verified Postal Code-Address screen successfully.')177 })178 it('TC_Reg_55 : To verify Back button functionality from address details screen.', async function () {179 await driver.setImplicitWaitTimeout(2000)180 const backButton = await driver.elementByAccessibilityId('leftIconBtn-testId')181 await backButton.click()182 console.log('Clicked on Back Button.')183 await driver.setImplicitWaitTimeout(2000)184 const nextButtonOnPersonalDetailsScreen = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)185 await driver.setImplicitWaitTimeout(2000)186 const firstNameField = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)187 registrationVM.actualFirstNameValue = await firstNameField.text()188 console.log('Actual First Name : ' + registrationVM.actualFirstNameValue)189 assert.equal(registrationVM.actualFirstNameValue, registrationDS.firstname, 'FistName value is same as expected value ')190 await driver.setImplicitWaitTimeout(2000)191 const lastNameField = await driver.elementByAccessibilityId(registerAccessibilityId.lastname)192 registrationVM.actualLastNameValue = await lastNameField.text()193 console.log('Actual Last Name : ' + registrationVM.actualLastNameValue)194 assert.equal(registrationVM.actualLastNameValue, registrationDS.lastname, 'LastName value is same as expected value ')195 await driver.setImplicitWaitTimeout(2000)196 const emailField = await driver.elementByAccessibilityId(registerAccessibilityId.email)197 registrationVM.actualeEmailValue = await emailField.text()198 console.log('Actual Email Id : ' + registrationVM.actualeEmailValue)199 assert.equal(registrationVM.actualeEmailValue, registrationDS.email, 'Email value is same as expected value ')200 assert.equal(await nextButtonOnPersonalDetailsScreen.isDisplayed(), true, 'User is redirected to personal details screen Successfully.')201 })202 it('TC_Reg_56 : To verify validation message by entering upto 4 character in Postal Code.', async function () {203 await driver.setImplicitWaitTimeout(2000)204 const nextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)205 await nextButton.click()206 console.log('Clicked on Next Button.')207 //await driver.setImplicitWaitTimeout(4000)208 await driver.waitForElementByAccessibilityId(registerAccessibilityId.postalcode,10000)209 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)210 await sendKey(driver,postalCode,registrationDS.inValidPostalCode)211 console.log('Entered Postal Code : ' + registrationDS.inValidPostalCode)212 await driver.setImplicitWaitTimeout(2000)213 const postalError = await driver.elementByAccessibilityId(registerAccessibilityId.fiveCharactersError)214 registrationVM.actualpostalErrorMsg = await postalError.text()215 console.log('Actual Postal Code Error Msg : ' + registrationVM.actualpostalErrorMsg)216 assert.equal(registrationVM.actualpostalErrorMsg, registrationVM.expectedpostalErrorMsg, 'Postal Code Error Msg Displayed Successfully by entering upto 4 character in Postal Code.')217 await postalCode.clear()218 })219 it('TC_Reg_57 : To verify by entering 5 or more character in postal code.', async function () {220 await driver.setImplicitWaitTimeout(2000)221 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)222 await sendKey(driver,postalCode,registrationDS.postalCode)223 console.log('Entered Postal Code : ' + registrationDS.postalCode)224 const postalCodeMsg = await driver.elementByAccessibilityId(registerAccessibilityId.postalCodeMsg)225 registrationVM.actualPostalCodeMsg = await postalCodeMsg.text()226 console.log('Actual Postal Code Message : ' + registrationVM.actualPostalCodeMsg)227 assert.equal(registrationVM.actualPostalCodeMsg, registrationVM.expectedPostalCodeMsg, 'Postal Code Msg Displayed Successfully by entering 5 or more character in Postal Code.')228 const searchIcon = await driver.elementByAccessibilityId(registerAccessibilityId.search)229 assert.equal(await searchIcon.isDisplayed(), true, 'Search icon Displayed Successfully.')230 await postalCode.clear()231 })232 it('TC_Reg_58 : To verify "Search" icon functionality with invalid postal code.', async function () {233 await driver.setImplicitWaitTimeout(2000)234 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)235 await sendKey(driver,postalCode,registrationDS.inValidPostalCode1)236 console.log('Entered Postal Code : ' + registrationDS.inValidPostalCode1)237 await driver.setImplicitWaitTimeout(2000)238 const searchIcon = await driver.elementByAccessibilityId(registerAccessibilityId.search)239 await searchIcon.click()240 console.log('Clicked on Search Icon.')241 await driver.setImplicitWaitTimeout(8000)242 const actualAddressList = await driver.elementByAccessibilityId(registerAccessibilityId.actualAddressList)243 assert.equal(await actualAddressList.isDisplayed(), true, 'Address list message Displayed Successfully for invalid postal code.')244 })245 it('TC_Reg_59 : To verify back button functionality from "ADDRESS LIST" screen.', async function () {246 await driver.setImplicitWaitTimeout(2000)247 const backButton = await driver.elementByAccessibilityId(registerAccessibilityId.backButton)248 await backButton.click()249 console.log('Clicked on Back Button.')250 await driver.setImplicitWaitTimeout(2000)251 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)252 assert.equal(await postalCode.isDisplayed(), true, 'User is redirected to AddressDetails Screen.')253 })254 it('TC_Reg_63 : To verify by editing the selected address.', async function () {255 await driver.setImplicitWaitTimeout(2000)256 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)257 await sendKey(driver,postalCode,registrationDS.postalCode)258 console.log('Entered Postal Code : ' + registrationVM.postalCode)259 await driver.setImplicitWaitTimeout(2000)260 const searchIcon = await driver.elementByAccessibilityId(registerAccessibilityId.search)261 await searchIcon.click()262 console.log('Clicked on Search icon.')263 await driver.setImplicitWaitTimeout(10000)264 const selectAddress = await driver.elementByAccessibilityId(registerAccessibilityId.selectAddress)265 registrationVM.selectedAddressText = await selectAddress.text()266 console.log('Selected Address.' + registrationVM.selectedAddressText)267 var str1 = registrationVM.selectedAddressText.split(',')268 registrationVM.expectedBuildingName = str1[0].trim()269 registrationVM.expectedCityName = str1[1].trim()270 registrationVM.expectedCountryName = str1[2].trim()271 console.log('Expected Building Name, City Name, Country Name......')272 console.log('Expected Building Name : ' + registrationVM.expectedBuildingName)273 console.log('Expected City Name : ' + registrationVM.expectedCityName)274 console.log('Expected Country Name : ' + registrationVM.expectedCountryName)275 await selectAddress.click()276 console.log('Address Selected Successfully.')277 await driver.setImplicitWaitTimeout(3000)278 console.log('Actual Building Name, City Name, Country Name......')279 const buildingField = await driver.elementByAccessibilityId(registerAccessibilityId.building)280 registrationVM.actualBuildingName = await buildingField.text()281 console.log('Actual Building Name : ' + registrationVM.actualBuildingName)282 assert.equal(registrationVM.actualBuildingName, registrationVM.expectedBuildingName, ' Building Name is verified.')283 await driver.setImplicitWaitTimeout(2000)284 const cityField = await driver.elementByAccessibilityId(registerAccessibilityId.city)285 registrationVM.actualCityName = await cityField.text()286 console.log('Actual City Name : ' + registrationVM.actualCityName)287 assert.equal(registrationVM.actualCityName, registrationVM.expectedCityName, ' City Name is verified.')288 await driver.setImplicitWaitTimeout(2000)289 const countryField = await driver.elementByAccessibilityId(registerAccessibilityId.country)290 registrationVM.actualCountryName = await countryField.text()291 console.log('Actual Country Name : ' + registrationVM.actualCountryName)292 assert.equal(registrationVM.actualCountryName, registrationVM.expectedCountryName, ' Country Name is verified.')293 console.log('Updating Address Details Like Building Name, City Name and Country Name ')294 await driver.setImplicitWaitTimeout(2000)295 await sendKey(driver,buildingField,registrationDS.buildingName)296 console.log('Entered Building Name : ' + registrationDS.buildingName)297 await driver.setImplicitWaitTimeout(2000)298 await sendKey(driver,cityField,registrationDS.cityName)299 console.log('Entered City Name : ' + registrationDS.cityName)300 await driver.setImplicitWaitTimeout(2000)301 await sendKey(driver,countryField,registrationDS.countryName)302 console.log('Entered Country Name : ' + registrationDS.countryName)303 await driver.setImplicitWaitTimeout(2000)304 })305 it('TC_Reg_66 : To verify "NEXT" button functionality after editing the address with valid details..', async function () {306 console.log('Entering Valid Address Details Like Building Name, City Name and Country Name ')307 await driver.setImplicitWaitTimeout(2000)308 const buildingField = await driver.elementByAccessibilityId(registerAccessibilityId.building)309 await sendKey(driver,buildingField,registrationVM.expectedBuildingName)310 console.log('Entered Building Name : ' + registrationVM.expectedBuildingName)311 await driver.setImplicitWaitTimeout(2000)312 const cityField = await driver.elementByAccessibilityId(registerAccessibilityId.city)313 await sendKey(driver,cityField,registrationVM.expectedCityName)314 console.log('Entered City Name : ' + registrationVM.expectedCityName)315 await driver.setImplicitWaitTimeout(2000)316 const countryField = await driver.elementByAccessibilityId(registerAccessibilityId.country)317 await sendKey(driver,countryField,registrationVM.expectedCountryName)318 console.log('Entered Country Name : ' + registrationVM.expectedCountryName)319 await driver.setImplicitWaitTimeout(2000)320 const nextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)321 await nextButton.click()322 console.log('Clicked on Next button.')323 await driver.setImplicitWaitTimeout(4000)324 const signMeUp = await driver.elementByAccessibilityId(registerAccessibilityId.signmeup)325 const skipButton = await driver.elementByAccessibilityId(registerAccessibilityId.skip)326 const headerOfNewsandUpdateScreen = await driver.elementByAccessibilityId(registerAccessibilityId.headerTitle)327 registrationVM.actualHeaderTextOfNewsandUpdateScreen = await headerOfNewsandUpdateScreen.text()328 console.log('Actual Header text of News and Updates Screen :' + registrationVM.actualHeaderTextOfNewsandUpdateScreen)329 assert.equal(registrationVM.actualHeaderTextOfNewsandUpdateScreen, registrationVM.expectedHeaderTextOfNewsandUpdateScreen, 'Header Text is same as expected : News and Updates')330 assert.equal(await signMeUp.isDisplayed() && await skipButton.isDisplayed(), true, 'User is redirected to News and Updates page successfully.')331 })332 })333}...
TC_Reg_04.registration.test.js
Source:TC_Reg_04.registration.test.js
...64 platformVersion: PlatformVersion65 }))66 console.log('--- ---- Device: '+DeviceName)67 console.log('--- ---- PlatformVersion: '+PlatformVersion)68 await driver.setImplicitWaitTimeout(10000)69 ssid = await driver.getSessionId()70 console.log('--started-->' + ssid)71 const registerBtn = await driver.elementByAccessibilityId(registerAccessibilityId.register)72 const btnLogin = await driver.elementByAccessibilityId(registerAccessibilityId.login)73 assert.equal(await registerBtn.isDisplayed() && await btnLogin.isDisplayed(), true, 'Application launch successfully.')74 })75 it('TC_Reg_02 : To Verify "REGISTER" button functionality', async function () {76 await driver.setImplicitWaitTimeout(1000)77 const register = await driver.elementByAccessibilityId(registerAccessibilityId.register)78 await register.click()79 console.log('Clicked on \'Register\' button.')80 await driver.setImplicitWaitTimeout(2000)81 const mobileNo = await driver.elementByAccessibilityId(registerAccessibilityId.phone)82 const pswd = await driver.elementByAccessibilityId(registerAccessibilityId.password)83 const checkBox = await driver.elementByAccessibilityId(registerAccessibilityId.aggrementCheckbox)84 assert.equal(await mobileNo.isDisplayed() && await pswd.isDisplayed() && await checkBox.isDisplayed(), true, 'Successfully Redirected to Register page.')85 })86 it('TC_Reg_23 : To Verify "Register" button functionality with valid details.', async function () {87 await driver.setImplicitWaitTimeout(1000)88 const mobileNo = await driver.elementByAccessibilityId(registerAccessibilityId.phone)89 let mobileNumber = Math.floor(Math.random() * 9000000000) + 100000000090 await sendKey(driver,mobileNo,mobileNumber)91 console.log('Entered Mobile number : ' + mobileNumber)92 await driver.setImplicitWaitTimeout(1000)93 const password = await driver.elementByAccessibilityId(registerAccessibilityId.password)94 await sendKey(driver,password,registrationDS.password)95 console.log('Entered Password : ' + registrationDS.password)96 await driver.setImplicitWaitTimeout(1000)97 const checkBox = await driver.elementByAccessibilityId(registerAccessibilityId.aggrementCheckbox)98 await checkBox.click()99 console.log('Checked licence-agreement checkbox.')100 await driver.setImplicitWaitTimeout(1000)101 const registerBtn = await driver.elementByAccessibilityId(registerAccessibilityId.register)102 await registerBtn.click()103 console.log('Clicked on register Button.')104 await driver.setImplicitWaitTimeout(1000)105 })106 it('TC_Reg_28, TC_Reg_29, TC_Reg_32 : To Verify by adding 6 digit code.', async function () {107 await driver.waitForElementByAccessibilityId(registerAccessibilityId.otp,10000)108 await driver.setImplicitWaitTimeout(1000)109 const otpField = await driver.elementByAccessibilityId(registerAccessibilityId.otp)110 await sendKey(driver,otpField,registrationDS.validOTP)111 console.log('Entered OTP number : ' + registrationDS.validOTP)112 await driver.setImplicitWaitTimeout(2000)113 const nextBtn = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)114 await nextBtn.click()115 console.log('Clicked on next button.')116 await driver.setImplicitWaitTimeout(5000)117 const personalDetails = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)118 assert.equal(await personalDetails.isDisplayed(), true, 'Successfully Personal Detail screen displayed.')119 })120 it('TC_Reg_36 : To verify validation message by entering only one alphabet in first name field.', async function () {121 await driver.setImplicitWaitTimeout(1000)122 const firstNameField = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)123 await sendKey(driver,firstNameField,registrationDS.oneCharacterFLName)124 console.log('Entered firstName : ' + registrationDS.oneCharacterFLName)125 await driver.setImplicitWaitTimeout(1000)126 const firstNameError = await driver.elementByAccessibilityId(registerAccessibilityId.firstNameError)127 registrationVM.actualFirstNameErrorMsg = await firstNameError.text()128 console.log('Actual First Name Error Msg : ' + registrationVM.actualFirstNameErrorMsg)129 assert.equal(registrationVM.actualFirstNameErrorMsg, registrationVM.expectedFirstNameErrorMsg, 'FirstName Error Msg Displayed Successfully.')130 })131 it('TC_Reg_35 : To verify validation message by entering number and special character in first name field.', async function () {132 await driver.setImplicitWaitTimeout(1000)133 const firstNameField = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)134 await firstNameField.clear()135 await sendKey(driver,firstNameField,registrationDS.specialCharacterFLName)136 console.log('Entered firstName : ' + registrationDS.specialCharacterFLName)137 await driver.setImplicitWaitTimeout(1000)138 const firstNameError = await driver.elementByAccessibilityId(registerAccessibilityId.firstNameError)139 registrationVM.actualFirstNameErrorMsg = await firstNameError.text()140 console.log('Actual First Name Error Msg : ' + registrationVM.actualFirstNameErrorMsg)141 assert.equal(registrationVM.actualFirstNameErrorMsg, registrationVM.expectedFirstNameReqErrorMsg, 'Error Msg for special characters in first name field Displayed Successfully.')142 })143 it('TC_Reg_38 : To verify by removing the added text from First Name text field.', async function () {144 await driver.setImplicitWaitTimeout(1000)145 const firstNameField = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)146 await firstNameField.clear()147 await driver.setImplicitWaitTimeout(1000)148 await driver.setImplicitWaitTimeout(5000)149 let actualFirstName = await firstNameField.text()150 console.log('Actual First Name : ' + actualFirstName)151 assert.equal(actualFirstName, registrationVM.expectedEmptyFirstName, 'Text removed from First Name field.')152 console.log('Text removed from the First Name field.')153 })154 it('TC_Reg_40 : To verify validation message by entering number and special character in Last name field.', async function () {155 await driver.setImplicitWaitTimeout(1000)156 const lastNameField = await driver.elementByAccessibilityId(registerAccessibilityId.lastname)157 await sendKey(driver,lastNameField,registrationDS.specialCharacterFLName)158 console.log('Entered lastName :' + registrationDS.specialCharacterFLName)159 await driver.setImplicitWaitTimeout(1000)160 const lastNameError = await driver.elementByAccessibilityId(registerAccessibilityId.lastNameError)161 registrationVM.actuallastNameErrorMsg = await lastNameError.text()162 console.log('Actual First Name Error Msg : ' + registrationVM.actuallastNameErrorMsg)163 assert.equal(registrationVM.actuallastNameErrorMsg, registrationVM.expectedFirstNameReqErrorMsg, 'Error Msg for special characters in last name field Displayed Successfully.')164 })165 it('TC_Reg_41 : To verify validation message by entering only one alphabet in Last Name field.', async function () {166 await driver.setImplicitWaitTimeout(1000)167 const lastNameField = await driver.elementByAccessibilityId(registerAccessibilityId.lastname)168 await sendKey(driver,lastNameField,registrationDS.oneCharacterFLName)169 console.log('Entered lastName : ' + registrationDS.oneCharacterFLName)170 await driver.setImplicitWaitTimeout(1000)171 const lastNameError = await driver.elementByAccessibilityId(registerAccessibilityId.lastNameError)172 registrationVM.actuallastNameErrorMsg = await lastNameError.text()173 console.log('Actual Last Name Error Msg : ' + registrationVM.actuallastNameErrorMsg)174 assert.equal(registrationVM.actuallastNameErrorMsg, registrationVM.expectedFirstNameErrorMsg, 'LastName Error Msg Displayed Successfully.')175 })176 it('TC_Reg_43 : To verify by removing the added text from Last Name text field.', async function () {177 await driver.setImplicitWaitTimeout(2000)178 const lastNameField = await driver.elementByAccessibilityId(registerAccessibilityId.lastname)179 await lastNameField.clear()180 let actualLastName = await lastNameField.text()181 console.log('Actual Last Name : ' + actualLastName)182 assert.equal(actualLastName, registrationVM.expectedEmptyLastName, 'Text removed from Last Name field.')183 console.log('Text removed from the Last Name field and verified.')184 })185 it('TC_Reg_51 : To verify validation message for invalid format Email Ids.', async function () {186 await driver.setImplicitWaitTimeout(2000)187 const emailField = await driver.elementByAccessibilityId(registerAccessibilityId.email)188 await sendKey(driver,emailField,registrationDS.inValidEmailadd1)189 console.log('Entered In Valid Email ID : ' + registrationDS.inValidEmailadd1)190 await driver.setImplicitWaitTimeout(3000)191 let emailerror192 if (configuration.runOs == 'android') {193 emailerror = await driver.elementByXPath(registerXPath.invalidemailError)194 } else {195 emailerror = await driver.elementByXPath(registerXPath.invalidemailError)196 }197 registrationVM.actualEmailErrorMsg = await emailerror.text()198 console.log('Actual invalid Email Error Msg : ' + registrationVM.actualEmailErrorMsg)199 assert.equal(registrationVM.actualEmailErrorMsg, registrationVM.expectedEmailErrorMsg, 'For invalid Email ID format error msg Displayed Successfully.')200 console.log('Verified Error message for entering Invalid Email address.')201 await emailField.clear()202 await driver.setImplicitWaitTimeout(1000)203 await sendKey(driver,emailField,registrationDS.inValidEmailadd2)204 console.log('Entered In Valid Email ID : ' + registrationDS.inValidEmailadd2)205 await driver.setImplicitWaitTimeout(1000)206 let emailerror1207 if (configuration.runOs == 'android') {208 emailerror1 = await driver.elementByXPath(registerXPath.invalidemailError)209 } else {210 emailerror1 = await driver.elementByXPath(registerXPath.invalidemailError)211 }212 registrationVM.actualEmailErrorMsg = await emailerror1.text()213 console.log('Actual invalid Email Error Msg : ' + registrationVM.actualEmailErrorMsg)214 assert.equal(registrationVM.actualEmailErrorMsg, registrationVM.expectedEmailErrorMsg, 'For invalid Email ID format error msg Displayed Successfully.')215 console.log('Verified Error message for entering Invalid Email address.')216 await emailField.clear()217 await driver.setImplicitWaitTimeout(1000)218 await sendKey(driver,emailField,registrationDS.inValidEmailadd3)219 console.log('Entered In Valid Email ID : ' + registrationDS.inValidEmailadd3)220 await driver.setImplicitWaitTimeout(1000)221 let emailerror2222 if (configuration.runOs == 'android') {223 emailerror2 = await driver.elementByXPath(registerXPath.invalidemailError)224 } else {225 emailerror2 = await driver.elementByXPath(registerXPath.invalidemailError)226 }227 registrationVM.actualEmailErrorMsg = await emailerror2.text()228 console.log('Actual invalid Email Error Msg : ' + registrationVM.actualEmailErrorMsg)229 assert.equal(registrationVM.actualEmailErrorMsg, registrationVM.expectedEmailErrorMsg, 'For invalid Email ID format error msg Displayed Successfully.')230 console.log('Verified Error message for entering Invalid Email address.')231 await emailField.clear()232 })233 it('TC_Reg_52 : To verify by entering valid format Email Id and other valid details.', async function () {234 await driver.setImplicitWaitTimeout(1000)235 console.log('Entering valid Personal details.....')236 const firstNameField = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)237 await sendKey(driver,firstNameField,registrationDS.firstname)238 console.log('Entered firstName : ' + registrationDS.firstname)239 await driver.setImplicitWaitTimeout(1000)240 const lastNameField = await driver.elementByAccessibilityId(registerAccessibilityId.lastname)241 await sendKey(driver,lastNameField,registrationDS.lastname)242 console.log('Entered lastName : ' + registrationDS.lastname)243 if (configuration.runOs == 'android') {244 await driver.setImplicitWaitTimeout(1000)245 const dobField = await driver.elementByAccessibilityId(registerAccessibilityId.birthdate)246 await dobField.click()247 console.log('Clicked on DOB text field.')248 await driver.setImplicitWaitTimeout(1000)249 const dobFieldOK = await driver.elementById(registerAccessibilityId.okbutton)250 await dobFieldOK.click()251 console.log('Clicked on DOB ok button.')252 } else {253 await driver.setImplicitWaitTimeout(1000)254 const dobField = await driver.elementByAccessibilityId(registerAccessibilityId.birthdate)255 await dobField.click()256 console.log('Clicked on DOB text field.')257 await driver.setImplicitWaitTimeout(2000)258 let dobmonth259 try{260 console.log('Inside Try.')261 dobmonth = await driver.elementByXPath(registerXPath.dobmonth)262 }263 catch{264 console.log('Inside catch.')265 dobmonth = await driver.elementByXPath(registerXPath.dobmonth1)266 }267 await sendKey(driver, dobmonth, registrationDS.DOBMonth)268 await driver.setImplicitWaitTimeout(1000)269 console.log('Select September month.')270 const blankSpace = await driver.elementByXPath(registerXPath.blankSpace)271 await blankSpace.click()272 console.log('Clicked on Blank Space.')273 }274 await driver.setImplicitWaitTimeout(1000)275 const emailField = await driver.elementByAccessibilityId(registerAccessibilityId.email)276 await sendKey(driver,emailField,registrationDS.email)277 console.log('Entered EmailID : ' + registrationDS.email)278 await driver.setImplicitWaitTimeout(2000)279 const nextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)280 assert.equal(await nextButton.isDisplayed(), true, 'Next Enabled Displayed Successfully.')281 await nextButton.click()282 console.log('Clicked on \'Next\' button after filled valid Personal Details.')283 await driver.setImplicitWaitTimeout(1000)284 await driver.waitForElementByAccessibilityId(registerAccessibilityId.postalcode,10000)285 await driver.setImplicitWaitTimeout(1000)286 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)287 const addressDetailsText = await driver.elementByAccessibilityId(registerAccessibilityId.addressDetailsText)288 const postalCodeNextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)289 assert.equal(await postalCode.isDisplayed() && await addressDetailsText.isDisplayed() && await postalCodeNextButton.isDisplayed(), true, 'Postal Code and Address details text is displayed successfully.')290 console.log('Verified Postal Code-Address screen successfully.')291 })292 })293}...
newRegister.js
Source:newRegister.js
...5import {configuration} from '../config'6const {assert} = chai7let newRegister = function (driver, mobileNumber) {8 it('TC_Reg_02 : To Verify "REGISTER" button functionality', async function () {9 await driver.setImplicitWaitTimeout(3000)10 const register = await driver.elementByAccessibilityId(registerAccessibilityId.register)11 await register.click()12 console.log('Clicked on \'Register\' button.')13 await driver.setImplicitWaitTimeout(3000)14 const mobileNo = await driver.elementByAccessibilityId(registerAccessibilityId.phone)15 const pswd = await driver.elementByAccessibilityId(registerAccessibilityId.password)16 const checkBox = await driver.elementByAccessibilityId(registerAccessibilityId.aggrementCheckbox)17 let login18 if (configuration.runOs == 'android') {19 login = await driver.elementByXPath(registerXPath.login)20 } else {21 login = await driver.elementByAccessibilityId(registerAccessibilityId.loginlink)22 }23 assert.equal(await login.isDisplayed() && await mobileNo.isDisplayed() && await pswd.isDisplayed() && await checkBox.isDisplayed(), true, 'Successfully Redirected to Register page.')24 })25 it('TC_Reg_03 : To Verify "LOGIN" button functionality on registration page.', async function () {26 await driver.setImplicitWaitTimeout(1000)27 let login28 if (configuration.runOs == 'android') {29 login = await driver.elementByXPath(registerXPath.login)30 } else {31 login = await driver.elementByAccessibilityId(registerAccessibilityId.loginlink)32 }33 assert.equal(await login.isDisplayed(), true, 'LOGIN button displayed Successfully.')34 })35 it('TC_Reg_23 : To Verify "Register" button functionality with valid details.', async function () {36 await driver.setImplicitWaitTimeout(1000)37 const mobileNo = await driver.elementByAccessibilityId(registerAccessibilityId.phone)38 await sendKey(driver, mobileNo, mobileNumber)39 console.log('Entered Mobile number : ' + mobileNumber)40 await driver.setImplicitWaitTimeout(1000)41 const password = await driver.elementByAccessibilityId(registerAccessibilityId.password)42 await sendKey(driver, password, registrationDS.password)43 console.log('Entered Password.' + registrationDS.password)44 await driver.setImplicitWaitTimeout(1000)45 const checkBox = await driver.elementByAccessibilityId(registerAccessibilityId.aggrementCheckbox)46 await checkBox.click()47 console.log('Checked licence-agreement checkbox.')48 await driver.setImplicitWaitTimeout(1000)49 const registerBtn = await driver.elementByAccessibilityId(registerAccessibilityId.register)50 await registerBtn.click()51 console.log('Clicked on register Button.')52 await driver.waitForElementByAccessibilityId(registerAccessibilityId.otp, 10000)53 await driver.setImplicitWaitTimeout(1000)54 const otp = await driver.elementByAccessibilityId(registerAccessibilityId.otp)55 assert.equal(await otp.isDisplayed(), true, 'Verification Code page displayed Successfully.')56 })57 it('TC_Reg_24 : To Verify details shown on "Verification code" screen.', async function () {58 await driver.setImplicitWaitTimeout(3000)59 const otp = await driver.elementByAccessibilityId(registerAccessibilityId.otp)60 const nextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)61 const countDownText = await driver.elementByAccessibilityId(registerAccessibilityId.countdowntext)62 assert.equal(await countDownText.isDisplayed() && await otp.isDisplayed() && await nextButton.isDisplayed(), true, 'Successfully OTP page displayed.')63 })64 it('TC_Reg_28, TC_Reg_29, TC_Reg_32 : To Verify by adding 6 digit code.', async function () {65 await driver.setImplicitWaitTimeout(3000)66 const otpField = await driver.elementByAccessibilityId(registerAccessibilityId.otp)67 await sendKey(driver, otpField, registrationDS.validOTP)68 console.log('Entered OTP number.' + registrationDS.validOTP)69 await driver.setImplicitWaitTimeout(1000)70 const tickMark = await driver.elementByAccessibilityId(registerAccessibilityId.tickMark)71 assert.equal(await tickMark.isDisplayed(), true, 'Tick Mark displayed Successfully.')72 await driver.setImplicitWaitTimeout(2000)73 const nextBtn = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)74 assert.equal(await nextBtn.isDisplayed(), true, 'Next Button displayed Successfully.')75 await driver.setImplicitWaitTimeout(1000)76 await nextBtn.click()77 console.log('Clicked on next button.')78 await driver.setImplicitWaitTimeout(1000)79 await driver.waitForElementByAccessibilityId(registerAccessibilityId.firstname, 15000)80 await driver.setImplicitWaitTimeout(1000)81 const personalDetails = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)82 assert.equal(await personalDetails.isDisplayed(), true, 'Successfully Personal Detail screen displayed.')83 })84 it('TC_Reg_33, TC_Reg_54 : To Verify details on personal details screen.', async function () {85 const firstNameField = await driver.elementByAccessibilityId(registerAccessibilityId.firstname)86 await sendKey(driver, firstNameField, registrationDS.firstname)87 console.log('Entered firstName : ' + registrationDS.firstname)88 await driver.setImplicitWaitTimeout(1000)89 const lastNameField = await driver.elementByAccessibilityId(registerAccessibilityId.lastname)90 await sendKey(driver, lastNameField, registrationDS.lastname)91 console.log('Entered lastName :' + registrationDS.lastname)92 if (configuration.runOs == 'android') {93 await driver.setImplicitWaitTimeout(1000)94 const dobField = await driver.elementByAccessibilityId(registerAccessibilityId.birthdate)95 await dobField.click()96 console.log('Clicked on DOB text field.')97 await driver.setImplicitWaitTimeout(1000)98 const dobFieldOK = await driver.elementById(registerAccessibilityId.okbutton)99 await dobFieldOK.click()100 console.log('Clicked on DOB ok button.')101 } else {102 await driver.setImplicitWaitTimeout(1000)103 const dobField = await driver.elementByAccessibilityId(registerAccessibilityId.birthdate)104 await dobField.click()105 console.log('Clicked on DOB text field.')106 await driver.setImplicitWaitTimeout(2000)107 let dobmonth108 try {109 console.log('Inside Try.')110 dobmonth = await driver.elementByXPath(registerXPath.dobmonth)111 } catch {112 console.log('Inside catch.')113 dobmonth = await driver.elementByXPath(registerXPath.dobmonth1)114 }115 await sendKey(driver, dobmonth, registrationDS.DOBMonth)116 await driver.setImplicitWaitTimeout(1000)117 console.log('Select September month.')118 const blankSpace = await driver.elementByXPath(registerXPath.blankSpace)119 await blankSpace.click()120 console.log('Clicked on Blank Space.')121 }122 await driver.setImplicitWaitTimeout(1000)123 const emailField = await driver.elementByAccessibilityId(registerAccessibilityId.email)124 await sendKey(driver, emailField, registrationDS.email)125 console.log('Entered EmailID : ' + registrationDS.email)126 await driver.setImplicitWaitTimeout(1000)127 const backButton = await driver.elementByAccessibilityId(registerAccessibilityId.backButton)128 assert.equal(await backButton.isDisplayed(), true, 'Successfully back button displayed.')129 const nextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)130 await nextButton.click()131 console.log('Clicked on Next button.')132 await driver.setImplicitWaitTimeout(3000)133 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)134 const addressDetailsText = await driver.elementByAccessibilityId(registerAccessibilityId.addressDetailsText)135 const postalCodeNextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)136 assert.equal(await postalCode.isDisplayed() && await addressDetailsText.isDisplayed() && await postalCodeNextButton.isDisplayed(), true, 'Postal Code and Address details text is displayed successfully.')137 })138 it('TC_Reg_61, TC_Reg_62 : To Verify search icon functionality for valid postal code.', async function () {139 await driver.setImplicitWaitTimeout(2000)140 const postalCode = await driver.elementByAccessibilityId(registerAccessibilityId.postalcode)141 await sendKey(driver, postalCode, registrationDS.postalCode)142 console.log('Entered Postal Code : ' + registrationDS.postalCode)143 await driver.setImplicitWaitTimeout(3000)144 const searchIcon = await driver.elementByAccessibilityId(registerAccessibilityId.search)145 await searchIcon.click()146 console.log('Clicked on Search icon.')147 await driver.setImplicitWaitTimeout(10000)148 const selectAddress = await driver.elementByAccessibilityId(registerAccessibilityId.selectAddress)149 await selectAddress.click()150 console.log('Address Selected.')151 const country = await driver.elementByAccessibilityId('countryName-testId')152 let actualCountryName = await country.text()153 if (actualCountryName === 'Country') {154 await driver.setImplicitWaitTimeout(2000)155 const country = await driver.elementByAccessibilityId('countryName-testId')156 await sendKey(driver, country, "UK")157 console.log('Entered on country.')158 } else {159 }160 await driver.setImplicitWaitTimeout(2000)161 const nextButton = await driver.elementByAccessibilityId(registerAccessibilityId.nextButton)162 await nextButton.click()163 await driver.setImplicitWaitTimeout(1000)164 console.log('Clicked on Next button.')165 })166 it('TC_Reg_69 : To Verify "SIGN ME UP" button functionality from news and updates screen.', async function () {167 await driver.setImplicitWaitTimeout(1000)168 await driver.waitForElementByAccessibilityId(registerAccessibilityId.signmeup, 15000)169 const signMeUp = await driver.elementByAccessibilityId(registerAccessibilityId.signmeup)170 await signMeUp.click()171 console.log('Clicked on Sign Me Up button.')172 await driver.setImplicitWaitTimeout(1000)173 await driver.waitForElementByAccessibilityId(registerAccessibilityId.allow, 15000)174 const allowButton = await driver.elementByAccessibilityId(registerAccessibilityId.allow)175 const skipButton = await driver.elementByAccessibilityId(registerAccessibilityId.skip)176 assert.equal(await allowButton.isDisplayed() && await skipButton.isDisplayed(), true, 'Successfully allow and skip button displayed.')177 })178 it('TC_Reg_72 : To Verify "ALLOW" functionality from Your notifications screen.', async function () {179 await driver.setImplicitWaitTimeout(1000)180 const allowButton = await driver.elementByAccessibilityId(registerAccessibilityId.allow)181 await allowButton.click()182 console.log('Taped on allow button.')183 await driver.setImplicitWaitTimeout(1000)184 await driver.waitForElementByAccessibilityId(registerAccessibilityId.step3and4Text, 10000)185 const step3and4Text = await driver.elementByAccessibilityId(registerAccessibilityId.step3and4Text)186 const takeaSelfie = await driver.elementByAccessibilityId(registerAccessibilityId.takeaselfie)187 await driver.setImplicitWaitTimeout(1000)188 assert.equal(await step3and4Text.isDisplayed() && await takeaSelfie.isDisplayed(), true, 'Successfully step3and4 Text and takeaSelfie button displayed.')189 })190 it('TC_Reg_74, TC_Reg_77 : To Verify TAKE A SELFIE button functionality from verify your identity screen.', async function () {191 await driver.setImplicitWaitTimeout(2000)192 const takeaSelfie = await driver.elementByAccessibilityId(registerAccessibilityId.takeaselfie)193 await takeaSelfie.click()194 console.log('Taped on take selfie button.')195 await driver.waitForElementByAccessibilityId(registerAccessibilityId.capture, 10000)196 await driver.setImplicitWaitTimeout(1000)197 const capture = await driver.elementByAccessibilityId(registerAccessibilityId.capture)198 await capture.click()199 console.log('Taped on Capture button.')200 await driver.waitForElementByAccessibilityId(registerAccessibilityId.done, 35000)201 await driver.setImplicitWaitTimeout(3000)202 const done = await driver.elementByAccessibilityId(registerAccessibilityId.done)203 assert.equal(await done.isDisplayed(), true, 'Done Button displayed successfully.')204 })205 it('TC_Reg_78 : To Verify DONE button functionality from finished screen.', async function () {206 await driver.setImplicitWaitTimeout(3000)207 let done208 if (configuration.runOs == 'android') {209 done = await driver.elementByAccessibilityId(registerAccessibilityId.done)210 } else {211 done = await driver.elementByXPath(registerXPath.done)212 }213 await done.click()214 console.log('Taped on Done button.')215 await driver.setImplicitWaitTimeout(2000)216 })217 it('TC_Reg_78 : To Verify apply screen.', async function () {218 await driver.waitForElementByAccessibilityId(registerAccessibilityId.apply, 12000)219 await driver.setImplicitWaitTimeout(2000)220 const apply = await driver.elementByAccessibilityId(registerAccessibilityId.apply)221 const dashboard = await driver.elementByAccessibilityId(registerAccessibilityId.dashboard)222 const cards = await driver.elementByAccessibilityId(registerAccessibilityId.card)223 const profile = await driver.elementByAccessibilityId(registerAccessibilityId.profile)224 const more = await driver.elementByAccessibilityId(registerAccessibilityId.more)225 //const sport = await driver.elementByXPath(registerXPath.sport)226 //&& await sport.isDisplayed()227 assert.equal(await apply.isDisplayed() && await dashboard.isDisplayed() && await cards.isDisplayed() && await profile.isDisplayed() && await more.isDisplayed(), true, 'all elements displayed successfully on apply screen.')228 await driver.setImplicitWaitTimeout(2000)229 })230}231export {232 newRegister...
newRegisterMarmik.js
Source:newRegisterMarmik.js
1import chai from 'chai';2const { assert } = chai;3let newRegister = function (driver, DataSet) {4 it('TC_Reg_02 : To Verify "REGISTER" button functionality', async function () {5 await driver.setImplicitWaitTimeout(8000);6 const register = await driver.elementByAccessibilityId("registerBtn-testId");7 await register.click();8 console.log("Clicked on 'Register' button.");9 const mobileNo = await driver.elementByAccessibilityId("phone-testId");10 const pswd = await driver.elementByAccessibilityId("password-testId");11 const checkBox = await driver.elementByAccessibilityId("aggrementCheckbox-testId");12 const login = await driver.elementByXPath("//android.widget.TextView[@text='Login']");13 assert.equal(await mobileNo.isDisplayed() && await pswd.isDisplayed() && await checkBox.isDisplayed() && await login.isDisplayed(), true, "Successfully Redirected to Register page.");14 });15 it('TC_Reg_03 : To Verify "LOGIN" button functionality on registration page.', async function () {16 await driver.setImplicitWaitTimeout(1000);17 const loginButtonOnRegistrationPage = await driver.elementByXPath("//android.widget.TextView[@text='Login']");18 assert.equal(await loginButtonOnRegistrationPage.isDisplayed(), true, "LOGIN button displayed Successfully.");19 });20 it('TC_Reg_23 : To Verify "Register" button functionality with valid details.', async function () {21 await driver.setImplicitWaitTimeout(1000);22 const mobileNo = await driver.elementByAccessibilityId('phone-testId');23 await mobileNo.sendKeys(DataSet.mobileNumber);24 console.log("Entered Mobile number : " + DataSet.mobileNumber);25 await driver.setImplicitWaitTimeout(1000);26 const password = await driver.elementByAccessibilityId('password-testId');27 await password.sendKeys(DataSet.password);28 console.log("Entered Password." + DataSet.password);29 await driver.setImplicitWaitTimeout(1000);30 const checkBox = await driver.elementByAccessibilityId("aggrementCheckbox-testId");31 await checkBox.click();32 console.log("Checked licence-agreement checkbox.");33 await driver.setImplicitWaitTimeout(1000);34 const registerBtn = await driver.elementByAccessibilityId("registerBtn-testId");35 await registerBtn.click();36 console.log("Clicked on register Button.");37 await driver.setImplicitWaitTimeout(5000);38 const otp = await driver.elementByAccessibilityId("otp-testId");39 assert.equal(await otp.isDisplayed(), true, 'Verification Code page displayed Successfully.');40 });41 it('TC_Reg_24 : To Verify details shown on "Verification code" screen.', async function () {42 await driver.setImplicitWaitTimeout(3000);43 const otp = await driver.elementByAccessibilityId("otp-testId");44 const nextButton = await driver.elementByAccessibilityId("nextBtn-testId");45 const countDownText = await driver.elementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.widget.TextView[3]");46 assert.equal(await otp.isDisplayed() && await nextButton.isDisplayed() && await countDownText.isDisplayed(), true, 'Successfully OTP page displayed.');47 });48 it('TC_Reg_28, TC_Reg_29, TC_Reg_32 : To Verify by adding 6 digit code.', async function () {49 const otpField = await driver.elementByAccessibilityId("otp-testId");50 await otpField.sendKeys(DataSet.validOTP);51 console.log("Entered OTP number." + DataSet.validOTP);52 await driver.setImplicitWaitTimeout(1000);53 const tickMark = await driver.elementByXPath("//android.view.ViewGroup[@content-desc='otpContainer-testId']/android.widget.TextView");54 assert.equal(await tickMark.isDisplayed(), true, "Tick Mark displayed Successfully.");55 await driver.setImplicitWaitTimeout(2000);56 const nextBtn = await driver.elementByAccessibilityId("nextBtn-testId");57 assert.equal(await nextBtn.isDisplayed(), true, "Next Button displayed Successfully.");58 await driver.setImplicitWaitTimeout(1000);59 await nextBtn.click();60 console.log("Clicked on next button.");61 await driver.setImplicitWaitTimeout(5000);62 const personalDetails = await driver.elementByAccessibilityId("firstName-testId");63 assert.equal(await personalDetails.isDisplayed(), true, "Successfully Personal Detail screen displayed.");64 });65 it('TC_Reg_33, TC_Reg_54 : To Verify details on personal details screen.', async function () {66 const firstNameField = await driver.elementByAccessibilityId("firstName-testId");67 await firstNameField.sendKeys(DataSet.firstname);68 console.log("Entered firstName : " + DataSet.firstname);69 await driver.setImplicitWaitTimeout(1000);70 const lastNameField = await driver.elementByAccessibilityId("lastName-testId");71 await lastNameField.sendKeys(DataSet.lastname);72 console.log("Entered lastName :" + DataSet.lastname);73 await driver.setImplicitWaitTimeout(1000);74 const dobField = await driver.elementByAccessibilityId("birthDateContainer-testId");75 await dobField.click();76 console.log("Clicked on DOB text field.");77 await driver.setImplicitWaitTimeout(1000);78 const dobFieldOK = await driver.elementById("android:id/button1");79 await dobFieldOK.click();80 console.log("Clicked on DOB ok button.");81 await driver.setImplicitWaitTimeout(1000);82 const emailField = await driver.elementByAccessibilityId("emailId-testId");83 await emailField.sendKeys(DataSet.email);84 console.log("Entered EmailID : " + DataSet.email);85 await driver.setImplicitWaitTimeout(1000);86 const backButton = await driver.elementByAccessibilityId("leftIconBtn-testId");87 assert.equal(await backButton.isDisplayed(), true, "Successfully back button displayed.");88 const nextButton = await driver.elementByAccessibilityId("nextBtn-testId");89 await nextButton.click();90 console.log("Clicked on Next button.");91 await driver.setImplicitWaitTimeout(3000);92 const postalCode = await driver.elementByAccessibilityId("postalCode-testId");93 const addressDetailsText = await driver.elementByXPath("//android.widget.TextView[@text='Step 2 of 4: The address details']");94 const postalCodeNextButton = await driver.elementByAccessibilityId("nextBtn-testId");95 assert.equal(await postalCode.isDisplayed() && await addressDetailsText.isDisplayed() && await postalCodeNextButton.isDisplayed(), true, "Postal Code and Address details text is displayed successfully.");96 });97 it('TC_Reg_61, TC_Reg_62 : To Verify search icon functionality for valid postal code.', async function () {98 await driver.setImplicitWaitTimeout(2000);99 const postalCode = await driver.elementByAccessibilityId("postalCode-testId");100 await postalCode.sendKeys(DataSet.expectedPostalCodeValue);101 console.log("Entered Postal Code : " + DataSet.expectedPostalCodeValue);102 await driver.setImplicitWaitTimeout(1000);103 const searchIcon = await driver.elementByAccessibilityId("searchIcon-testId");104 await searchIcon.click();105 console.log("Clicked on Search icon.");106 await driver.setImplicitWaitTimeout(10000);107 const selectAddress = await driver.elementByXPath("//android.widget.TextView[@text='Chelsea Academy, London, England']");108 await selectAddress.click();109 console.log("Address Selected.");110 await driver.setImplicitWaitTimeout(2000);111 const nextButton = await driver.elementByAccessibilityId("nextBtn-testId");112 await nextButton.click();113 console.log("Clicked on Next button.");114 });115 it('TC_Reg_69 : To Verify "SIGN ME UP" button functionality from news and updates screen.', async function () {116 await driver.setImplicitWaitTimeout(3000);117 const signMeUp = await driver.elementByAccessibilityId("signMeUpBtn-testId");118 await signMeUp.click();119 console.log("Clicked on Sign Me Up button.");120 await driver.setImplicitWaitTimeout(2000);121 const allowButton = await driver.elementByAccessibilityId("allowBtn-testId");122 const skipButton = await driver.elementByXPath("//android.widget.TextView[@text='skip']");123 assert.equal(await allowButton.isDisplayed() && await skipButton.isDisplayed(), true, "Successfully allow and skip button displayed.");124 });125 it('TC_Reg_72 : To Verify "ALLOW" functionality from Your notifications screen.', async function () {126 await driver.setImplicitWaitTimeout(1000);127 const allowButton = await driver.elementByAccessibilityId("allowBtn-testId");128 await allowButton.click();129 console.log("Taped on allow button.");130 await driver.setImplicitWaitTimeout(5000);131 const step3and4Text = await driver.elementByXPath("//android.widget.TextView[@text='Step 3 of 4: Quick ID check']");132 const takeaSelfie = await driver.elementByAccessibilityId("startPictureBtn-testId");133 await driver.setImplicitWaitTimeout(1000);134 assert.equal(await step3and4Text.isDisplayed() && await takeaSelfie.isDisplayed(), true, "Successfully step3and4 Text and takeaSelfie button displayed.");135 });136 it('TC_Reg_74, TC_Reg_77 : To Verify TAKE A SELFIE button functionality from verify your identity screen.', async function () {137 await driver.setImplicitWaitTimeout(2000);138 const takeaSelfie = await driver.elementByAccessibilityId("startPictureBtn-testId");139 await takeaSelfie.click();140 console.log("Taped on take selfie button.");141 await driver.setImplicitWaitTimeout(1000);142 const capture = await driver.elementByAccessibilityId("captureSelfie-testId");143 await capture.click();144 console.log("Taped on Capture button.");145 await driver.setImplicitWaitTimeout(10000);146 const done = await driver.elementByAccessibilityId("doneBtn-testId");147 assert.equal(await done.isDisplayed(), true, "Done Button displayed successfully.");148 });149 it('TC_Reg_78 : To Verify DONE button functionality from finished screen.', async function () {150 await driver.setImplicitWaitTimeout(5000);151 const done = await driver.elementByAccessibilityId("doneBtn-testId");152 await done.click();153 console.log("Taped on Done button.");154 await driver.setImplicitWaitTimeout(2000);155 });156 it('TC_Reg_78 : To Verify apply screen.', async function () {157 await driver.setImplicitWaitTimeout(3000);158 const apply = await driver.elementByAccessibilityId("Apply, tab, 1 of 5");159 const dashboard = await driver.elementByAccessibilityId("Dashboard, tab, 2 of 5");160 const cards = await driver.elementByAccessibilityId("Cards, tab, 3 of 5");161 const profile = await driver.elementByAccessibilityId("Profile, tab, 4 of 5");162 const more = await driver.elementByAccessibilityId("More, tab, 5 of 5");163 const sport = await driver.elementByXPath("//android.widget.TextView[@text='Sports']");164 assert.equal(await apply.isDisplayed() && await dashboard.isDisplayed() && await cards.isDisplayed() && await profile.isDisplayed() && await more.isDisplayed() && await sport.isDisplayed(), true, "all elements displayed successfully on apply screen.");165 await driver.setImplicitWaitTimeout(2000);166 });167};168export {169 newRegister...
stepdefs.js
Source:stepdefs.js
...23 let ehTelaLogin = await driver.hasElementByAccessibilityId("botao-login");24 assert.equal(ehTelaLogin, true);25});26When('Eu clico na opção de cadastro', {timeout: 20000}, async() => {27 await driver.setImplicitWaitTimeout(15000);28 let botaoCadastro = await driver.elementByAccessibilityId("botao-cadastro");29 botaoCadastro.click();30});31When('Eu estou na tela de cadastro', {timeout: 30000}, async() => {32 await driver.setImplicitWaitTimeout(15000);33 let ehTelaCadastro = await driver.hasElementByAccessibilityId("botao-cadastrar");34 assert.equal(ehTelaCadastro, true);35});36When('eu preencho o campo "nome" com "João Silva"', async() => {37 let preencherNome = await driver.elementByAccessibilityId('campo-nome');38 preencherNome.sendKeys("João Silva");39});40When('eu preencho o campo "email" com "exemplo2@email.com"', async() => {41 let preencherEmail = await driver.elementByAccessibilityId('campo-email');42 preencherEmail.sendKeys("exemplo2@email.com");43});44///45When('eu preencho o campo "email" com "exemplo@email.com"', async() => {46 let preencherEmail = await driver.elementByAccessibilityId('campo-email');47 preencherEmail.sendKeys("exemplo@email.com");48});49///50When('eu preencho o campo "senha" e o campo "confirmar senha" com a senha invalida "a"', async() => {51 let preencherSenha = await driver.elementByAccessibilityId('campo-senha');52 preencherSenha.sendKeys("a");53 let preencherConfirmarSenha = await driver.elementByAccessibilityId('campo-confirmarSenha');54 preencherConfirmarSenha.sendKeys("a");55});56When('eu preencho o campo "senha" e o campo "confirmar senha" com "123456"', async() => {57 let preencherSenha = await driver.elementByAccessibilityId('campo-senha');58 preencherSenha.sendKeys("123456");59 let preencherConfirmarSenha = await driver.elementByAccessibilityId('campo-confirmarSenha');60 preencherConfirmarSenha.sendKeys("123456");61});62When('eu preencho o campo "Nª de celular" com "8822445566"', async() => {63 let preencherCelular = await driver.elementByAccessibilityId('campo-celular');64 preencherCelular.sendKeys("8822445566");65});66///67When('eu preencho o campo "Nª de celular" com "8833445566"', async() => {68 let preencherCelular = await driver.elementByAccessibilityId('campo-celular');69 preencherCelular.sendKeys("8833445566");70});71///72When('eu seleciono a opção "Prestador"', async() => {73 let campoPrestador = await driver.elementByAccessibilityId("campo-prestador");74 campoPrestador.click();75});76When('eu seleciono a opção "Tipo de Serviço" e seleciono "Manicure"', async() => {77 let campoServico = await driver.elementByAccessibilityId("campo-servico");78 //campoServico.click();79 let campoTipoServico = await driver.elementByAccessibilityId("campo-tiposervico")80 campoTipoServico.click()81 campoTipoServico.select("Manicure");82});83When('eu pressiono o botão "Cadastrar"', async() => {84 let botaoCadastrar = await driver.elementByAccessibilityId("botao-cadastrar");85 botaoCadastrar.click();86});87Then('eu vejo uma mensagem de confirmação de cadastro', async() => {88 await driver.setImplicitWaitTimeout(15000);89 let msgErro = await driver.hasElementByXPath("//*[@text='Conta cadastrada!']");90 assert.equal(msgErro, true);91})92Then('eu vejo a tela de login', {timeout: 20000}, async() => {93 await driver.setImplicitWaitTimeout(15000);94 let ehTelaLogin = await driver.hasElementByAccessibilityId("botao-login");95 assert.equal(ehTelaLogin, true);96});97Then('eu vejo uma mensagem de erro', {timeout: 20000}, async() => {98 await driver.setImplicitWaitTimeout(15000);99 let msgErro = await driver.hasElementByXPath("//*[@text='Preencha todos os campos corretamente']");100 assert.equal(msgErro, true);101});102Then('eu vejo uma mensagem de erro indicando email já cadastrado', {timeout: 20000}, async() => {103 await driver.setImplicitWaitTimeout(15000);104 let msgErro = await driver.hasElementByXPath("//*[@text='Já existe um usuário com esse email.']");105 assert.equal(msgErro, true);106});107When('eu preencho o campo "senha" com "123456"', async() => {108 let preencherSenha = await driver.elementByAccessibilityId('campo-senha');109 preencherSenha.sendKeys("123456");110});111When('eu pressiono o botão "Login"', async() => {112 let botaoLogin = await driver.elementByAccessibilityId("botao-login");113 botaoLogin.click();114});115Then('eu vejo a tela inicial de cliente', {timeout: 20000}, async() => {116 await driver.setImplicitWaitTimeout(15000);117 let ehTelaInicial = await driver.hasElementByAccessibilityId("bemvindo");118 assert.equal(ehTelaInicial, true);119});120When('eu preencho o campo "email" com o email incorreto "abc@email.com"', async() => {121 let preencherEmail = await driver.elementByAccessibilityId('campo-email');122 preencherEmail.sendKeys("abc@email.com");123});124When('eu preencho o campo "senha" com a senha incorreta "654321"', async() => {125 let preencherSenha = await driver.elementByAccessibilityId('campo-senha');126 preencherSenha.sendKeys("654321");127});128Then('eu vejo uma mensagem de erro no login indicando email incorreto', {timeout: 20000}, async() => {129 await driver.setImplicitWaitTimeout(15000);130 let msgErro = await driver.hasElementByXPath("//*[@text='Email não existe!']");131 assert.equal(msgErro, true);132});133Then('eu vejo uma mensagem de erro no login indicando senha incorreta', {timeout: 20000}, async() => {134 await driver.setImplicitWaitTimeout(15000);135 let msgErro = await driver.hasElementByXPath("//*[@text='Senha incorreta!']");136 assert.equal(msgErro, true);137});138When('eu vejo a tela inicial de prestador', {timeout: 20000}, async() => {139 await driver.setImplicitWaitTimeout(15000);140 let ehTelaInicial = await driver.hasElementByAccessibilityId("bemvindo");141 assert.equal(ehTelaInicial, true);142});143When('eu pressiono o botão "Criar Serviço"', async() => {144 let botaoCriarServico = await driver.elementByAccessibilityId("botao-criarservico");145 botaoCriarServico.click();146});147When('eu vejo a tela inicial de novo serviço', {timeout: 20000}, async() => {148 await driver.setImplicitWaitTimeout(15000);149 let ehTelaNovoServico = await driver.hasElementByXPath("//*[@text='Novo Serviço']");150 assert.equal(ehTelaNovoServico, true);151});152When('eu preencho o campo "nome" com "Corte de cabelo"', async() => {153 let preencherNome = await driver.elementByAccessibilityId('campo-nome');154 preencherNome.sendKeys("Corte de cabelo");155});156When('eu preencho o campo "valor" com "50,00"', async() => {157 let preencherValor = await driver.elementByAccessibilityId('campo-valor');158 preencherValor.sendKeys("50");159});160When('eu preencho o campo "Duração Média" com "15,00"', async() => {161 let preencherDuracao = await driver.elementByAccessibilityId('campo-duracao');162 preencherDuracao.sendKeys("15");163});164When('eu preencho o campo "Descrição" com "Adicione uma descrição"', async() => {165 let preencherDescricao = await driver.elementByAccessibilityId('campo-descricao');166 preencherDescricao.sendKeys("Adicione uma descrição");167});168When('eu pressiono o botão "Concluir"', async() => {169 let botaoConcluir = await driver.elementByAccessibilityId("botao-concluir");170 botaoConcluir.click();171});172Given('O usuario de email {string} e senha {string} existe', {timeout: 30000}, async (email, senha) => {173 // tela de login174 let ehTelaLogin = await driver.hasElementByAccessibilityId("botao-login");175 assert.equal(ehTelaLogin, true);176 // cadastro177 let irCadastrar = await driver.elementByAccessibilityId('botao-cadastro');178 irCadastrar.click();179 await driver.setImplicitWaitTimeout(5000);180 // nome181 let preencherNome = await driver.elementByAccessibilityId('campo-nome');182 preencherNome.sendKeys("Evandro");183 // email184 let preencherEmail = await driver.elementByAccessibilityId('campo-email');185 preencherEmail.sendKeys(email);186 // senha187 let preencherSenha = await driver.elementByAccessibilityId('campo-senha');188 preencherSenha.sendKeys(senha);189 // confirmarSenha190 let preencherConfirmarSenha = await driver.elementByAccessibilityId('campo-confirmarSenha');191 preencherConfirmarSenha.sendKeys(senha);192 // celular193 let preencherCelular = await driver.elementByAccessibilityId('campo-celular');194 preencherCelular.sendKeys('88922445566');195 // cadastrar196 let cadastrarBtn = await driver.elementByAccessibilityId('botao-cadastrar');197 cadastrarBtn.click();198 await driver.setImplicitWaitTimeout(5000);199 let alert = await driver.elementByXPath("//*[@text='OK']");200 alert.click();201});202Given('Eu estou logado com email {string} e senha {string}',{timeout: 30000} , async (email, senha203) => {204 let preencherEmail = await driver.elementByAccessibilityId('campo-email');205 preencherEmail.sendKeys(email);206 // senha207 let preencherSenha = await driver.elementByAccessibilityId('campo-senha');208 preencherSenha.sendKeys(senha);209 loginBtn = await driver.elementByAccessibilityId('botao-login');210 loginBtn.click();211});212Given('Eu estou na tela inicial de cliente', {timeout: 30000}, async() => {213 await driver.setImplicitWaitTimeout(5000);214 let ehTelaInicio = await driver.hasElementByAccessibilityId("bemvindo");215 assert.equal(ehTelaInicio, true);216});217Given('Eu clico em buscar prestadores', {timeout: 30000}, async() => {218 await driver.setImplicitWaitTimeout(15000);219 let buscarBtn = await driver.elementByAccessibilityId("buscar-prestador-btn");220 buscarBtn.click();221 let telaBusca = await driver.hasElementByAccessibilityId("buscar-prestador-tela");222 assert.equal(telaBusca, true);223});224Given('Preencho campo do nome com {string}', {timeout: 30000}, async(nome) => {225 await driver.setImplicitWaitTimeout(15000);226 let campoNome = await driver.elementByAccessibilityId('nome-prestador');227 campoNome.sendKeys(nome);228});229When('Clico em buscar este prestador', {timeout: 30000}, async() => {230 await driver.setImplicitWaitTimeout(15000);231 let buscarBtn = await driver.elementByAccessibilityId('buscar-prestador-btn');232 buscarBtn.click();233});234Then('Vejo o prestador {string}', {timeout: 30000}, async(nome) => {235 await driver.setImplicitWaitTimeout(15000);236 let hasNome = await driver.hasElementByXPath("//*[@text='"+nome+"']");237 assert.equal(hasNome, true);238});239When('Clico em listar os serviços do prestador {string}', {timeout: 30000}, async(nome) => {240 await driver.setImplicitWaitTimeout(15000);241 let buscarBtnNome = await driver.elementByAccessibilityId(nome);242 buscarBtnNome.click();243});244Then('Vejo a lista de serviços', {timeout: 30000}, async() => {245 await driver.setImplicitWaitTimeout(15000);246 let listaTela = await driver.hasElementByAccessibilityId('lista-servicos-tela');247 assert.equal(listaTela, true);248});249When('Seleciono o serviço de nome {string}', {timeout: 30000}, async(nomeServico) => {250 await driver.setImplicitWaitTimeout(15000);251 let servico = await driver.elementByAccessibilityId(nomeServico);252 servico.click();253});254Then('Vejo as informações do serviço', {timeout: 30000}, async() => {255 await driver.setImplicitWaitTimeout(15000);256 let servico = await driver.hasElementByAccessibilityId('servico-tela');257 assert.equal(servico, true)258});259Then('eu vejo uma mensagem de confirmação de cadastro do serviço', async() => {260 await driver.setImplicitWaitTimeout(15000);261 let msgErro = await driver.hasElementByXPath("//*[@text='Serviço cadastrado!']");262 assert.equal(msgErro, true);...
appium.js
Source:appium.js
...28 let loginButton = await driver.elementByAccessibilityId("press-button");29 loginButton.click();30});31// Then ('I see the alert', {timeout: 2000}, async () => {32// await driver.setImplicitWaitTimeout(1500);33// let isAlert = await driver.hasElementByXPath("//*[@text='Você apertou o botão']");34// assert.equal(isAlert, true);35// });36Given ('I am in app middle page', {timeout: 30000}, async () => {37 await driver.setImplicitWaitTimeout(30000);38 let isMiddleMessage = await driver.hasElementByAccessibilityId("middle-message");39 assert.equal(isMiddleMessage, true);40});41When ('I click on "Pressione-Middle" button', async () => {42 let loginButton2 = await driver.elementByAccessibilityId("press-button-middle");43 loginButton2.click();44});45Given ('I am in app camera page', {timeout: 30000}, async () => {46 await driver.setImplicitWaitTimeout(30000);47 let isCameraMessage = await driver.hasElementByAccessibilityId("camera-message");48 assert.equal(isCameraMessage, true);49});50When ('I click on "Pressione-Camera" button', async () => {51 let loginButton3 = await driver.elementByAccessibilityId("press-button-camera");52 loginButton3.click();53});54Given ('I am in app end page', {timeout: 30000}, async () => {55 await driver.setImplicitWaitTimeout(30000);56 let isEndMessage = await driver.hasElementByAccessibilityId("end-message");57 assert.equal(isEndMessage, true);58});59When ('I click on "Pressione-End" button', async () => {60 let loginButton4 = await driver.elementByAccessibilityId("press-button-end");61 loginButton4.click();...
Using AI Code Generation
1driver.setImplicitWaitTimeout(5000);2driver.setPageLoadTimeout(5000);3driver.setTimeouts(5000);4driver.setScriptTimeout(5000);5driver.getPageSource();6driver.getWindowHandles();7driver.getWindowHandle();8driver.getOrientation();9driver.setOrientation("LANDSCAPE");10driver.getGeoLocation();11driver.setGeoLocation();12driver.getNetworkConnection();13driver.setNetworkConnection();14driver.getAvailableLogTypes();15driver.getLogs();16driver.getPerformanceDataTypes();17driver.getPerformanceData();
Using AI Code Generation
1const wd = require('wd');2const { assert } = require('chai');3const { serverConfig } = require('./helpers/config');4const { capabilities } = require('./helpers/capabilities');5async function main() {6 const driver = await wd.promiseChainRemote(serverConfig);7 await driver.init(capabilities);8 await driver.setImplicitWaitTimeout(5000);9 const text = await driver.elementByAccessibilityId('Text').text();10 assert.equal(text, 'Text');11 await driver.quit();12}13main();14exports.serverConfig = {
Using AI Code Generation
1const wdio = require("webdriverio");2const assert = require("assert");3const opts = {4 capabilities: {5 }6};7(async () => {8 const client = await wdio.remote(opts);9 await client.setImplicitWaitTimeout(10000);10 await client.$("~1").click();11 await client.$("~+").click();12 await client.$("~2").click();13 await client.$("~=").click();14 const text = await client.$("~3").getText();15 assert.strictEqual(text, "3");16 await client.deleteSession();17})();18driver.timeoutsImplicitWait(ms)
Using AI Code Generation
1describe('Test App', function() {2 it('should set implicit wait timeout', function() {3 driver.setImplicitWaitTimeout(20000);4 driver.elementById('com.example.apple-samplecode.UICatalog:id/buttons')5 .click();6 driver.elementById('com.example.apple-samplecode.UICatalog:id/buttons')7 .click();8 driver.elementById('com.example.apple-samplecode.UICatalog:id/buttons')9 .click();10 driver.elementById('com.example.apple-samplecode.UICatalog:id/buttons')11 .click();12 driver.elementById('com.example.apple-samplecode.UICatalog:id/buttons')13 .click();14 driver.elementById('com.example.apple-samplecode.UICatalog:id/buttons')15 .click();16 driver.elementById('com.example.apple-samplecode.UICatalog:id/buttons')17 .click();18 driver.elementById('com.example.apple-samplecode.UICatalog:id/buttons')19 .click();20 driver.elementById('com.example.apple-samplecode.UICatalog:id/buttons')21 .click();
Using AI Code Generation
1const wd = require('wd');2const assert = require('assert');3const desiredCaps = {4}5driver.init(desiredCaps)6 .then(() => driver.setImplicitWaitTimeout(3000))7 .then(() => driver.elementByAccessibilityId('ComputeSumButton'))8 .then((el) => el.click())9 .then(() => driver.elementByAccessibilityId('Answer'))10 .then((el) => el.text())11 .then((text) => assert.equal(text, '42'))12 .then(() => driver.quit())13 .catch((err) => console.log(err))
Using AI Code Generation
1const wd = require('wd');2const path = require('path');3const assert = require('assert');4const chai = require('chai');5const chaiAsPromised = require('chai-as-promised');6chai.use(chaiAsPromised);7const app = path.resolve(__dirname, 'TestApp.app.zip');8const appPath = path.resolve(__dirname, app);9const driver = wd.promiseChainRemote('localhost', 4723);10const caps = {11};12driver.init(caps)13 .then(() => driver.setImplicitWaitTimeout(30000))14 .then(() => driver.elementByAccessibilityId('IntegerA'))15 .catch((err) => {16 console.log(err);17 })18 .finally(() => driver.quit());
Using AI Code Generation
1driver.setImplicitWaitTimeout(5000);2driver.setImplicitWaitTimeout(5000);3driver.setImplicitWaitTimeout(5000);4driver.setImplicitWaitTimeout(5000);5driver.setImplicitWaitTimeout(5000);6driver.setImplicitWaitTimeout(5000);7driver.setImplicitWaitTimeout(5000);8driver.setImplicitWaitTimeout(5000);9driver.setImplicitWaitTimeout(5000);
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!