Best JavaScript code snippet using appium-xcuitest-driver
basic.e2e.js
Source:basic.e2e.js  
...12  afterAll(async () => driver.quit());13  it('check Search', async () => {                                                                   // ÐоиÑк14    expect(await driver.waitForElementById('openSearchInputID'));15    // console.log("ÐоиÑк еÑÑÑ")16    await driver.elementByAccessibilityId('openSearchInputID').click();17    // console.log("ÐоиÑк оÑкÑÑÑ")18    expect(await driver.waitForElementById('searchInput_TitleID'));19    // console.log("СÑÑока ввода еÑÑÑ")20    expect(await driver.waitForElementById('searchFocus_mainID'));21    // console.log("ÐÐ¾ÐºÐ¾Ð²Ð°Ñ Ð»Ñпа еÑÑÑ")22    expect(await driver.waitForElementById('search_closeID'));23    // console.log("ÐакÑÑÑие поиÑка еÑÑÑ")24    await driver.elementByAccessibilityId('searchInput_TitleID').type("CHF/JPY");25    expect(await driver.waitForElementById("CHF/JPYID"))26    // console.log("ÐÐ»ÐµÐ¼ÐµÐ½Ñ Ð½Ð°Ð¹Ð´ÐµÐ½")27    let element = await driver.elementByAccessibilityId("CHF/JPYFullNameID");28    let text = await element.text();29    // console.log(text);30    expect(text).toEqual('CHF/JPY');31    // console.log("ТекÑÑ ÑооÑвеÑÑÑвÑеÑ")32    await driver.elementByAccessibilityId('search_closeID').click();33  });34  it('check Autorization', async () => {                                                         //ÐойÑи в авÑоÑизаÑии35    expect(await driver.waitForElementById('ButtonMenuID'));36    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")37    await driver.elementByAccessibilityId('ButtonMenuID').click();38    // console.log("ÐÐµÐ½Ñ Ð¾ÑкÑÑÑо")39    expect(await driver.waitForElementById('LogInMenuID'));40    // console.log("ÐойÑи еÑÑÑ!")41    await driver.elementByAccessibilityId('LogInMenuID').click();42    // console.log("ÐойÑи оÑкÑÑÑо")43    expect(await driver.waitForElementById('LoginAuthorizationID'));44    // console.log("Ðоле логин еÑÑÑ!")45    expect(await driver.waitForElementById('PasswordInputAuthorizationID'));46    // console.log("Ðоле паÑÐ¾Ð»Ñ ÐµÑÑÑ!")47    await driver.elementByAccessibilityId('LoginAuthorizationID').type("testviktoriya@gmail.com");48    // console.log("Ðогин введÑн")49    await driver.elementByAccessibilityId('PasswordInputAuthorizationID').type("123qwe");50    // console.log("ÐаÑÐ¾Ð»Ñ Ð²Ð²ÐµÐ´Ñн")51    expect(await driver.waitForElementById('BtnShowPassAuthorizationID'));52    // console.log("СкÑÑÑÑ Ð¿Ð°ÑÐ¾Ð»Ñ ÐÑÑÑ")53    await driver.elementByAccessibilityId('BtnShowPassAuthorizationID').click();54    // console.log("ÐаÑÐ¾Ð»Ñ ÑкÑÑÑ!")55    await driver.elementByAccessibilityId('BtnShowPassAuthorizationID').click();56    // console.log("ÐаÑÐ¾Ð»Ñ Ð¿Ð¾ÐºÐ°Ð·Ð°Ð½")57    expect(await driver.waitForElementById('BtnLoginAuthorizationID'));58    // console.log('Ðнопка "ÐойÑи" еÑÑÑ')59    await driver.elementByAccessibilityId('BtnLoginAuthorizationID').click();60    // console.log("ÐвÑоÑизиÑовано")61    await driver.sleep(3000) // ÐоÑÑÑлÑ62    expect(await driver.waitForElementById('ButtonMenuID'));63    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")64    expect(await driver.waitForElementById('openSearchInputID'));65    // console.log("ÐоиÑк еÑÑÑ")66    expect(await driver.waitForElementById('TabTitleID'));67    // console.log("Ðаголовок еÑÑÑ")68    // ÐÑовеÑка popup69    let element = await driver.elementByAccessibilityId("TabTitleID");70    let text = await element.text();71    // console.log(text);72    expect(text).toEqual('ÐалÑÑÑ');73    // console.log("ТекÑÑ ÑооÑвеÑÑÑвÑеÑ")74  });75  it('check Autorization', async () => {                                                 //ÐÑÑ
од из авÑоÑизиÑованого полÑзоваÑелÑ76    expect(await driver.waitForElementById('ButtonMenuID'));77    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")78    await driver.elementByAccessibilityId('ButtonMenuID').click();79    // console.log("ÐÐµÐ½Ñ Ð¾ÑкÑÑÑо")80    expect(await driver.waitForElementById('LogInMenuID'));81    // console.log("ÐойÑи еÑÑÑ!")82    await driver.elementByAccessibilityId('LogInMenuID').click();83    // console.log("ÐойÑи оÑкÑÑÑо")84    expect(await driver.waitForElementById('LoginAuthorizationID'));85    // console.log("Ðоле логин еÑÑÑ!")86    expect(await driver.waitForElementById('PasswordInputAuthorizationID'));87    // console.log("Ðоле паÑÐ¾Ð»Ñ ÐµÑÑÑ!")88    await driver.elementByAccessibilityId('LoginAuthorizationID').type("testviktoriya@gmail.com");89    // console.log("Ðогин введÑн")90    await driver.elementByAccessibilityId('PasswordInputAuthorizationID').type("123qwe");91    // console.log("ÐаÑÐ¾Ð»Ñ Ð²Ð²ÐµÐ´Ñн")92    expect(await driver.waitForElementById('BtnShowPassAuthorizationID'));93    // console.log("СкÑÑÑÑ Ð¿Ð°ÑÐ¾Ð»Ñ ÐÑÑÑ")94    await driver.elementByAccessibilityId('BtnShowPassAuthorizationID').click();95    // console.log("ÐаÑÐ¾Ð»Ñ ÑкÑÑÑ!")96    await driver.elementByAccessibilityId('BtnShowPassAuthorizationID').click();97    // console.log("ÐаÑÐ¾Ð»Ñ Ð¿Ð¾ÐºÐ°Ð·Ð°Ð½")98    expect(await driver.waitForElementById('BtnLoginAuthorizationID'));99    // console.log('Ðнопка "ÐойÑи" еÑÑÑ')100    await driver.elementByAccessibilityId('BtnLoginAuthorizationID').click();101    // console.log("ÐвÑоÑизиÑовано")102    await driver.sleep(3000) // ÐоÑÑÑлÑ103    expect(await driver.waitForElementById('ButtonMenuID'));104    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")105    expect(await driver.waitForElementById('openSearchInputID'));106    // console.log("ÐоиÑк еÑÑÑ")107    expect(await driver.waitForElementById('TabTitleID'));108    // console.log("Ðаголовок еÑÑÑ")109    expect(await driver.waitForElementById('ButtonMenuID'));110    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")111    await driver.elementByAccessibilityId('ButtonMenuID').click();112    // console.log("ÐÐµÐ½Ñ Ð¾ÑкÑÑÑо")113    expect(await driver.waitForElementById('BtnExitMenuID'));114    // console.log("ÐÑÑ
од еÑÑÑ!")115    await driver.elementByAccessibilityId('BtnExitMenuID').click();116    // console.log("ÐÑÑ
од нажаÑо")117    expect(await driver.waitForElementById('BtnRegistrationPopupID'));118    // console.log("Ðнопка 'ÐÐ' еÑÑÑ!")119    await driver.elementByAccessibilityId('BtnRegistrationPopupID').click();120    // console.log("ÐÑйдено")121  });122  it('check Invalid data', async () => {                                                             // ÐÑовеÑка оÑибки окна ÐвÑоÑизаÑии123    expect(await driver.waitForElementById('ButtonMenuID'));124    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")125    await driver.elementByAccessibilityId('ButtonMenuID').click();126    // console.log("ÐÐµÐ½Ñ Ð¾ÑкÑÑÑо")127    expect(await driver.waitForElementById('BtnEnMenuID'));         // ÐеÑеклÑÑение на английÑкий128    // console.log("ÐеÑеклÑÑение на английÑкий ÑзÑк еÑÑÑ")129    await driver.elementByAccessibilityId('BtnEnMenuID').click();130    // console.log("ÐÑиложение на английÑком")131    expect(await driver.waitForElementById('LogInMenuID'));132    // console.log("ÐойÑи еÑÑÑ!")133    await driver.elementByAccessibilityId('LogInMenuID').click();134    // console.log("ÐойÑи оÑкÑÑÑо")135    expect(await driver.waitForElementById('LoginAuthorizationID'));136    // console.log("Ðоле логин еÑÑÑ!")137    expect(await driver.waitForElementById('PasswordInputAuthorizationID'));138    // console.log("Ðоле паÑÐ¾Ð»Ñ ÐµÑÑÑ!")139    await driver.elementByAccessibilityId('LoginAuthorizationID').type("testviktoriya@gmail.com");140    // console.log("Ðогин введÑн")141    await driver.elementByAccessibilityId('PasswordInputAuthorizationID').type("123qwerty");142    // console.log("ÐаÑÐ¾Ð»Ñ Ð²Ð²ÐµÐ´Ñн")143    expect(await driver.waitForElementById('BtnShowPassAuthorizationID'));144    // console.log("СкÑÑÑÑ Ð¿Ð°ÑÐ¾Ð»Ñ ÐÑÑÑ")145    await driver.elementByAccessibilityId('BtnShowPassAuthorizationID').click();146    // console.log("ÐаÑÐ¾Ð»Ñ ÑкÑÑÑ!")147    await driver.elementByAccessibilityId('BtnShowPassAuthorizationID').click();148    // console.log("ÐаÑÐ¾Ð»Ñ Ð¿Ð¾ÐºÐ°Ð·Ð°Ð½")149    expect(await driver.waitForElementById('BtnLoginAuthorizationID'));150    // console.log('Ðнопка "ÐойÑи" еÑÑÑ')151    await driver.elementByAccessibilityId('BtnLoginAuthorizationID').click();152    expect(await driver.waitForElementById('AuthorizationBtnId'));153    // console.log('ÐÑибка валидаÑÐ¸Ñ Ð¿Ð¾ÐºÐ°Ð·Ð°Ð½Ð°')154    // ÐÑовеÑка popup155    let element = await driver.elementByAccessibilityId("AuthorizationTextId");156    let text = await element.text();157    // console.log(text);158    expect(text).toEqual('Incorrect email address or password.');159    // console.log("ТекÑÑ ÑооÑвеÑÑÑвÑеÑ")160    await driver.elementByAccessibilityId('AuthorizationBtnId').click();161    // console.log("ÐÑибка ÑкÑÑÑа")162  });163  it('check Validation Autorization', async () => {                                  //  ÐÑовеÑка валидаÑии авÑоÑизаÑии164    expect(await driver.waitForElementById('ButtonMenuID'));165    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")166    await driver.elementByAccessibilityId('ButtonMenuID').click();167    // console.log("ÐÐµÐ½Ñ Ð¾ÑкÑÑÑо")168    expect(await driver.waitForElementById('BtnEnMenuID'));         // ÐеÑеклÑÑение на английÑкий169    // console.log("ÐеÑеклÑÑение на английÑкий ÑзÑк еÑÑÑ")170    await driver.elementByAccessibilityId('BtnEnMenuID').click();171    // console.log("ÐÑиложение на английÑком")172    expect(await driver.waitForElementById('LogInMenuID'));173    // console.log("ÐойÑи еÑÑÑ!")174    await driver.elementByAccessibilityId('LogInMenuID').click();175    // console.log("ÐойÑи оÑкÑÑÑо")176    expect(await driver.waitForElementById('LoginAuthorizationID'));177    // console.log("Ðоле логин еÑÑÑ!")178    expect(await driver.waitForElementById('PasswordInputAuthorizationID'));179    // console.log("Ðоле паÑÐ¾Ð»Ñ ÐµÑÑÑ!")180    await driver.elementByAccessibilityId('LoginAuthorizationID').type("123");181    // console.log("Ðогин введÑн")182    await driver.elementByAccessibilityId('PasswordInputAuthorizationID').type("123");183    // console.log("ÐаÑÐ¾Ð»Ñ Ð²Ð²ÐµÐ´Ñн")184    expect(await driver.waitForElementById('LoginErrorAuthorizationID'));185    // console.log("ÐÑибка логина еÑÑÑ")186    await driver.elementByAccessibilityId('BtnShowPassAuthorizationID').click();187    expect(await driver.waitForElementById('PasswordInputAuthorizationID'));188    // console.log("ÐÑибка паÑÐ¾Ð»Ñ ÐµÑÑÑ")189    await driver.elementByAccessibilityId('LoginAuthorizationID').click();190    let LogInError = await driver.elementByAccessibilityId("LoginErrorAuthorizationID");    // ÐÑовеÑка popup191    let textLogIn = await LogInError.text();192    // console.log(textLogIn);193    expect(textLogIn).toEqual('Email-entry error');194    // console.log("ТекÑÑ ÑооÑвеÑÑÑвÑеÑ")    195    let PasswordError = await driver.elementByAccessibilityId("PasswordErrorAuthorizationID");  //ÐÑовека popup196    let textPassword = await PasswordError.text();197    // console.log(textPassword);198    expect(textPassword).toEqual('Password failed');199    // console.log("ТекÑÑ ÑооÑвеÑÑÑвÑеÑ")200    // console.log("ÐалидаÑÐ¸Ñ ÑабоÑаеÑ")201  });202  it('check Registration', async () => {                                           // РегиÑÑÑаÑÐ¸Ñ Ñ ÑÑÑеÑÑвÑÑÑей поÑÑой         203    await driver.sleep(5000)204    expect(await driver.waitForElementById('ButtonMenuID'));205    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")206    await driver.elementByAccessibilityId('ButtonMenuID').click();207    // console.log("ÐÐµÐ½Ñ Ð¾ÑкÑÑÑо")208    expect(await driver.waitForElementById('LogInMenuID'));209    // console.log("ÐойÑи еÑÑÑ!")210    expect(await driver.waitForElementById('BtnEnMenuID'));         // ÐеÑеклÑÑение на английÑкий211    // console.log("ÐеÑеклÑÑение на английÑкий ÑзÑк еÑÑÑ")212    await driver.elementByAccessibilityId('BtnEnMenuID').click();213    // console.log("ÐÑиложение на английÑком")214    await driver.elementByAccessibilityId('LogInMenuID').click();215    // console.log("ÐойÑи оÑкÑÑÑо")216    expect(await driver.waitForElementById('BtnRegistrationAuthorizationID'));217    // console.log("ÐаÑегеÑÑÑиÑоваÑÑÑÑ ÐµÑÑÑ!")218    await driver.elementByAccessibilityId('BtnRegistrationAuthorizationID').click();219    // console.log("ÐолÑзоваÑÐµÐ»Ñ Ð² Ð¼ÐµÐ½Ñ ÑегиÑÑÑаÑии")220    expect(await driver.waitForElementById('InputFirstNameRegistrationID'));   //ÐмÑ221    // console.log("СÑÑока ÐÐ¼Ñ ÐµÑÑÑ")222    expect(await driver.waitForElementById('InputLastNameRegistrationID'));   // ФамилиÑ223    // console.log("СÑÑока Ð¤Ð°Ð¼Ð¸Ð»Ð¸Ñ ÐµÑÑÑ")224    expect(await driver.waitForElementById('InputEmailRegistrationID'));     // ÐоÑÑа225    // console.log("СÑÑока E-mail еÑÑÑ")226    expect(await driver.waitForElementById('BtnCountryListRegistrationID'));  // СÑÑана227    // console.log("СÑÑÐ°Ð½Ñ  еÑÑÑ")228    expect(await driver.waitForElementById('InputPhoneRegistrationID'));    // ТелеÑон229    // console.log("Ðвод ÑелеÑона еÑÑÑ")230    await driver.elementByAccessibilityId('BtnCountryListRegistrationID').click();231    // console.log("Ð Ð¼ÐµÐ½Ñ Ð²ÑбоÑа ÑÑÑанÑ")232    await driver.sleep(3000) //коÑÑÑлÑ233    await driver.elementByAccessibilityId('SearchInputCountryID').click();234    await driver.elementByAccessibilityId('SearchInputCountryID').type("russ");235    expect(await driver.waitForElementById('RUID'));236    await driver.elementByAccessibilityId('RUID').click();237    // console.log("РоÑÑÐ¸Ñ ÐµÑÑÑ")238    await driver.sleep(3000) //коÑÑÑлÑ239    // console.log(" ÐÑÐ±Ð¾Ñ ÑÑÑÐ°Ð½Ñ = РоÑÑиÑ")240    await driver.elementByAccessibilityId('InputFirstNameRegistrationID').type("Barak");241    await driver.elementByAccessibilityId('InputLastNameRegistrationID').type("O'Bama");242    await driver.elementByAccessibilityId('InputEmailRegistrationID').type("test-rn-qfx@gmail.com");243    driver.hideKeyboard();244    await driver.elementByAccessibilityId('InputPhoneRegistrationID').type("14881488");245    driver.hideKeyboard();246    // console.log("ÐаÑегеÑÑÑиÑовано еÑÑÑ")247    expect(await driver.waitForElementById('BtnCheckBoxRegistrationID'));248    await driver.elementByAccessibilityId('BtnCheckBoxRegistrationID').click();249    expect(await driver.waitForElementById('BtnRegistrationInRegistrationID'));250    // console.log("Ðнопка ÐаÑегеÑÑÑиÑоваÑÑÑÑ ÐµÑÑÑ")251    await driver.elementByAccessibilityId('BtnRegistrationInRegistrationID').click();252    let RegPopup = await driver.elementByAccessibilityId("RegistrationTextId");     // РегиÑÑÑаÑÐ¸Ñ Ñ Ð¾Ð´Ð½Ð¾Ð¹ и Ñой же поÑÑой бÑÐ´ÐµÑ Ð²ÑдаваÑÑ Ð¾ÑибкÑ253    let textPopup = await RegPopup.text();254    // console.log(textPopup);255    expect(textPopup).toEqual('Unfortunately, the account with this email already exists.');256    // console.log("ТекÑÑ ÑооÑвеÑÑÑÑеÑ")257    expect(await driver.waitForElementById('RegistrationBtnId'));258    // console.log("Popup о Ñом ÑÑо ÑÐ°ÐºÐ°Ñ Ð¿Ð¾ÑÑа Ñже еÑÑÑ Ð¿Ð¾ÑвилÑÑ")259    await driver.elementByAccessibilityId('RegistrationBtnId').click()260  });261  it('check Registration ÐÑÑÑÑе полÑ', async () => {                                                 // ÐалидаÑÐ¸Ñ ÑегиÑÑÑаÑии262    expect(await driver.waitForElementById('ButtonMenuID'));263    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")264    await driver.elementByAccessibilityId('ButtonMenuID').click();265    // console.log("ÐÐµÐ½Ñ Ð¾ÑкÑÑÑо")266    expect(await driver.waitForElementById('BtnEnMenuID'));267    // console.log("ÐеÑеклÑÑение на английÑкий ÑзÑк еÑÑÑ")268    await driver.elementByAccessibilityId('BtnEnMenuID').click();269    // console.log("ÐÑиложение на английÑком")270    expect(await driver.waitForElementById('LogInMenuID'));271    // console.log("ÐойÑи еÑÑÑ!")272    await driver.elementByAccessibilityId('LogInMenuID').click();273    // console.log("ÐойÑи оÑкÑÑÑо")274    expect(await driver.waitForElementById('BtnRegistrationAuthorizationID'));275    // console.log("ÐаÑегеÑÑÑиÑоваÑÑÑÑ ÐµÑÑÑ!")276    await driver.elementByAccessibilityId('BtnRegistrationAuthorizationID').click();277    // console.log("ÐолÑзоваÑÐµÐ»Ñ Ð² Ð¼ÐµÐ½Ñ ÑегиÑÑÑаÑии")278    expect(await driver.waitForElementById('InputFirstNameRegistrationID'));   //ÐмÑ279    // console.log("СÑÑока ÐÐ¼Ñ ÐµÑÑÑ")280    expect(await driver.waitForElementById('InputLastNameRegistrationID'));   // ФамилиÑ281    // console.log("СÑÑока Ð¤Ð°Ð¼Ð¸Ð»Ð¸Ñ ÐµÑÑÑ")282    expect(await driver.waitForElementById('InputEmailRegistrationID'));     // ÐоÑÑа283    // console.log("СÑÑока E-mail еÑÑÑ")284    expect(await driver.waitForElementById('BtnCountryListRegistrationID'));  // СÑÑана285    // console.log("СÑÑÐ°Ð½Ñ  еÑÑÑ")286    expect(await driver.waitForElementById('InputPhoneRegistrationID'));    // ТелеÑон287    await driver.elementByAccessibilityId('InputFirstNameRegistrationID').type("$");288    await driver.elementByAccessibilityId('InputLastNameRegistrationID').type("$");289    await driver.elementByAccessibilityId('InputEmailRegistrationID').type("barak_obama$prisident.cherniy");290    driver.hideKeyboard();291    await driver.elementByAccessibilityId('InputPhoneRegistrationID').type(";");292    driver.hideKeyboard();293    await driver.elementByAccessibilityId('BtnRegistrationInRegistrationID').click();294    expect(await driver.waitForElementById('FirstNameErrorRegostrationID'))295    expect(await driver.waitForElementById('LastNameErrorRegostrationID'))296    expect(await driver.waitForElementById('EmailErrorRegostrationID'))297    expect(await driver.waitForElementById('PasswordErrorRegistrationID'))298    // console.log("ÐÑе оÑибки поÑвилиÑÑ")299    let FirstNameError = await driver.elementByAccessibilityId("FirstNameErrorRegostrationID"); // ÐÑовеÑка оÑибки в Ðоле "ÐмÑ"300    let textFirstName = await FirstNameError.text();301    // console.log(textFirstName);302    expect(textFirstName).toEqual('Name-entry error');303    // console.log("ÐалидаÑÐ¸Ñ Ð¿Ð¾Ð»Ñ 'ÐмÑ' еÑÑÑ")304    let LastNameError = await driver.elementByAccessibilityId("LastNameErrorRegostrationID"); // ÐÑовеÑка оÑибки в Ðоле "ФамилиÑ"305    let textLastName = await LastNameError.text();306    // console.log(textLastName);307    expect(textLastName).toEqual('Last name-entry error');308    // console.log("ÐалидаÑÐ¸Ñ Ð¿Ð¾Ð»Ñ 'ФамилиÑ' еÑÑÑ")309    let emailError = await driver.elementByAccessibilityId("EmailErrorRegostrationID"); // ÐÑовеÑка оÑибки в Ðоле "ÐоÑÑа"310    let textEmail = await emailError.text();311    // console.log(textEmail);312    expect(textEmail).toEqual('Email-entry error');313    // console.log("ÐалидаÑÐ¸Ñ Ð¿Ð¾Ð»Ñ 'Email' еÑÑÑ")314    let TelError = await driver.elementByAccessibilityId("PasswordErrorRegistrationID");           // ÐÑовеÑка оÑибки в Ðоле "ÐаÑолÑ"315    let textTel = await TelError.text();316    // console.log(textTel);317    expect(textTel).toEqual('Invalid phone number');318    // console.log("ÐалидаÑÐ¸Ñ Ð¿Ð¾Ð»Ñ 'ТелеÑона' еÑÑÑ")319  });320  it('check Password recovery', async () => {                                                   // ÐоÑÑÑановлеине паÑолÑ321    expect(await driver.waitForElementById('ButtonMenuID'));322    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")323    await driver.elementByAccessibilityId('ButtonMenuID').click();324    // console.log("ÐÐµÐ½Ñ Ð¾ÑкÑÑÑо")325    expect(await driver.waitForElementById('BtnEnMenuID'));   // ÐеÑеклÑÑение на английÑкий326    // console.log("ÐеÑеклÑÑение на английÑкий ÑзÑк еÑÑÑ")327    await driver.elementByAccessibilityId('BtnEnMenuID').click();328    // console.log("ÐÑиложение на английÑком")329    expect(await driver.waitForElementById('LogInMenuID'));330    // console.log("ÐойÑи еÑÑÑ!")331    await driver.elementByAccessibilityId('LogInMenuID').click();332    // console.log("ÐойÑи оÑкÑÑÑо")333    expect(await driver.waitForElementById('ForgotPasswordAuthorizationID'));334    // console.log("ÐабÑли паÑÐ¾Ð»Ñ ÐµÑÑÑ!")335    await driver.elementByAccessibilityId('ForgotPasswordAuthorizationID').click();336    // console.log("Ðкно воÑÑÑÐ½Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ Ð¾ÑкÑÑÑо")337    expect(await driver.waitForElementById('ForgotPasswordInputID'));338    // console.log("СÑÑока ввода поÑÑÑ ÐµÑÑÑ!")339    await driver.elementByAccessibilityId('ForgotPasswordInputID').type("testviktoriya@gmail.com");340    driver.hideKeyboard();341    await driver.elementByAccessibilityId('ForgotPasswordSubmitID').click();342    await driver.elementByAccessibilityId('ForgotPasswordSubmitID').click();343    expect(await driver.waitForElementById('BtnForgotPasswordPopUpID'));344    // console.log("Popup поÑвилÑÑ")345    let RecPopup = await driver.elementByAccessibilityId("TextRecoveryPopupID");     // ÐÑовеÑка popup 346    let textPopup = await RecPopup.text();  347    // console.log(textPopup);348    expect(textPopup).toEqual("Instructions\n\r for password recovery have been sent to the user's email");349    // console.log("ТекÑÑ ÑооÑвеÑÑÑÑеÑ")350    await driver.elementByAccessibilityId('BtnForgotPasswordPopUpID').click()351    expect(await driver.waitForElementById('LoginAuthorizationID'));  // ÐеÑекидÑвание на поле авÑоÑизаÑии352    // console.log("Ðоле логин еÑÑÑ!")353    expect(await driver.waitForElementById('PasswordInputAuthorizationID'));354    // console.log("Ðоле паÑÐ¾Ð»Ñ ÐµÑÑÑ!")355    // console.log("ÐоÑÑÑановление паÑÐ¾Ð»Ñ ÑÑабоÑало ÑÑпеÑно")356  });357  it('check Password recovery non valid', async () => {                                                   // Ðевалидное воÑÑÑановлеин паÑолÑ358    expect(await driver.waitForElementById('ButtonMenuID'));359    // console.log("ÐÐµÐ½Ñ ÐµÑÑÑ!")360    await driver.elementByAccessibilityId('ButtonMenuID').click();361    // console.log("ÐÐµÐ½Ñ Ð¾ÑкÑÑÑо")362    expect(await driver.waitForElementById('BtnEnMenuID'));363    // console.log("ÐеÑеклÑÑение на английÑкий ÑзÑк еÑÑÑ")364    await driver.elementByAccessibilityId('BtnEnMenuID').click();365    // console.log("ÐÑиложение на английÑком")366    expect(await driver.waitForElementById('LogInMenuID'));367    // console.log("ÐойÑи еÑÑÑ!")368    await driver.elementByAccessibilityId('LogInMenuID').click();369    // console.log("ÐойÑи оÑкÑÑÑо")370    expect(await driver.waitForElementById('ForgotPasswordAuthorizationID'));371    // console.log("ÐабÑли паÑÐ¾Ð»Ñ ÐµÑÑÑ!")372    await driver.elementByAccessibilityId('ForgotPasswordAuthorizationID').click();373    // console.log("Ðкно воÑÑÑÐ½Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ Ð¾ÑкÑÑÑо")374    expect(await driver.waitForElementById('ForgotPasswordInputID'));375    // console.log("СÑÑока ввода поÑÑÑ ÐµÑÑÑ!")376    await driver.elementByAccessibilityId('ForgotPasswordInputID').type("nevalidnii@gmail.com");377    driver.hideKeyboard();378    await driver.elementByAccessibilityId('ForgotPasswordSubmitID').click();379    await driver.elementByAccessibilityId('ForgotPasswordSubmitID').click();380    expect(await driver.waitForElementById('ForgotPasswordBtnId'));381    // console.log("Popup поÑвилÑÑ")382    let element = await driver.elementByAccessibilityId("ForgotPasswordTextId"); // ÐÑовеÑка popup383    let textError = await element.text();384    // console.log(textError);385    expect(textError).toEqual('Incorrect email address.');386    // console.log("ÐÑибка ÑооÑвеÑÑÑвÑеÑ")387    await driver.elementByAccessibilityId('ForgotPasswordBtnId').click();388  });389  it('check Minimize all open charts', async () => {                                                   // СвеÑнÑÑÑ Ð²Ñе окна390    expect(await driver.waitForElementById('AUD/CADID'));391    expect(await driver.waitForElementById('AUD/CHFID'));392    expect(await driver.waitForElementById('AUD/JPYID'));393    expect(await driver.waitForElementById('AUD/NZDID'));394    expect(await driver.waitForElementById('AUD/USDID'));395    await driver.elementByAccessibilityId('AUD/CADID').click();396    await driver.elementByAccessibilityId('AUD/CHFID').click();397    await driver.elementByAccessibilityId('AUD/JPYID').click();398    // console.log("ÐÑкÑÑÑÑ ÑÑейки")399    await driver.elementByAccessibilityId('ButtonMenuID').click();400    // console.log("РменÑ")401    await driver.elementByAccessibilityId('BtnTurnAll').click();402    // console.log("СкÑÑÑÑ ÑÑейки")403    driver.back();404    expect(await driver.waitForElementById('AUD/CADID'));405    expect(await driver.waitForElementById('AUD/CHFID'));406    expect(await driver.waitForElementById('AUD/JPYID'));407    expect(await driver.waitForElementById('AUD/NZDID'));408    expect(await driver.waitForElementById('AUD/USDID'));409  });...sanity.e2e.js
Source:sanity.e2e.js  
...73    const dismissWarnings = async () => {74        let isErrorDismissVisible = await driver.hasElementByAccessibilityId(ID_ERROR_DISMISS);75        let isDismissAllVisible = await driver.hasElementByAccessibilityId(ID_DISMISS_ALL);76        if (isErrorDismissVisible) {77            await driver.elementByAccessibilityId(ID_ERROR_DISMISS).click();78        }79        if (isDismissAllVisible) {80            await driver.elementByAccessibilityId(ID_DISMISS_ALL).click();81        }82    };83    describe('Tab Bar', () => {84        beforeAll(async () => {85            dismissWarnings();86        });87        it('should show all the tabs', async () => {88            // expect(await driver.hasElementById('Home Tab')).toBe(true);89            if (IS_TV) {90                expect(await driver.hasElementByAccessibilityId(ID_ON_DEMAND)).toBe(true);91                expect(await driver.hasElementByAccessibilityId(ID_LIVE_TV)).toBe(true);92            } else {93                expect(await driver.hasElementByAccessibilityId(ID_HOME_TAB)).toBe(true);94            }95            expect(await driver.hasElementByAccessibilityId(ID_SEARCH_TAB)).toBe(true);96            expect(await driver.hasElementByAccessibilityId(ID_SETTINGS_TAB)).toBe(true);97        });98    });99    describe('Search Screen', () => {100        let searchBar;101        beforeAll(async () => {102            // Select Search Tab103            // Skipping tvos temporarily as we have a defects in search. search bar is not clickable and navigating to search makes home tab blank104            //TODO: Enable search testcases for tvos105            if (!TVOS_SIMULATOR) {106                await driver.elementByAccessibilityId(ID_SEARCH_TAB).click();107                searchBar = await driver.elementByAccessibilityId(ID_SEARCH_BAR);108            }109        });110        skipIt(TVOS_SIMULATOR)('should show results for search query', async () => {111            dismissWarnings();112            // type-in search query113            await searchBar.type('Max').hideDeviceKeyboard();114            expect(await driver.hasElementByAccessibilityId(ID_SEARCH_RESULTS)).toBe(true);115        });116        skipIt(TVOS_SIMULATOR)('should show error results for an invalid search query', async () => {117            dismissWarnings();118            // type-in junk search query119            await searchBar120                .clear()121                .type('sdfwe345435sdsdf324')122                .hideDeviceKeyboard();123            expect(await driver.hasElementByAccessibilityId(ID_SEARCH_ERROR)).toBe(true);124        });125    });126    describe('Home Screen', () => {127        const selectCard = async (cardViews, cardIndexToSelect) => {128            const totalCards = cardViews.length;129            if (cardIndexToSelect === undefined) {130                if (TARGET_PLATFORM === 'android') {131                    const randomIndex = Math.floor(Math.random() * totalCards);132                    return cardViews[randomIndex];133                }134                // iOS seems to return even non-visible cards, but clicking them does not work.135                // So, we pick the first visible element.136                let selectedCard;137                for (let index = 0; index < totalCards; index++) {138                    const v = cardViews[index];139                    const isVisible = await v.getAttribute('visible');140                    const isCardView = await v.getAttribute('name');141                    if (isVisible === 'true' && isCardView === 'Card View') {142                        selectedCard = v;143                        break;144                    }145                }146                return selectedCard;147            } else {148                return cardViews[cardIndexToSelect];149            }150        };151        beforeAll(async () => {152            // Select Home Tab153            dismissWarnings();154            IS_TV155                ? await driver.elementByAccessibilityId(ID_ON_DEMAND).click()156                : await driver.elementByAccessibilityId(ID_HOME_TAB).click();157        });158        it('should show catalog tabs', async () => {159            expect(await driver.hasElementByAccessibilityId(ID_ON_DEMAND)).toBe(true);160            expect(await driver.hasElementByAccessibilityId(ID_LIVE_TV)).toBe(true);161        });162        it('should navigate to details when clicking a card', async () => {163            const cardViews = await driver.elementsByAccessibilityId(ID_CARD_VIEW);164            let selectedCard = await selectCard(cardViews, 0);165            await selectedCard.click();166            expect(await driver.hasElementByAccessibilityId(ID_DETAILS_SCREEN)).toBe(true);167            expect(await driver.hasElementByAccessibilityId(ID_FAVORITE)).toBe(true);168        });169        skipIt(IOS_SIMULATOR)('should navigate to player screen', async () => {170            if (await driver.hasElementByAccessibilityId(ID_WATCH_NOW)) {171                await driver.elementByAccessibilityId(ID_WATCH_NOW).click();172            } else {173                const cardViews = await driver.elementsByAccessibilityId(ID_CARD_VIEW);174                let selectedCard = await selectCard(cardViews, 0);175                await selectedCard.click();176            }177            expect(await driver.hasElementByAccessibilityId(ID_PLAYER_SCREEN)).toBe(true);178        });179        skipIt(IOS_SIMULATOR || TVOS_SIMULATOR)('should begin video playback', async () => {180            await driver.waitFor(181                elementWithAccessibilityId(ID_TIME_ELAPSED, false),182                PLAYBACK_START_WAIT_TIME,183                POLL_FREQUENCY,184            );185            await driver.elementByAccessibilityId(ID_PLAYER).click();186            await driver.waitFor(elementWithAccessibilityId(ID_PLAY, true));187            expect(await driver.hasElementByAccessibilityId(ID_PLAY)).toBe(true);188            expect(await driver.hasElementByAccessibilityId(ID_REWIND)).toBe(true);189            expect(await driver.hasElementByAccessibilityId(ID_FORWARD)).toBe(true);190        });191        skipIt(IOS_SIMULATOR || TVOS_SIMULATOR)('should fast-forward when clicked on ffd button', async () => {192            const controlsAreVisible = await driver.hasElementByAccessibilityId(ID_TIME_ELAPSED);193            if (!controlsAreVisible) {194                await driver.elementByAccessibilityId(ID_PLAYER).click();195                await driver.waitFor(196                    elementWithAccessibilityId(ID_TIME_ELAPSED, false),197                    DEVICE_TIMEOUT,198                    POLL_FREQUENCY,199                );200            }201            const initialTimeElapsed = await driver.elementByAccessibilityId(ID_TIME_ELAPSED).text();202            await driver.elementByAccessibilityId(ID_FORWARD).click();203            // Wait for video to load after seeking204            await driver.waitFor(205                elementWithAccessibilityId(ID_FORWARD, true),206                PLAYBACK_START_WAIT_TIME,207                POLL_FREQUENCY,208            );209            const seekedTimeElapsed = await driver.elementByAccessibilityId(ID_TIME_ELAPSED).text();210            expect(seekedTimeElapsed).not.toBe(initialTimeElapsed);211        });212        skipIt(IOS_SIMULATOR || TVOS_SIMULATOR)(213            'should resume playback after moving to background and back',214            async () => {215                const controlsAreVisible = await driver.hasElementByAccessibilityId(ID_TIME_ELAPSED);216                if (!controlsAreVisible) {217                    await driver.elementByAccessibilityId(ID_PLAYER).click();218                    await driver.waitFor(219                        elementWithAccessibilityId(ID_TIME_ELAPSED, false),220                        DEVICE_TIMEOUT,221                        POLL_FREQUENCY,222                    );223                }224                const initialTimeElapsed = await driver.elementByAccessibilityId(ID_TIME_ELAPSED).text();225                await driver.elementByAccessibilityId(ID_PLAY).click();226                await driver.backgroundApp(1);227                // We need an explicit sleep wait here to determine if playback has progressed/resumed automatically.228                await driver.sleep(1000);229                const controlsAreVisible1 = await driver.hasElementByAccessibilityId(ID_TIME_ELAPSED);230                if (!controlsAreVisible1) {231                    await driver.elementByAccessibilityId(ID_PLAYER).click();232                    await driver.waitFor(233                        elementWithAccessibilityId(ID_TIME_ELAPSED, true),234                        DEVICE_TIMEOUT,235                        POLL_FREQUENCY,236                    );237                }238                const timeElapsed = await driver.elementByAccessibilityId(ID_TIME_ELAPSED).text();239                expect(timeElapsed).not.toBe(initialTimeElapsed);240            },241        );242    });243    describe('Settings Screen', () => {244        beforeAll(async () => {245            // Select Settings Tab246            const isPlatformAndroid = TARGET_PLATFORM === 'android' || TARGET_PLATFORM === 'firetv';247            if (isPlatformAndroid) {248                await driver.backgroundApp(1);249            } else {250                await driver.elementByAccessibilityId(ID_BACK_BUTTON).click();251            }252            await driver.elementByAccessibilityId(ID_SETTINGS_TAB).click();253        });254        skipIt(TVOS_SIMULATOR)('should show app preferences', async () => {255            expect(await driver.hasElementByAccessibilityId('Settings Preferences')).toBe(true);256        });257        skipIt(TVOS_SIMULATOR)('should be able to switch app theme', async () => {258            await driver.elementByAccessibilityId('Switch to Use Default Component Theme').click();259            // App should reload with new theme on the home page260            expect(await driver.hasElementByAccessibilityId(ID_ON_DEMAND)).toBe(true);261        });262    });...gesture-e2e-specs.js
Source:gesture-e2e-specs.js  
...26      await B.delay(500);27    });28    describe('tap, press, longpress', () => {29      beforeEach(async () => {30        let el = await driver.elementByAccessibilityId('Action Sheets');31        await driver.execute('mobile: scroll', {element: el, toVisible: true});32        await el.click();33      });34      describe('tap', () => {35        it('should tap on the element', async () => {36          let el1 = await driver.elementByAccessibilityId('Okay / Cancel');37          let action = new wd.TouchAction(driver);38          action.tap({el: el1});39          await action.perform();40          let el2 = await driver.elementByAccessibilityId('OK');41          await el2.click();42        });43        it('should tap on arbitrary coordinates', async () => {44          let el1 = await driver.elementByAccessibilityId('Okay / Cancel');45          let loc = await el1.getLocation();46          let action = new wd.TouchAction(driver);47          action.tap(loc);48          await action.perform();49          let el2 = await driver.elementByAccessibilityId('OK');50          await el2.click();51        });52      });53      it('should long press on an element', async () => {54        let el1 = await driver.elementByAccessibilityId('Okay / Cancel');55        let action = new wd.TouchAction(driver);56        action.longPress({el: el1});57        await action.perform();58        let el2 = await driver.elementByAccessibilityId('Cancel');59        await el2.click();60      });61      it('should long press on an element with duration through press-wait-release', async () => {62        let el1 = await driver.elementByAccessibilityId('Okay / Cancel');63        let action = new wd.TouchAction(driver);64        action.press({el: el1}).wait(1200).release();65        await action.perform();66        let el2 = await driver.elementByAccessibilityId('Cancel');67        await el2.click();68      });69      it('should long press on arbitrary coordinate', async () => {70        let el1 = await driver.elementByAccessibilityId('Okay / Cancel');71        let loc = await el1.getLocation();72        let action = new wd.TouchAction(driver);73        action.press(loc).wait(500).release();74        await action.perform();75        let el2 = await driver.elementByAccessibilityId('OK');76        await el2.click();77      });78    });79    it('should scroll using touch actions', async function () {80      // TODO: investigate why this fails in Travis81      //   it seems to go into the "Page Control" view before trying to scroll?82      if (process.env.TRAVIS) this.skip();83      let el1 = await driver.elementByAccessibilityId('Action Sheets');84      let el2 = await driver.elementByAccessibilityId('Text Fields');85      let action = new wd.TouchAction(driver);86      action.press({el: el1}).moveTo({el: el2}).release();87      await action.perform();88      let el3 = await driver.elementByAccessibilityId('Text Fields');89      await el3.click().should.not.be.rejected;90    });91    it('should double tap on an element', async () => {92      let el = await driver.elementByAccessibilityId('Steppers');93      await driver.execute('mobile: scroll', {element: el, toVisible: true});94      await el.click();95      let stepper = await driver.elementByAccessibilityId('Increment');96      let action = new wd.TouchAction(driver);97      action.tap({el: stepper, count: 2});98      await action.perform();99      await driver.elementByAccessibilityId('2').should.not.be.rejected;100    });101    describe('pinch and zoom', () => {102      beforeEach(async () => {103        let el = await driver.elementByAccessibilityId('Web View');104        await driver.execute('mobile: scroll', {element: el, toVisible: true});105        await el.click();106      });107      // at this point this test relies on watching it happen, nothing is asserted108      // in automation, this just checks that errors aren't thrown109      it('should be able to pinch', async () => {110        let ctxs;111        await retryInterval(4, 500, async () => {112          // on some systems (like Travis) it takes a while to load the webview113          ctxs = await driver.contexts();114          if (ctxs.length === 1) {115            throw new Error('No webview context found');116          }117        });118        await driver.context(ctxs[1]);119        await driver.get('https://avatars1.githubusercontent.com/u/3221291?v=3&s=400');120        await driver.context(ctxs[0]);121        async function doZoom () {122          let el = await driver.elementByClassName('XCUIElementTypeApplication');123          let thumb = new wd.TouchAction(driver);124          thumb.press({el, x: 100, y: 0}).moveTo({el, x: 50, y: 0}).release();125          let foreFinger = new wd.TouchAction(driver);126          foreFinger.press({el, x: 100, y: 0}).moveTo({el, x: 105, y: 0}).release();127          let zoom = new wd.MultiAction(driver);128          zoom.add(thumb, foreFinger);129          await zoom.perform();130        }131        await doZoom();132        async function doPinch () {133          let el = await driver.elementByClassName('XCUIElementTypeApplication');134          let thumb = new wd.TouchAction(driver);135          thumb.press({el, x: 50, y: 0}).moveTo({el, x: 100, y: 0}).release();136          let foreFinger = new wd.TouchAction(driver);137          foreFinger.press({el, x: 100, y: 0}).moveTo({el, x: 50, y: 0}).release();138          let pinch = new wd.MultiAction(driver);139          pinch.add(thumb, foreFinger);140          await pinch.perform();141        }142        await doPinch();143      });144    });145  });146  describe('tap with tapWithShortPressDuration cap', () => {147    // needs a special cap, so has to be in its own session148    before(async () => {149      driver = await initSession(_.defaults({150        tapWithShortPressDuration: 0.01151      }, UICATALOG_CAPS));152    });153    after(async () => {154      await deleteSession();155    });156    it('should tap on the element', async () => {157      let el1 = await driver.elementByAccessibilityId('Action Sheets');158      let action = new wd.TouchAction(driver);159      action.tap({el: el1});160      action.perform();161      // pause a moment so the alert can animate162      await B.delay(500);163      let el2 = await driver.elementByAccessibilityId('Okay / Cancel');164      el2.should.exist;165    });166  });...tests.js
Source:tests.js  
1var wd = require("wd"),2_ = require('underscore'),3Q = require('q');4//serverConfigs = require('./helpers/appium-servers');5describe("Nayuta Test", function () {6this.timeout(100000000);7var driver;8var allPassed = true;9before(function () {10var serverConfig =  {11    host: 'localhost',12    port: 472313  };14  15driver = wd.promiseChainRemote(serverConfig);16//require("./helpers/logging").configure(driver);17var desired = {18  "name":"nayuta test",19  "platformName": "ios",20  platformVersion: '12.0',//13.021deviceName: 'iPhone X',22//	"platformVersion": "13.0",23//	"deviceName": "iPhone 11 Pro Max",24  //"app": "/Users/chris/Documents/Appcelerator_Studio_Workspace/nayuta/build/iphone/build/Products/Debug-iphonesimulator/Nayuta.app",25  "app":process.cwd()+"/build/iphone/build/Products/Debug-iphonesimulator/Nayuta.app",26  "automationName": "XCUITest",27  "useNewWDA":false,28  "noReset": true,29  "showXcodeLog":false, 30};31 32return driver.init(desired);33});34after(function () {35return driver36  .quit()37  .finally(function () {38    if (process.env.npm_package_config_sauce) {39      return driver.sauceJobStatus(allPassed);40    }41  });42});43afterEach(function () {44allPassed = allPassed && this.currentTest.state === 'passed';45});46function populate() {47var seq = _(['IntegerA', 'IntegerB']).map(function (id) {48  return function (sum) {49    return driver.waitForElementById(id, 3000).then(function (el) {50      var x = _.random(0,10);51      sum += x;52      return el.type('' + x).then(function () { return sum; })53        .elementById('Done').click().sleep(1000); // dismissing keyboard54    }).then(function () { return sum; });55  };56});57return seq.reduce(Q.when, new Q(0));58}59it("Should Sleep", function () {60return driver.sleep(5000)61});62it("Should Press Create New Wallet", function () {63  64   65return driver.66elementByAccessibilityId('Create New Wallet')67  .click().sleep(2000)68});69it("Should Accept Disclaimer", function () { 70 71  return driver.dismissAlert().sleep(2000)72 73});74it("Should Press Testnet", function () { 75  return driver.dismissAlert().sleep(2000)76 77});78it("Should Skip Auto Pilot", function () { 79return driver.80elementByAccessibilityId('Skip Auto Pilot')81  .click().sleep(6000)82});83it("Should Press Next 1", function () { 84return driver.85elementByAccessibilityId('Passphrase Next 1')86  .click().sleep(2000)87}); 88it("Should Press Next 2", function () { 89return driver.90elementByAccessibilityId('Passphrase Next 2')91  .click().sleep(2000)92});93it("Should Press Next 3", function () { 94return driver.95elementByAccessibilityId('Passphrase Next 3')96  .click().sleep(2000)97});98it("Should Press Next 4", function () { 99return driver.100elementByAccessibilityId('Passphrase Next 4')101  .click().sleep(3000)102});103it("Should Press Skip Dev", function () { 104return driver.105elementByAccessibilityId('Skip Dev')106  .click().sleep(4000)107});108it("Should Press Key Pad 1", function () { 109return driver.110elementByAccessibilityId('keypad1')111  .click().sleep(1000)112});113it("Should Press Key Pad 2", function () { 114return driver.115elementByAccessibilityId('keypad2')116  .click().sleep(1000)117});118it("Should Press Key Pad 3", function () { 119return driver.120elementByAccessibilityId('keypad3')121  .click().sleep(1000)122});123it("Should Press Key Pad 4", function () { 124return driver.125elementByAccessibilityId('keypad4')126  .click().sleep(1000)127});128it("Should Press Key Pad 5", function () { 129return driver.130elementByAccessibilityId('keypad5')131  .click().sleep(1000)132});133it("Should Press Key Pad 6", function () { 134return driver.135elementByAccessibilityId('keypad6')136  .click().sleep(1000)137});138it("Should Press Key Pad 1", function () { 139return driver.140elementByAccessibilityId('keypad1')141  .click().sleep(1000)142});143it("Should Press Key Pad 2", function () { 144return driver.145elementByAccessibilityId('keypad2')146  .click().sleep(1000)147});148it("Should Press Key Pad 3", function () { 149return driver.150elementByAccessibilityId('keypad3')151  .click().sleep(1000)152});153it("Should Press Key Pad 4", function () { 154return driver.155elementByAccessibilityId('keypad4')156  .click().sleep(1000)157});158it("Should Press Key Pad 5", function () { 159return driver.160elementByAccessibilityId('keypad5')161  .click().sleep(1000)162});163it("Should Press Key Pad 6", function () { 164return driver.165elementByAccessibilityId('keypad6')166  .click().sleep(3000)167});168it("Should Press Link Later", function () { 169return driver.170elementByAccessibilityId('link later')171  .click().sleep(10000)172});...auth.test.js
Source:auth.test.js  
...24      .type('test@gmail.com');25    await driver26      .elementByAccessibilityId('login_input_password')27      .type('Password1');28    await driver.elementByAccessibilityId('btn_login').click();29    const messageExist = await driver.hasElementByAccessibilityId(30      'txt_message',31    );32    if (messageExist) {33      const TEXT = 'Logged in successfully';34      const message = await driver35        .elementByAccessibilityId('txt_message')36        .text();37      expect(message).toBe(TEXT);38    }39    driver.sleep(3000);40  });41  it('unsuccessfull login', async () => {42    await driver43      .elementByAccessibilityId('login_input_email')44      .type('invalidemail');45    await driver46      .elementByAccessibilityId('login_input_password')47      .type('password');48    await driver.elementByAccessibilityId('btn_login').click();49    const messageExist = await driver.hasElementByAccessibilityId(50      'txt_message',51    );52    if (messageExist) {53      const TEXT =54        'email must be a valid email' || 'Invalid email' || 'Invalid password';55      const message = await driver56        .elementByAccessibilityId('txt_message')57        .text();58      expect(message).toBe(TEXT);59    }60    driver.sleep(3000);61  });62});TodaysTasks.spec.js
Source:TodaysTasks.spec.js  
...25});26test('Add tasks', async () => {27  const task1 = 'Task 1';28  const task2 = 'Task 2';29  await driver.elementByAccessibilityId('input').type(task1);30  await driver.elementByAccessibilityId('button').click();31  await driver.sleep(1000);32  await driver.elementByAccessibilityId('input').type(task2);33  await driver.elementByAccessibilityId('button').click();34  await driver.sleep(1000);35  const text1 = await driver.elementByAccessibilityId('text_1').text();36  const text2 = await driver.elementByAccessibilityId('text_2').text();37  expect(text1).toBe(task1);38  expect(text2).toBe(task2);39});40test('Complete task', async () => {41  const task1 = 'Task 1';42  const task2 = 'Task 2';43  await driver.elementByAccessibilityId('input').type(task1);44  await driver.elementByAccessibilityId('button').click();45  await driver.sleep(1000);46  await driver.elementByAccessibilityId('input').type(task2);47  await driver.elementByAccessibilityId('button').click();48  await driver.sleep(1000);49  await driver.elementByAccessibilityId('task_0').click();50  await driver.sleep(1000);51  expect(await driver.hasElementByAccessibilityId('text_1')).toBe(true);52  expect(await driver.hasElementByAccessibilityId('text_2')).toBe(false);...appium.test.js
Source:appium.test.js  
...12  await driver.sleep(2000); // wait for app to load13});14test('example test', async () => {15  expect(await driver.hasElementByAccessibilityId('text')).toBe(true);16  const text = await driver.elementByAccessibilityId('text').text();17  expect(text).toBe('1');18  expect(await driver.hasElementByAccessibilityId('button')).toBe(true);19  await driver.elementByAccessibilityId('button').click();20  await driver.sleep(2000);21  let name = await driver.elementByAccessibilityId('name').text();22  expect(name).toBe('Leanne Graham');23  await driver.elementByAccessibilityId('text').clear();24  await driver.elementByAccessibilityId('text').type('2');25  await driver.elementByAccessibilityId('button').click();26  await driver.sleep(2000);27  name = await driver.elementByAccessibilityId('name').text();28  expect(name).toBe('Ervin Howell');...SignIn.appium.js
Source:SignIn.appium.js  
2const { testIds } = Constants;3export default async (driver) => {4  test("SignIn", async () => {5    await driver.waitForElementByAccessibilityId(testIds.email, 80000);6    const emailElement = await driver.elementByAccessibilityId(testIds.email);7    await emailElement.click();8    await emailElement.sendKeys("test@gmail.com");9    const passwordElement = await driver.elementByAccessibilityId(10      testIds.password11    );12    await passwordElement.click();13    await passwordElement.sendKeys("Test@123");14    const login = await driver.elementByAccessibilityId(testIds.login);15    await login.click();16  });...Using AI Code Generation
1const wd = require('wd');2const assert = require('assert');3const chai = require('chai');4const chaiAsPromised = require('chai-as-promised');5chai.use(chaiAsPromised);6const should = chai.should();7const expect = chai.expect;8const APP_BUNDLE_ID = 'com.example.app';9const APP_PATH = '/Users/username/Desktop/app.ipa';10const PORT = 4723;Using AI Code Generation
1var wd = require('wd');2var assert = require('assert');3var username = process.env.SAUCE_USERNAME;4var accessKey = process.env.SAUCE_ACCESS_KEY;5var driver;6var desired = {7};8driver = wd.promiseChainRemote("ondemand.saucelabs.com", 80, username, accessKey);9driver.init(desired).then(function () {10  return driver.elementByAccessibilityId('Buttons').click();11})12.then(function () {13  return driver.elementByAccessibilityId('Rounded').click();14})15.then(function () {16  return driver.elementByAccessibilityId('Back').clickUsing AI Code Generation
1var webdriver = require('wd');2var assert = require('assert');3var desired = {4};5driver.init(desired).then(function () {6  return driver.elementByAccessibilityId('ComputeSumButton');7}).then(function (el) {8  return el.click();9}).then(function () {10  return driver.elementByAccessibilityId('Answer');11}).then(function (el) {12  return el.text();13}).then(function (text) {14  assert.equal(text, '10');15}).fin(function () {16  return driver.quit();17}).done();18var webdriver = require('wd');19var assert = require('assert');20var desired = {21};22driver.init(desired).then(function () {23}).then(function (el) {24  return el.click();25}).then(function () {26}).then(function (el) {27  return el.text();28}).then(function (text) {29  assert.equal(text, '10');30}).fin(function () {31  return driver.quit();32}).done();33var webdriver = require('wd');34var assert = require('assert');35var desired = {Using AI Code Generation
1var wd = require('wd');2var assert = require('assert');3var desiredCaps = {4};5var driver = wd.promiseChainRemote('localhost', 4723);6  .init(desiredCaps)7  .elementByAccessibilityId('Buttons')8  .click()9  .click()10  .sleep(5000)11  .quit();12var wd = require('wd');13var assert = require('assert');14var desiredCaps = {15};16var driver = wd.promiseChainRemote('localhost', 4723);17  .init(desiredCaps)18  .click()19  .elementByAccessibilityId('Rounded')20  .click()21  .sleep(5000)22  .quit();23var wd = require('wd');24var assert = require('assert');25var desiredCaps = {26};27var driver = wd.promiseChainRemote('localhost', 4723);28  .init(desiredCaps)Using AI Code Generation
1var wd = require('wd');2var assert = require('assert');3var desired = {4};5var driver = wd.promiseChainRemote('localhost', 4723);6    .init(desired)7    .then(function () {8        return driver.waitForElementByAccessibilityId('Login', 5000);9    })10    .then(function (el) {11        return el.click();12    })13    .then(function () {14        return driver.waitForElementByAccessibilityId('Username', 5000);15    })16    .then(function (el) {17        return el.sendKeys('test');18    })19    .then(function () {20        return driver.waitForElementByAccessibilityId('Password', 5000);21    })22    .then(function (el) {23        return el.sendKeys('test');24    })25    .then(function () {26        return driver.waitForElementByAccessibilityId('Login', 5000);27    })28    .then(function (el) {29        return el.click();30    })31    .then(function () {32        return driver.waitForElementByAccessibilityId('Welcome', 5000);33    })34    .then(function (el) {35        return el.text();36    })37    .then(function (text) {38        assert.equal(text, 'Welcome test');39    })40    .fin(function () {41        return driver.quit();42    })43    .done();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!!
