Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void OpenMenuAndSelectMenuItem(IApp App, IScreenQueries Queries,Platform platform, int menuitem, int menulistitem, int cardtype)
- {
- if (platform == Platform.Android)
- {
- App.Tap(Queries.ViewTitleElement);
- App.WaitForElement(v => v.Id("textview_label").Index(menuitem));
- App.Screenshot ("After I tap the title, I can see the menu opened");
- App.Tap(v => v.Id("textview_label").Index(menuitem));
- App.WaitForElement(Queries.ViewTitleElement);
- App.Screenshot("After I tap the menu item, I can see the View.");
- }
- else
- if (platform == Platform.iOS)
- {
- switch (menuitem)
- {
- //case HOME
- case 0:
- App.Tap (Queries.BottomMenuHome);
- App.WaitForElement (Queries.ButtonMap);
- App.Screenshot ("After I tap the 'Home' menu item, I can see the Landing View.");
- break;
- //case Enquires
- case 1:
- App.Tap (Queries.BottomMenuEnquires);
- App.WaitForElement(Queries.EnquireMenuViewBtnStatementOverview);
- App.Screenshot("After I tap the 'Enquires' menu item, I can see the Enquire Menu View.");
- switch (menulistitem)
- {
- case 0:
- App.Tap(Queries.EnquireMenuViewBtnStatementOverview);
- App.WaitForElement(Queries.StatementOverviewViewBtnAssets);
- App.Screenshot("After I tap the 'Statement Overview' menu item, I can see the Statement Overview View.");
- break;
- case 1:
- App.Tap(Queries.EnquireMenuViewBtnBalances);
- App.WaitForElement(Queries.Accountbtn);
- App.Screenshot("After I tap the 'Balances' menu item, I can see the Balances View.");
- break;
- case 2:
- App.Tap(Queries.EnquireMenuViewBtnTransactions);
- App.WaitForElement(Queries.TransactionsViewBtnStartDate);
- App.Screenshot("After I tap the 'Transactions' menu item, I can see the Transactions View.");
- break;
- case 3:
- App.Tap(Queries.EnquireMenuViewBtnIBAN);
- App.WaitForElement(Queries.IbanViewBtnCopyIBAN);
- App.Screenshot("After I tap the 'IBAN' menu item, I can see the IBAN View.");
- break;
- default:
- App.Screenshot("Menu List Item does not exist!");
- break;
- }
- break;
- //case Payments
- case 2:
- App.Tap (Queries.BottomMenuPayments);
- App.WaitForElement(Queries.PaymentsMenuViewBtnBillPayments);
- App.Screenshot("After I tap the 'Payments' menu item, I can see the Payments Menu View.");
- switch (menulistitem)
- {
- case 0:
- App.Tap(Queries.PaymentsMenuViewBtnBillPayments);
- App.WaitForElement(Queries.BillPaymentsViewFieldEntity);
- App.Screenshot("After I tap the 'Bill Payments' menu item, I can see the Bill Payments View.");
- break;
- case 1:
- App.Tap(Queries.PaymentsMenuViewBtnPaymentsToTheState);
- App.WaitForElement(Queries.StatePaymentsViewFieldReference);
- App.Screenshot("After I tap the 'Payments To The State' menu item, I can see the Payments To The State View.");
- break;
- case 2:
- App.Tap(Queries.PaymentsMenuViewBtnTopUps);
- App.WaitForElement(Queries.TopUpsViewBtnService);
- App.Screenshot("After I tap the 'Top Ups' menu item, I can see the Top Ups View.");
- break;
- case 3:
- App.Tap(Queries.PaymentsMenuViewBtnSocialSecurityPayment);
- App.WaitForElement(Queries.SocialSecurityPaymentViewFieldSocialSecurity);
- App.Screenshot("After I tap the 'Social Security Payment' menu item, I can see the Social Security Payment View.");
- break;
- default:
- App.Screenshot("Menu List Item does not exist!");
- break;
- }
- break;
- //case Cards
- case 3:
- App.Tap (Queries.BottomMenuCards);
- App.WaitForElement(Queries.CardsViewBtnDebitCard);
- App.Screenshot("After I tap the 'Cards' menu item, I can see the Cards View.");
- switch (cardtype)
- {
- case 0:
- App.Tap(Queries.CardsViewBtnCreditCard);
- App.WaitForElement(Queries.CreditCardViewBtnOperations);
- App.Screenshot("After I tap a Credit Card, I can see the Credit Card View.");
- break;
- case 1:
- App.Tap(Queries.CardsViewBtnDebitCard);
- App.WaitForElement(Queries.DebitCardViewBtnMovements);
- App.Screenshot("After I tap a Debit Card, I can see the Debit Card View.");
- break;
- default:
- App.Screenshot("The Card does not exist!");
- break;
- }
- break;
- //case Transfers
- case 4:
- App.Tap (Queries.BottomMenuTransfers);
- App.WaitForElement(Queries.TransfersMenuViewBtnBetweenCAAccounts);
- App.Screenshot("After I tap the 'Transfers' menu item, I can see the Transfers Menu View.");
- switch (menulistitem)
- {
- case 0:
- App.Tap(Queries.TransfersMenuViewBtnBetweenCAAccounts);
- App.WaitForElement(Queries.BetweenCAAccountsViewBtnIBAN);
- App.Screenshot("After I tap the 'Between CA Accounts' menu item, I can see the Between CA Accounts View.");
- break;
- case 1:
- App.Tap(Queries.TransfersMenuViewBtnInterbank);
- App.WaitForElement(Queries.InterbankViewFieldIBAN);
- App.Screenshot("After I tap the 'Interbank' menu item, I can see the Interbank View.");
- break;
- default:
- App.Screenshot("Menu List Item does not exist!");
- break;
- }
- break;
- default:
- App.Screenshot("No menu item was selected.");
- break;
- }
- }
- }
- public static async void RegistarLoginNav(IApp App, IScreenQueries Queries, Platform platform, int menuitem, int menulistitem, int cardtype)
- {
- await StartLanguageService();
- App.WaitForElement(Queries.ButtonLogin, timeout: TimeSpan.FromSeconds(WAITING_TIME));
- App.Tap(Queries.ButtonLogin);
- App.WaitForElement (Queries.Backbtn);
- AppResult[] view = App.Query(Queries.MembershipRegistrationViewFieldNumber);
- int result = view.Count();
- if(result != 1)
- {
- //Registo view
- App.Screenshot ("Given the app is in the Login view and in Portrait orientation");
- App.EnterText (Queries.MembershipRegistrationViewFieldNumber, MemNumber);
- App.Screenshot ("And I insert the data, I can see the fields filled");
- App.Tap (Queries.MembershipRegistrationViewBtnNext);
- //PIN Challenge
- App.WaitForElement (Queries.MembershipRegistrationAuthenticationPIN, timeout: TimeSpan.FromSeconds (WAITING_TIME));
- App.Screenshot ("After tapping the button, I can see the PIN Challenge view");
- App.EnterText (PIN);
- App.EnterText (PIN);
- App.EnterText (PIN);
- //Codigo SMS
- App.WaitForElement (Queries.EnableMembershipViewFieldSMS);
- App.Screenshot ("After completing the challenge, I can see the SMS challenge view");
- App.EnterText (Queries.EnableMembershipViewFieldSMS, SMSCode);
- App.Tap (Queries.EnableMembershipViewPIN);
- //PIN
- if (platform == Platform.Android) {
- App.EnterText (PIN);
- App.EnterText (PIN);
- App.EnterText (PIN);
- App.EnterText (PIN);
- }
- else if (platform == Platform.iOS)
- {
- App.EnterText (Queries.EnableMembershipViewPIN, PINiOS);
- }
- App.Screenshot ("And I insert the data, I can see the fields filled");
- App.Tap(Queries.EnableMembershipViewBtnActivate);
- //PIN Challenge
- App.WaitForElement (Queries.MembershipRegistrationAuthenticationPIN);
- App.Screenshot ("After tapping the button, I can see the PIN Challenge view");
- App.EnterText (PIN);
- App.EnterText (PIN);
- App.EnterText (PIN);
- //Success registration
- App.WaitForElement (Queries.Message); //success message
- App.Screenshot ("After completing the PIN Challenge, I can see the success registration message");
- App.Tap (v => v.Marked ("Ok"));
- //back to the Auth view
- App.WaitForElement (Queries.AuthenticationViewPIN);
- App.Screenshot ("And pressing OK, I'm back to the Auth view");
- App.EnterText (PIN);
- App.EnterText (PIN);
- App.EnterText (PIN);
- App.EnterText (PIN);
- }
- else
- {
- App.EnterText (PIN);
- App.EnterText (PIN);
- App.EnterText (PIN);
- App.EnterText (PIN);
- }
- //initial view, after login, this takes time
- App.WaitForElement(Queries.BottomMenuHome, timeout: TimeSpan.FromSeconds(WAITING_TIME)); //hamburguer menu InĂcio
- App.Screenshot("After inserting the PIN, I can see the Main view");
- OpenMenuAndSelectMenuItem(menuitem, menulistitem, cardtype);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement