Advertisement
Guest User

testhelper

a guest
May 24th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.50 KB | None | 0 0
  1. public static void OpenMenuAndSelectMenuItem(IApp App, IScreenQueries Queries,Platform platform, int menuitem, int menulistitem, int cardtype)
  2. {
  3.  
  4. if (platform == Platform.Android)
  5. {
  6. App.Tap(Queries.ViewTitleElement);
  7. App.WaitForElement(v => v.Id("textview_label").Index(menuitem));
  8. App.Screenshot ("After I tap the title, I can see the menu opened");
  9.  
  10. App.Tap(v => v.Id("textview_label").Index(menuitem));
  11. App.WaitForElement(Queries.ViewTitleElement);
  12. App.Screenshot("After I tap the menu item, I can see the View.");
  13. }
  14. else
  15. if (platform == Platform.iOS)
  16. {
  17. switch (menuitem)
  18. {
  19. //case HOME
  20. case 0:
  21. App.Tap (Queries.BottomMenuHome);
  22. App.WaitForElement (Queries.ButtonMap);
  23. App.Screenshot ("After I tap the 'Home' menu item, I can see the Landing View.");
  24. break;
  25.  
  26. //case Enquires
  27. case 1:
  28. App.Tap (Queries.BottomMenuEnquires);
  29. App.WaitForElement(Queries.EnquireMenuViewBtnStatementOverview);
  30. App.Screenshot("After I tap the 'Enquires' menu item, I can see the Enquire Menu View.");
  31.  
  32. switch (menulistitem)
  33. {
  34. case 0:
  35. App.Tap(Queries.EnquireMenuViewBtnStatementOverview);
  36. App.WaitForElement(Queries.StatementOverviewViewBtnAssets);
  37. App.Screenshot("After I tap the 'Statement Overview' menu item, I can see the Statement Overview View.");
  38. break;
  39.  
  40. case 1:
  41. App.Tap(Queries.EnquireMenuViewBtnBalances);
  42. App.WaitForElement(Queries.Accountbtn);
  43. App.Screenshot("After I tap the 'Balances' menu item, I can see the Balances View.");
  44. break;
  45.  
  46. case 2:
  47. App.Tap(Queries.EnquireMenuViewBtnTransactions);
  48. App.WaitForElement(Queries.TransactionsViewBtnStartDate);
  49. App.Screenshot("After I tap the 'Transactions' menu item, I can see the Transactions View.");
  50. break;
  51.  
  52. case 3:
  53. App.Tap(Queries.EnquireMenuViewBtnIBAN);
  54. App.WaitForElement(Queries.IbanViewBtnCopyIBAN);
  55. App.Screenshot("After I tap the 'IBAN' menu item, I can see the IBAN View.");
  56. break;
  57.  
  58. default:
  59. App.Screenshot("Menu List Item does not exist!");
  60. break;
  61. }
  62. break;
  63.  
  64. //case Payments
  65. case 2:
  66. App.Tap (Queries.BottomMenuPayments);
  67. App.WaitForElement(Queries.PaymentsMenuViewBtnBillPayments);
  68. App.Screenshot("After I tap the 'Payments' menu item, I can see the Payments Menu View.");
  69.  
  70. switch (menulistitem)
  71. {
  72. case 0:
  73. App.Tap(Queries.PaymentsMenuViewBtnBillPayments);
  74. App.WaitForElement(Queries.BillPaymentsViewFieldEntity);
  75. App.Screenshot("After I tap the 'Bill Payments' menu item, I can see the Bill Payments View.");
  76. break;
  77.  
  78. case 1:
  79. App.Tap(Queries.PaymentsMenuViewBtnPaymentsToTheState);
  80. App.WaitForElement(Queries.StatePaymentsViewFieldReference);
  81. App.Screenshot("After I tap the 'Payments To The State' menu item, I can see the Payments To The State View.");
  82. break;
  83.  
  84. case 2:
  85. App.Tap(Queries.PaymentsMenuViewBtnTopUps);
  86. App.WaitForElement(Queries.TopUpsViewBtnService);
  87. App.Screenshot("After I tap the 'Top Ups' menu item, I can see the Top Ups View.");
  88. break;
  89.  
  90. case 3:
  91. App.Tap(Queries.PaymentsMenuViewBtnSocialSecurityPayment);
  92. App.WaitForElement(Queries.SocialSecurityPaymentViewFieldSocialSecurity);
  93. App.Screenshot("After I tap the 'Social Security Payment' menu item, I can see the Social Security Payment View.");
  94. break;
  95.  
  96. default:
  97. App.Screenshot("Menu List Item does not exist!");
  98. break;
  99. }
  100. break;
  101.  
  102. //case Cards
  103. case 3:
  104. App.Tap (Queries.BottomMenuCards);
  105. App.WaitForElement(Queries.CardsViewBtnDebitCard);
  106. App.Screenshot("After I tap the 'Cards' menu item, I can see the Cards View.");
  107.  
  108. switch (cardtype)
  109. {
  110. case 0:
  111. App.Tap(Queries.CardsViewBtnCreditCard);
  112. App.WaitForElement(Queries.CreditCardViewBtnOperations);
  113. App.Screenshot("After I tap a Credit Card, I can see the Credit Card View.");
  114. break;
  115.  
  116. case 1:
  117. App.Tap(Queries.CardsViewBtnDebitCard);
  118. App.WaitForElement(Queries.DebitCardViewBtnMovements);
  119. App.Screenshot("After I tap a Debit Card, I can see the Debit Card View.");
  120. break;
  121.  
  122. default:
  123. App.Screenshot("The Card does not exist!");
  124. break;
  125. }
  126. break;
  127.  
  128. //case Transfers
  129. case 4:
  130. App.Tap (Queries.BottomMenuTransfers);
  131. App.WaitForElement(Queries.TransfersMenuViewBtnBetweenCAAccounts);
  132. App.Screenshot("After I tap the 'Transfers' menu item, I can see the Transfers Menu View.");
  133.  
  134. switch (menulistitem)
  135. {
  136. case 0:
  137. App.Tap(Queries.TransfersMenuViewBtnBetweenCAAccounts);
  138. App.WaitForElement(Queries.BetweenCAAccountsViewBtnIBAN);
  139. App.Screenshot("After I tap the 'Between CA Accounts' menu item, I can see the Between CA Accounts View.");
  140. break;
  141.  
  142. case 1:
  143. App.Tap(Queries.TransfersMenuViewBtnInterbank);
  144. App.WaitForElement(Queries.InterbankViewFieldIBAN);
  145. App.Screenshot("After I tap the 'Interbank' menu item, I can see the Interbank View.");
  146. break;
  147.  
  148. default:
  149. App.Screenshot("Menu List Item does not exist!");
  150. break;
  151. }
  152. break;
  153.  
  154. default:
  155. App.Screenshot("No menu item was selected.");
  156. break;
  157. }
  158. }
  159. }
  160.  
  161.  
  162. public static async void RegistarLoginNav(IApp App, IScreenQueries Queries, Platform platform, int menuitem, int menulistitem, int cardtype)
  163. {
  164. await StartLanguageService();
  165.  
  166. App.WaitForElement(Queries.ButtonLogin, timeout: TimeSpan.FromSeconds(WAITING_TIME));
  167. App.Tap(Queries.ButtonLogin);
  168. App.WaitForElement (Queries.Backbtn);
  169.  
  170. AppResult[] view = App.Query(Queries.MembershipRegistrationViewFieldNumber);
  171. int result = view.Count();
  172.  
  173. if(result != 1)
  174. {
  175. //Registo view
  176. App.Screenshot ("Given the app is in the Login view and in Portrait orientation");
  177. App.EnterText (Queries.MembershipRegistrationViewFieldNumber, MemNumber);
  178. App.Screenshot ("And I insert the data, I can see the fields filled");
  179. App.Tap (Queries.MembershipRegistrationViewBtnNext);
  180.  
  181. //PIN Challenge
  182. App.WaitForElement (Queries.MembershipRegistrationAuthenticationPIN, timeout: TimeSpan.FromSeconds (WAITING_TIME));
  183. App.Screenshot ("After tapping the button, I can see the PIN Challenge view");
  184. App.EnterText (PIN);
  185. App.EnterText (PIN);
  186. App.EnterText (PIN);
  187.  
  188. //Codigo SMS
  189. App.WaitForElement (Queries.EnableMembershipViewFieldSMS);
  190. App.Screenshot ("After completing the challenge, I can see the SMS challenge view");
  191. App.EnterText (Queries.EnableMembershipViewFieldSMS, SMSCode);
  192. App.Tap (Queries.EnableMembershipViewPIN);
  193.  
  194. //PIN
  195. if (platform == Platform.Android) {
  196. App.EnterText (PIN);
  197. App.EnterText (PIN);
  198. App.EnterText (PIN);
  199. App.EnterText (PIN);
  200. }
  201. else if (platform == Platform.iOS)
  202. {
  203. App.EnterText (Queries.EnableMembershipViewPIN, PINiOS);
  204. }
  205.  
  206. App.Screenshot ("And I insert the data, I can see the fields filled");
  207. App.Tap(Queries.EnableMembershipViewBtnActivate);
  208.  
  209. //PIN Challenge
  210. App.WaitForElement (Queries.MembershipRegistrationAuthenticationPIN);
  211. App.Screenshot ("After tapping the button, I can see the PIN Challenge view");
  212. App.EnterText (PIN);
  213. App.EnterText (PIN);
  214. App.EnterText (PIN);
  215.  
  216. //Success registration
  217. App.WaitForElement (Queries.Message); //success message
  218. App.Screenshot ("After completing the PIN Challenge, I can see the success registration message");
  219. App.Tap (v => v.Marked ("Ok"));
  220.  
  221. //back to the Auth view
  222. App.WaitForElement (Queries.AuthenticationViewPIN);
  223. App.Screenshot ("And pressing OK, I'm back to the Auth view");
  224.  
  225. App.EnterText (PIN);
  226. App.EnterText (PIN);
  227. App.EnterText (PIN);
  228. App.EnterText (PIN);
  229. }
  230. else
  231. {
  232. App.EnterText (PIN);
  233. App.EnterText (PIN);
  234. App.EnterText (PIN);
  235. App.EnterText (PIN);
  236. }
  237.  
  238. //initial view, after login, this takes time
  239. App.WaitForElement(Queries.BottomMenuHome, timeout: TimeSpan.FromSeconds(WAITING_TIME)); //hamburguer menu InĂ­cio
  240. App.Screenshot("After inserting the PIN, I can see the Main view");
  241.  
  242. OpenMenuAndSelectMenuItem(menuitem, menulistitem, cardtype);
  243.  
  244.  
  245. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement