public void BankAccountVerification01_VerifyNewlyAddedBank() { HomePage HomePg = new HomePage(WebDriver); try { /* Bank Account Verification Scenarios - * Add Account and Verify * Delete Account * Add account and failed verification */ string bankAccountName1 = "Bank Account 01"; WebDriver.Manage().Window.Maximize(); WebDriver.Navigate().GoToUrl("https://demo.billzy.com/home"); LoginPage loginPage = new LoginPage(WebDriver); SendPage SendPg = new SendPage(WebDriver); ReceivedPage Recpg = new ReceivedPage(WebDriver); BillzyCashModal BillzyCashMlPg = new BillzyCashModal(WebDriver); SIVPage SIVPG1 = new SIVPage(WebDriver); loginPage.UserNameTextBox().Click(); loginPage.UserNameTextBox().SendKeys("*****@*****.**"); loginPage.PasswordTextBox().Click(); SeleniumSetMethods SetMethods = new SeleniumSetMethods(WebDriver); SeleniumSetMethods.WaitOnPage(secdelay2); loginPage.PasswordTextBox().SendKeys("Cognito1"); SeleniumSetMethods.WaitOnPage(secdelay2); loginPage.LoginButton().Click(); SeleniumSetMethods.WaitOnPage(secdelay8); HomePg.Profile().Click(); SeleniumSetMethods.WaitOnPage(secdelay1); HomePg.CardMgmnt().Click(); SeleniumSetMethods.WaitOnPage(secdelay1); DebitCardPage DebitCardPg = new DebitCardPage(WebDriver); DebitCardPg.DebitCardBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay1); DebitCardPg.AddBankAccountBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.NameofAccount().SendKeys(bankAccountName1); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.Bsb().SendKeys("650001"); Random rand1 = new Random(); DateTime dt1 = new DateTime(); string dtString1 = dt1.ToString("MM HH:mm:ss"); int randBankAccountNumber1 = rand1.Next(); DebitCardPg.AccountNumber().SendKeys(randBankAccountNumber1.ToString()); String BankAccountNumber1 = DebitCardPg.AccountNumber().Text; DebitCardPg.BankName().SendKeys("Westpac"); DebitCardPg.AccountNickname().SendKeys(bankAccountName1); DebitCardPg.TCCheckbox().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.AddDebitAccountBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay4); DebitCardPg.AccountNickName1().Equals(bankAccountName1); String DateVerified1 = DebitCardPg.DateVerified1().Text; String BSB1 = DebitCardPg.BSB1().Text; String AccountNumber1 = DebitCardPg.AccountNumber1().Text; String AccountNickName1 = DebitCardPg.AccountNickName1().Text; String AccountName1 = DebitCardPg.AccountName1().Text; string PendingIcon1 = DebitCardPg.VerifyPendingIcon1().GetAttribute("title"); SeleniumSetMethods.WaitOnPage(secdelay4); Assert.IsTrue(DateVerified1.Contains("Verify Now") && BSB1.Contains("650001") && AccountName1.Contains(bankAccountName1) && AccountNumber1.Contains(BankAccountNumber1) && PendingIcon1.Contains("Pending transactions")); DebitCardPg.VerifyNowLink1().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); string defaultDepositedAmount = "0.01"; VerifyBankAccountPage VerifyBankAccountPg = new VerifyBankAccountPage(WebDriver); VerifyBankAccountPg.DepositedAmount1().SendKeys(defaultDepositedAmount); SeleniumSetMethods.WaitOnPage(secdelay2); VerifyBankAccountPg.DepositedAmount2().SendKeys(defaultDepositedAmount); SeleniumSetMethods.WaitOnPage(secdelay2); String CancelBTN = VerifyBankAccountPg.CancelBTN().Text; SeleniumSetMethods.WaitOnPage(secdelay4); Assert.IsTrue(CancelBTN.Contains("CANCEL")); VerifyBankAccountPg.VerifyBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay5); string Today = DateTime.Now.ToString("dd/MM/yyyy"); //bool VerifyVerifiedIcon1 = DebitCardPg.VerifyVerifiedIcon1().Displayed; string VerifiedIcon1 = DebitCardPg.VerifyVerifiedIcon1().GetAttribute("title"); String DateVerified2 = DebitCardPg.DateVerified1().Text; SeleniumSetMethods.WaitOnPage(secdelay5); Assert.IsTrue(DateVerified2.Contains(Today) && VerifiedIcon1.Contains("Verified account")); VerifyBankAccountPg.DeleteAccountButton().Click(); SeleniumSetMethods.WaitOnPage(secdelay3); DebitCardPg.AddBankAccountBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); Random rand2 = new Random(); DateTime dt2 = new DateTime(); string dtString2 = dt2.ToString("MM HH:mm:ss"); int randBankAccountNumber2 = rand2.Next(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.NameofAccount().SendKeys("Invalid Account"); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.Bsb().SendKeys("650002"); DebitCardPg.AccountNumber().SendKeys(randBankAccountNumber2.ToString()); String BankAccountNumber11 = DebitCardPg.AccountNumber().Text; DebitCardPg.BankName().SendKeys("Westpac"); DebitCardPg.AccountNickname().SendKeys("Invalid Account"); DebitCardPg.TCCheckbox().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.AddDebitAccountBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.VerifyNowLink1().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); VerifyBankAccountPg.DepositedAmount1().SendKeys("0.02"); VerifyBankAccountPg.DepositedAmount2().SendKeys("0.02"); SeleniumSetMethods.WaitOnPage(secdelay2); VerifyBankAccountPg.VerifyBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); String ErrorMessage = VerifyBankAccountPg.ErrorMessage().Text; Assert.IsTrue(ErrorMessage.Contains("You have two attempts remaining")); VerifyBankAccountPg.CancelBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.VerifyNowLink1().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); VerifyBankAccountPg.DepositedAmount1().SendKeys("0.03"); SeleniumSetMethods.WaitOnPage(secdelay2); VerifyBankAccountPg.DepositedAmount2().SendKeys("0.03"); SeleniumSetMethods.WaitOnPage(secdelay2); VerifyBankAccountPg.VerifyBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay4); String ErrorMessage1 = VerifyBankAccountPg.ErrorMessage().Text; SeleniumSetMethods.WaitOnPage(secdelay4); Assert.IsTrue(ErrorMessage1.Contains("You have one attempt remaining")); VerifyBankAccountPg.CancelBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.VerifyNowLink1().Click(); SeleniumSetMethods.WaitOnPage(secdelay3); VerifyBankAccountPg.DepositedAmount1().SendKeys("0.04"); SeleniumSetMethods.WaitOnPage(secdelay2); VerifyBankAccountPg.DepositedAmount2().SendKeys("0.04"); SeleniumSetMethods.WaitOnPage(secdelay2); VerifyBankAccountPg.VerifyBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay4); String ErrorMessage2 = VerifyBankAccountPg.ErrorMessage().Text; Assert.IsTrue(ErrorMessage2.Contains("You have no more attempts remaining, please contact billzy")); bool VerifyButton = DebitCardPg.VerifyNowLink1().Displayed; Console.WriteLine(VerifyButton); VerifyBankAccountPg.CancelBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.VerifyContactBillzy().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); String BillzyContact = VerifyBankAccountPg.BillzyContact1().Text; Assert.IsTrue(BillzyContact.Contains("Phone: 1300 BILLZY")); HomePg.CardMgmnt().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitCardPg.DebitCardBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); VerifyBankAccountPg.DeleteAccountButton().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); WebDriver.Navigate().GoToUrl("https://demo.billzy.com/received"); SeleniumSetMethods.WaitOnPage(secdelay4); HomePg.SignOutBTN().Click(); } finally { } }
public void AddDeleteCards01() { HomePage HomePg = new HomePage(WebDriver); try { Console.WriteLine(WebDriver.Manage().Window.Size); /* * * WebDriver.Manage().Window.Size = new Size(825, 990); * SeleniumSetMethods.WaitOnPage(secdelay5); * Console.WriteLine(WebDriver.Manage().Window.Size); * Console.WriteLine("Test"); */ WebDriver.Manage().Window.Maximize(); WebDriver.Navigate().GoToUrl("https://demo.billzy.com/home"); LoginPage loginPage = new LoginPage(WebDriver); loginPage.UserNameTextBox().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); loginPage.UserNameTextBox().Clear(); SeleniumSetMethods.WaitOnPage(secdelay2); loginPage.UserNameTextBox().SendKeys("*****@*****.**"); loginPage.PasswordTextBox().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); loginPage.PasswordTextBox().SendKeys("Cognito1"); loginPage.LoginButton().Click(); SeleniumSetMethods SetMethods = new SeleniumSetMethods(WebDriver); SeleniumSetMethods.WaitOnPage(secdelay7); CardPage CardPg = new CardPage(WebDriver); SendPage SendPg = new SendPage(WebDriver); ReceivedPage Recpg = new ReceivedPage(WebDriver); BillzyCashModal BillzyCashMlPg = new BillzyCashModal(WebDriver); SIVPage SIVPG1 = new SIVPage(WebDriver); HomePg.Profile().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); HomePg.CardMgmnt().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.AddCard().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); //testInfo = Test 1 : Card Management - "Add Card" All Fields Displayed IWebElement bodyTag = WebDriver.FindElement(By.TagName("body")); bool card1 = bodyTag.Text.Contains("Add Card"); bool card2 = bodyTag.Text.Contains("Name on Credit Card"); bool card3 = bodyTag.Text.Contains("Credit Card Number"); bool card4 = bodyTag.Text.Contains("Expiry Date"); bool card5 = bodyTag.Text.Contains("Account Nickname"); bool CardField1 = CardPg.CardName().Displayed; bool CardField2 = CardPg.NumberOnCard().Displayed; bool CardField3 = CardPg.EndMonth().Displayed; bool CardField4 = CardPg.EndYear().Displayed; bool CardField5 = CardPg.CardNickname().Displayed; bool CardField6 = CardPg.AddCard().Displayed; bool CardField7 = CardPg.Cancel().Displayed; SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(card1 == true && card2 == true && card3 == true && card4 == true && card5 == true && CardField1 == true && CardField2 == true && CardField3 == true && CardField4 == true && CardField5 == true && CardField6 == true && CardField7 == true); //Master Card CardPg.CardName().SendKeys("Credit Card Owner"); CardPg.NumberOnCard().SendKeys("5454545454545454"); CardPg.EndMonth().SendKeys("12"); CardPg.EndYear().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.EndYear().Clear(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.EndYear().SendKeys("21"); CardPg.CardCvc().SendKeys("123"); CardPg.CardNickname().SendKeys("TestOnly"); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.AddCard2().Click(); SeleniumSetMethods.WaitOnPage(secdelay7); //CardPg.DeleteCard().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); //Visa Card CardPg.AddCard().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.CardName().SendKeys("Credit Card Owner"); CardPg.NumberOnCard().SendKeys("4111111111111111"); CardPg.EndMonth().SendKeys("12"); CardPg.EndYear().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.EndYear().Clear(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.EndYear().SendKeys("21"); CardPg.CardCvc().SendKeys("123"); CardPg.CardNickname().SendKeys("TestOnly"); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.AddCard2().Click(); SeleniumSetMethods.WaitOnPage(secdelay4); //CardPg.DeleteCard().Click(); CardPg.DeleteCard().Click(); //Add invalid Card number " Credit Card Number Field Error message SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.AddCard().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.CardName().SendKeys("Credit Card Owner"); CardPg.NumberOnCard().SendKeys("4111111111111199"); CardPg.EndMonth().SendKeys("12"); CardPg.EndYear().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.EndYear().Clear(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.EndYear().SendKeys("21"); CardPg.CardCvc().SendKeys("123"); CardPg.CardNickname().SendKeys("TestOnly"); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.AddCard2().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); IWebElement bodyTag1 = WebDriver.FindElement(By.TagName("body")); bool err1 = bodyTag1.Text.Contains("Invalid card number."); SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(err1 == true); CardPg.AddCard().Click(); IWebElement bodyTag11 = WebDriver.FindElement(By.TagName("body")); SeleniumSetMethods.WaitOnPage(secdelay2); bool refresh1 = bodyTag11.Text.Contains("Add Credit Card"); SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(refresh1 == true); SeleniumSetMethods.WaitOnPage(secdelay2); WebDriver.Navigate().Refresh(); SeleniumSetMethods.WaitOnPage(secdelay5); IWebElement bodyTag22 = WebDriver.FindElement(By.TagName("body")); SeleniumSetMethods.WaitOnPage(secdelay2); bool refresh11 = bodyTag22.Text.Contains("Add Credit Card"); SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(refresh11 == false); CardPg.AddCard().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.CardName().SendKeys("Credit Card Owner"); CardPg.NumberOnCard().SendKeys("8113131313133313"); CardPg.EndMonth().SendKeys("12"); CardPg.EndYear().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.EndYear().Clear(); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.EndYear().SendKeys("21"); CardPg.CardCvc().SendKeys("123"); CardPg.CardNickname().SendKeys("TestOnly"); SeleniumSetMethods.WaitOnPage(secdelay2); CardPg.AddCard2().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); IWebElement bodyTag2 = WebDriver.FindElement(By.TagName("body")); bool err2 = bodyTag2.Text.Contains("Only Visa and MasterCard are accepted at present."); SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(err2 == true); CardPg.Cancel().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); //Add Debit Card functionality DebitCardPage DebitPg = new DebitCardPage(WebDriver); DebitPg.DebitCardBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay3); DebitPg.AddBankAccountBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay3); DebitPg.NameofAccount().SendKeys("AddDebitAccount1"); DebitPg.Bsb().SendKeys("123456"); DebitPg.AccountNumber().SendKeys("123456789"); DebitPg.BankName().SendKeys("commBank"); DebitPg.AccountNickname().SendKeys("DebitNickName1"); DebitPg.TCCheckbox().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); DebitPg.AddDebitAccountBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay4); IWebElement bodyTag3 = WebDriver.FindElement(By.TagName("body")); bool bank1 = bodyTag3.Text.Contains("Account Nickname"); bool bank2 = bodyTag3.Text.Contains("BSB"); bool bank3 = bodyTag3.Text.Contains("Account Number"); bool bank4 = bodyTag3.Text.Contains("Bank"); bool bank5 = bodyTag3.Text.Contains("Account Name"); bool bankField1 = bodyTag3.Text.Contains("Delete"); bool bankField2 = bodyTag3.Text.Contains("DebitNickName1"); bool bankField3 = bodyTag3.Text.Contains("123456"); bool bankField4 = bodyTag3.Text.Contains("123456789"); bool bankField5 = bodyTag3.Text.Contains("commBank"); SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(bank1 == true && bank2 == true && bank3 == true && bank4 == true && bank5 == true && bankField1 == true && bankField2 == true && bankField3 == true && bankField4 == true && bankField5 == true); DebitPg.Deleteaccount().Click(); SeleniumSetMethods.WaitOnPage(secdelay3); IWebElement bodyTag4 = WebDriver.FindElement(By.TagName("body")); bool bankdet1 = bodyTag4.Text.Contains("DebitNickName1"); SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(bankdet1 == false); DebitPg.DebitCardBTN().Click(); //verify the headings string title = CardPg.BankAccountTitles().Text; Console.WriteLine("title" + title); string data = CardPg.BankAccountData().Text; Console.WriteLine("data" + data); WebDriver.Navigate().GoToUrl("https://demo.billzy.com/received"); SeleniumSetMethods.WaitOnPage(secdelay2); HomePg.SignOutBTN().Click(); } finally { } }