public void IssueInvoice09_InternalPayer_CreateInvoice_NoGST_NoDeal_Surcharge_EndofNextMonth()
        {
            HomePage HomePg = new HomePage(WebDriver);

            try
            {
                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.WaitOnPage(secdelay2);
                loginPage.PasswordTextBox().SendKeys("Cognito1");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                loginPage.LoginButton().Click();
                SeleniumSetMethods SetMethods = new SeleniumSetMethods(WebDriver);
                SeleniumSetMethods.WaitOnPage(secdelay8);
                IssueInvoicePage IssueInvoicePg = new IssueInvoicePage(WebDriver);
                IssueInvoicePg.IssueInvoiceButton().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                IWebElement     bodyTag       = WebDriver.FindElement(By.TagName("body"));
                AddCustomerPage AddCustomerPg = new AddCustomerPage(WebDriver);
                Random          rand          = new Random();
                DateTime        dt            = new DateTime();
                string          dtString      = dt.ToString("MM/dd/yyyy HH:mm:ss");
                int             randnumber1   = rand.Next();
                IssueInvoicePg.BusinessName().Click();
                SeleniumSetMethods.WaitOnPage(secdelay1);
                IssueInvoicePg.BusinessName().SendKeys("madcowtesting10+A");
                SeleniumSetMethods.WaitOnPage(secdelay1);
                IssueInvoicePg.SelectBusiness().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                String PaymentTerms = "End of next month";
                IssueInvoicePg.PaymentTerms().SendKeys(PaymentTerms);
                IssueInvoicePg.CreateInvoice().Click();
                IssueInvoicePg.InvoiceReferenceCreate().SendKeys("Int-Inv@" + randnumber1);
                IssueInvoicePg.Description().SendKeys("Test Invoice issued to External Payer");
                IssueInvoicePg.LineItemAmount().SendKeys("185.25");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.Message().SendKeys("Test invoice has been sent to internal payer");
                string subject     = IssueInvoicePg.Subject().GetAttribute("value");
                string TotalGSTMsg = IssueInvoicePg.TotalGSTMsg().Text;
                string TotalValue  = IssueInvoicePg.TotalValue().Text;
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(subject.Contains("madcowtesting10+IntPayCreateInvNOGST has sent you an invoice") && TotalGSTMsg.Contains("(excl. GST)") && TotalValue.Contains("$185.25"));
                IssueInvoicePg.SurchargeCheckbox().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.SendInvoiceBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay5);
                SendPg.SearchInvoiceSent().SendKeys("Int-Inv@" + randnumber1);
                SeleniumSetMethods.WaitOnPage(secdelay2);
                SendPg.BillzyRefResult().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
            }
            finally
            {
                SeleniumSetMethods.WaitOnPage(secdelay2);
                WebDriver.Navigate().GoToUrl("https://demo.billzy.com/received");
                SeleniumSetMethods.WaitOnPage(secdelay4);
                HomePg.SignOutBTN().Click();
            }
        }
        public void IssueInvoice06_InternalPayer_CreateInvoice_NoGST_Deal_Surcharge()
        {
            HomePage HomePg = new HomePage(WebDriver);

            try
            {
                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.WaitOnPage(secdelay2);
                loginPage.PasswordTextBox().SendKeys("Cognito1");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                loginPage.LoginButton().Click();
                SeleniumSetMethods SetMethods = new SeleniumSetMethods(WebDriver);
                SeleniumSetMethods.WaitOnPage(secdelay8);
                IssueInvoicePage IssueInvoicePg = new IssueInvoicePage(WebDriver);
                IssueInvoicePg.IssueInvoiceButton().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                IWebElement     bodyTag       = WebDriver.FindElement(By.TagName("body"));
                AddCustomerPage AddCustomerPg = new AddCustomerPage(WebDriver);
                Random          rand          = new Random();
                DateTime        dt            = new DateTime();
                string          dtString      = dt.ToString("MM/dd/yyyy HH:mm:ss");
                int             randnumber1   = rand.Next();
                IssueInvoicePg.BusinessName().Click();
                SeleniumSetMethods.WaitOnPage(secdelay1);
                IssueInvoicePg.BusinessName().SendKeys("madcowtesting10+A");
                SeleniumSetMethods.WaitOnPage(secdelay1);
                IssueInvoicePg.SelectBusiness().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                String PaymentTerms = "90 days";
                IssueInvoicePg.PaymentTerms().SendKeys(PaymentTerms);
                IssueInvoicePg.CreateInvoice().Click();
                IssueInvoicePg.InvoiceReferenceCreate().SendKeys("Int-Inv@" + randnumber1);
                IssueInvoicePg.Description().SendKeys("Test Invoice issued to External Payer");
                IssueInvoicePg.LineItemAmount().SendKeys("1089.29");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.Message().SendKeys("Test invoice has been sent to internal payer");
                string subject     = IssueInvoicePg.Subject().GetAttribute("value");
                string TotalGSTMsg = IssueInvoicePg.TotalGSTMsg().Text;
                string TotalValue  = IssueInvoicePg.TotalValue().Text;
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(subject.Contains("madcowtesting10+IntPayCreateInvNOGST has sent you an invoice") && TotalGSTMsg.Contains("(excl. GST)") && TotalValue.Contains("$1,089.29"));
                IssueInvoicePg.BillzyDealBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.NewTotal().SendKeys("925.12");
                IssueInvoicePg.Comments().SendKeys("Deal is being offered excluding GST");
                IWebElement bodyTag1 = WebDriver.FindElement(By.TagName("body"));
                bool        disc1    = bodyTag1.Text.Contains("15.07% discount");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(disc1 == true);
                //IssueInvoicePg.NewTotal().Click();
                //SeleniumSetMethods.WaitOnPage(secdelay2);
                //IssueInvoicePg.NewTotal().Clear();
                //SeleniumSetMethods.WaitOnPage(secdelay2);
                //IssueInvoicePg.NewTotal().SendKeys("900");
                //SeleniumSetMethods.WaitOnPage(secdelay2);
                //bool disc2 = bodyTag1.Text.Contains("17.38% discount");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                bool disc3 = bodyTag1.Text.Contains("Due in 90 days");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(disc3 == true);
                DateTime duedate2        = DateTime.Today.AddDays(19);
                string   SentPgDueDate3  = duedate2.ToString("dd MMM yy");
                string   SentPgDueDate33 = duedate2.ToString("dd/MM/yyyy");
                IssueInvoicePg.OfferExpiry().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.OfferExpiry().Clear();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.OfferExpiry().SendKeys(SentPgDueDate33);
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.NewTotal().Click();
                bool dis4 = bodyTag1.Text.Contains("Due in 19 days");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(dis4 == true);
                IssueInvoicePg.SurchargeCheckbox().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);

                IssueInvoicePg.SendInvoiceBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay5);

                SendPg.SearchInvoiceSent().SendKeys("Int-Inv@" + randnumber1);

                SeleniumSetMethods.WaitOnPage(secdelay2);
                string due11 = SendPg.DueRow01().Text;
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(due11.Contains(SentPgDueDate3));
                SendPg.BillzyRefResult().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
            }
            finally
            {
                SeleniumSetMethods.WaitOnPage(secdelay2);
                WebDriver.Navigate().GoToUrl("https://demo.billzy.com/received");
                SeleniumSetMethods.WaitOnPage(secdelay4);
                HomePg.SignOutBTN().Click();
            }
        }
        public void IssueInvoice02_InternalPayer_CreateInvoice_2LineItems_GST_Deal_N0Surcharge_WithHTMLTagsValues()
        {
            HomePage HomePg = new HomePage(WebDriver);

            try
            {
                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.WaitOnPage(secdelay2);
                loginPage.PasswordTextBox().SendKeys("Cognito1");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                loginPage.LoginButton().Click();
                SeleniumSetMethods SetMethods = new SeleniumSetMethods(WebDriver);
                SeleniumSetMethods.WaitOnPage(secdelay8);
                IssueInvoicePage IssueInvoicePg = new IssueInvoicePage(WebDriver);
                IssueInvoicePg.IssueInvoiceButton().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);

                IWebElement     bodyTag       = WebDriver.FindElement(By.TagName("body"));
                AddCustomerPage AddCustomerPg = new AddCustomerPage(WebDriver);
                Random          rand          = new Random();
                DateTime        dt            = new DateTime();
                string          dtString      = dt.ToString("MM/dd/yyyy HH:mm:ss");
                int             randnumber1   = rand.Next();
                IssueInvoicePg.BusinessName().Click();
                SeleniumSetMethods.WaitOnPage(secdelay1);
                IssueInvoicePg.BusinessName().SendKeys("madcowtesting10+A");
                SeleniumSetMethods.WaitOnPage(secdelay1);
                IssueInvoicePg.SelectBusiness().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                String PaymentTerms = "60 days";
                IssueInvoicePg.PaymentTerms().SendKeys(PaymentTerms);
                IssueInvoicePg.CreateInvoice().Click();
                string invref = "script > alert(\"Hello\");</ script >";
                IssueInvoicePg.InvoiceReferenceCreate().SendKeys(invref);
                IssueInvoicePg.Description().SendKeys("Test Invoice issued to External Payer");
                IssueInvoicePg.LineItemAmount().SendKeys("299.10");

                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.Message().SendKeys(invref);
                string subject     = IssueInvoicePg.Subject().GetAttribute("value");
                string TotalGSTMsg = IssueInvoicePg.TotalGSTMsg().Text;
                string TotalValue  = IssueInvoicePg.TotalValue().Text;
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(subject.Contains("madcowtesting10+IntPayCreateInv has sent you an invoice") && TotalGSTMsg.Contains("(incl. GST)") && TotalValue.Contains("$329.01"));
                IssueInvoicePg.BillzyDealBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.NewTotal().SendKeys("200");
                IssueInvoicePg.Comments().SendKeys(invref);
                IWebElement bodyTag1 = WebDriver.FindElement(By.TagName("body"));
                bool        disc1    = bodyTag1.Text.Contains("39.21% discount");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(disc1 == true);
                bool disc2 = bodyTag1.Text.Contains("Due in 60 days");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(disc2 == true);
                // IssueInvoicePg.SurchargeCheckbox().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.SendInvoiceBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay5);
                IWebElement bodyTag2 = WebDriver.FindElement(By.TagName("body"));
                bool        err23    = bodyTag2.Text.Contains("Unfortunately there was an internal system error. Please try again in 2 minutes or contact Billzy support.");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(err23 == true);
                IssueInvoicePg.InvoiceReferenceCreate().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.InvoiceReferenceCreate().Clear();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.InvoiceReferenceCreate().SendKeys("Int-Inv@" + randnumber1);
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.SendInvoiceBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay5);
                SendPg.SearchInvoiceSent().SendKeys("Int-Inv@" + randnumber1);
                SeleniumSetMethods.WaitOnPage(secdelay2);
                SendPg.BillzyRefResult().Click();
                SeleniumSetMethods.WaitOnPage(secdelay5);
                SIVPG1.ToggleDealHistory().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);

                //string invref1 = "script>alert(\"Hello\")";
                string commvalue = SIVPG1.DiscountHistoryComment01().Text;
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(commvalue.Contains(invref));
            }
            finally
            {
                SeleniumSetMethods.WaitOnPage(secdelay2);
                WebDriver.Navigate().GoToUrl("https://demo.billzy.com/received");
                SeleniumSetMethods.WaitOnPage(secdelay4);
                HomePg.SignOutBTN().Click();
            }
        }
        public void IssueInvoice09_InternalPayer_UploadInvoice_NoGST_NoDeal_Surcharge_EndofNextMonth()
        {
            HomePage HomePg = new HomePage(WebDriver);

            try
            {
                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.WaitOnPage(secdelay2);
                loginPage.PasswordTextBox().SendKeys("Cognito1");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                loginPage.LoginButton().Click();
                SeleniumSetMethods SetMethods = new SeleniumSetMethods(WebDriver);
                SeleniumSetMethods.WaitOnPage(secdelay8);
                IssueInvoicePage IssueInvoicePg = new IssueInvoicePage(WebDriver);
                IssueInvoicePg.IssueInvoiceButton().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                IWebElement     bodyTag       = WebDriver.FindElement(By.TagName("body"));
                AddCustomerPage AddCustomerPg = new AddCustomerPage(WebDriver);
                Random          rand          = new Random();
                DateTime        dt            = new DateTime();
                string          dtString      = dt.ToString("MM/dd/yyyy HH:mm:ss");
                int             randnumber1   = rand.Next();
                IssueInvoicePg.BusinessName().Click();
                SeleniumSetMethods.WaitOnPage(secdelay1);
                IssueInvoicePg.BusinessName().SendKeys("madcowtesting10+A");
                SeleniumSetMethods.WaitOnPage(secdelay1);
                IssueInvoicePg.SelectBusiness().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                String PaymentTerms = "End of next month";
                IssueInvoicePg.PaymentTerms().SendKeys(PaymentTerms);
                IssueInvoicePg.PdfUploadFileBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.uploadPDF().SendKeys(@"C:\Users\Selenium\Desktop\SeleniumRegressionSuite_Bamboo\bin\Debug\netcoreapp3.1\Invoice.pdf");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.UploadAmount().SendKeys("1212.11");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.PaymentTerms().SendKeys(PaymentTerms);
                IssueInvoicePg.UploadInvRef().SendKeys("Int-Inv@" + randnumber1);
                IssueInvoicePg.Message().SendKeys("Test invoice has been sent");
                string subject     = IssueInvoicePg.Subject().GetAttribute("value");
                string TotalGSTMsg = IssueInvoicePg.TotalGSTMsg().Text;
                string TotalValue  = IssueInvoicePg.TotalValue().Text;
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(subject.Contains("madcowtesting10+IntPayUploadInvNoGST has sent you an invoice"));
                DateTime duedate2        = DateTime.Today.AddDays(30);
                string   SentPgDueDate3  = duedate2.ToString("dd MMM yy");
                string   SentPgDueDate33 = duedate2.ToString("dd/MM/yyyy");
                IssueInvoicePg.Uploadsurcharge().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.SendInvoiceBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay5);
                SendPg.SearchInvoiceSent().SendKeys("Int-Inv@" + randnumber1);
                SeleniumSetMethods.WaitOnPage(secdelay2);

                SendPg.BillzyRefResult().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                SeleniumSetMethods.WaitOnPage(secdelay2);
                WebDriver.Navigate().GoToUrl("https://demo.billzy.com/received");
                SeleniumSetMethods.WaitOnPage(secdelay4);
                HomePg.SignOutBTN().Click();
            }
            finally
            {
            }
        }
        public void IssueInvoice07_ExternalPayer_CreateInvoice_NoGST_NoSurcharge_NoAddress()
        {
            HomePage HomePg = new HomePage(WebDriver);

            try
            {
                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.WaitOnPage(secdelay2);
                loginPage.PasswordTextBox().SendKeys("Cognito1");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                loginPage.LoginButton().Click();
                SeleniumSetMethods SetMethods = new SeleniumSetMethods(WebDriver);
                SeleniumSetMethods.WaitOnPage(secdelay8);
                IssueInvoicePage IssueInvoicePg = new IssueInvoicePage(WebDriver);
                IssueInvoicePg.IssueInvoiceButton().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);

                IWebElement     bodyTag       = WebDriver.FindElement(By.TagName("body"));
                AddCustomerPage AddCustomerPg = new AddCustomerPage(WebDriver);
                Random          rand          = new Random();
                DateTime        dt            = new DateTime();
                string          dtString      = dt.ToString("MM/dd/yyyy HH:mm:ss");
                int             randnumber1   = rand.Next();

                DateTime duedate1       = DateTime.Today.AddDays(30);
                string   SentPgDueDate  = duedate1.ToString("dd MMM yy");
                string   SentPgDueDate1 = duedate1.ToString("dd/MM/yyyy");


                IssueInvoicePg.AddCustomerButton().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.BusinessName().Click();
                AddCustomerPg.BusinessName().SendKeys("ExternalNoAddress@" + randnumber1);
                AddCustomerPg.Abn().SendKeys("12345678910");
                AddCustomerPg.ContactName().SendKeys("Test@" + randnumber1);
                AddCustomerPg.ContactEmail().SendKeys("madcowtesting10+" + randnumber1 + "@gmail.com");
                AddCustomerPg.ContactPhoneNumber().SendKeys("12345671447");

                AddCustomerPg.AddBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);

                SeleniumSetMethods.WaitOnPage(secdelay3);
                String PaymentTerms = "30 days";
                IssueInvoicePg.PaymentTerms().SendKeys(PaymentTerms);
                IssueInvoicePg.CreateInvoice().Click();
                bool due = bodyTag.Text.Contains(SentPgDueDate1);

                IssueInvoicePg.InvoiceReferenceCreate().SendKeys("Ext-Inv@" + randnumber1);
                IssueInvoicePg.Description().SendKeys("Test Invoice issued to External Payer");
                IssueInvoicePg.LineItemAmount().SendKeys("185.25");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.Message().SendKeys("Test invoice has been sent");

                SeleniumSetMethods.WaitOnPage(secdelay2);
                string subject     = IssueInvoicePg.Subject().GetAttribute("value");
                string TotalGSTMsg = IssueInvoicePg.TotalGSTMsg().Text;
                string TotalValue  = IssueInvoicePg.TotalValue().Text;


                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(subject.Contains("madcowtesting10+anogstbiller has sent you an invoice") && TotalGSTMsg.Contains("(excl. GST)") && TotalValue.Contains("$185.25"));
                IssueInvoicePg.SurchargeCheckbox().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.SendInvoiceBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay5);
                SendPg.SearchInvoiceSent().SendKeys("Ext-Inv@" + randnumber1);
                SeleniumSetMethods.WaitOnPage(secdelay2);

                SendPg.BillzyRefResult().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
            }
            finally
            {
                SeleniumSetMethods.WaitOnPage(secdelay2);
                WebDriver.Navigate().GoToUrl("https://demo.billzy.com/received");
                SeleniumSetMethods.WaitOnPage(secdelay4);
                HomePg.SignOutBTN().Click();
            }
        }
        public void IssueInvoice01_ExternalPayer_CreateInvoice_GST_NoSurcharge()
        {
            HomePage HomePg = new HomePage(WebDriver);

            try
            {
                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.WaitOnPage(secdelay2);
                loginPage.PasswordTextBox().SendKeys("Cognito1");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                loginPage.LoginButton().Click();
                SeleniumSetMethods SetMethods = new SeleniumSetMethods(WebDriver);
                SeleniumSetMethods.WaitOnPage(secdelay8);
                IssueInvoicePage IssueInvoicePg = new IssueInvoicePage(WebDriver);
                IssueInvoicePg.IssueInvoiceButton().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                IssueInvoicePg.SendInvoiceBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                IWebElement bodyTag = WebDriver.FindElement(By.TagName("body"));
                bool        errmsg1 = bodyTag.Text.Contains("For security reasons you must enter either a street address or ABN.");
                bool        errmsg2 = bodyTag.Text.Contains("You must choose a valid business.");
                bool        data1   = bodyTag.Text.Contains("Business Name");
                bool        data2   = bodyTag.Text.Contains("ABN");
                bool        data3   = bodyTag.Text.Contains("Email");
                bool        data4   = bodyTag.Text.Contains("Street");
                bool        data5   = bodyTag.Text.Contains("Suburb");
                bool        data6   = bodyTag.Text.Contains("Postcode");

                bool data8  = bodyTag.Text.Contains("State");
                bool data9  = bodyTag.Text.Contains("Payment Terms");
                bool data10 = bodyTag.Text.Contains("Due Date");
                bool data11 = bodyTag.Text.Contains("PDF Invoice");
                bool data12 = bodyTag.Text.Contains("Subject");
                bool data13 = bodyTag.Text.Contains("Message");
                SeleniumSetMethods.WaitOnPage(secdelay3);
                Assert.IsTrue(errmsg1 == true && errmsg2 == true && data1 == true && data2 == true && data3 == true && data4 == true && data5 == true && data6 == true && data8 == true && data9 == true && data10 == true && data11 == true && data12 == true && data13 == true);
                IssueInvoicePg.AddCustomerButton().Click();
                AddCustomerPage AddCustomerPg = new AddCustomerPage(WebDriver);
                SeleniumSetMethods.WaitOnPage(secdelay3);
                Random   rand        = new Random();
                DateTime dt          = new DateTime();
                string   dtString    = dt.ToString("MM/dd/yyyy HH:mm:ss");
                int      randnumber1 = rand.Next();
                bool     data111     = bodyTag.Text.Contains("Business Name");
                bool     data22      = bodyTag.Text.Contains("ABN");
                bool     data33      = bodyTag.Text.Contains("Contact Email");
                bool     data44      = bodyTag.Text.Contains("Street");
                bool     data55      = bodyTag.Text.Contains("Suburb");
                bool     data66      = bodyTag.Text.Contains("Postcode");
                bool     data77      = bodyTag.Text.Contains("Country");
                bool     data88      = bodyTag.Text.Contains("State");
                bool     data99      = bodyTag.Text.Contains("Contact Name");
                bool     data1010    = bodyTag.Text.Contains("Contact Phone Number");
                SeleniumSetMethods.WaitOnPage(secdelay3);
                Assert.IsTrue(data111 == true && data22 == true && data33 == true && data44 == true && data55 == true && data66 == true && data77 == true && data88 == true && data99 == true && data1010 == true);
                AddCustomerPg.BusinessName().Click();
                AddCustomerPg.BusinessName().SendKeys("ExternalGST@" + randnumber1);
                AddCustomerPg.Abn().SendKeys("abhushuhuhq");
                AddCustomerPg.ContactName().SendKeys("Test@" + randnumber1);
                AddCustomerPg.ContactEmail().SendKeys("test.com");
                AddCustomerPg.ContactPhoneNumber().SendKeys("12345671447");
                AddCustomerPg.Street().SendKeys("10 Miller Street");
                AddCustomerPg.Suburb().SendKeys("Murarrie");
                AddCustomerPg.Postcode().SendKeys("4172");
                AddCustomerPg.AddBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                bool errmsg11 = bodyTag.Text.Contains("The value entered was not a valid 11 digit ABN (numbers and spaces only).");
                bool errmsg22 = bodyTag.Text.Contains("The value needs to be a valid email address, e.g. [email protected]");
                SeleniumSetMethods.WaitOnPage(secdelay3);
                Assert.IsTrue(errmsg11 == true && errmsg22 == true);
                AddCustomerPg.Abn().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.Abn().Clear();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.Abn().SendKeys("1111111111");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.ContactEmail().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.ContactEmail().Clear();
                SeleniumSetMethods.WaitOnPage(secdelay2);

                AddCustomerPg.ContactEmail().SendKeys("madcowtesting10+" + randnumber1 + "@gmail.com");
                SeleniumSetMethods.WaitOnPage(secdelay3);
                AddCustomerPg.AddBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                bool errmsg33 = bodyTag.Text.Contains("Invalid ABN length");
                SeleniumSetMethods.WaitOnPage(secdelay3);
                Assert.IsTrue(errmsg33 == true);

                AddCustomerPg.Abn().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.Abn().Clear();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.Abn().SendKeys("111111111111");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.AddBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                bool errmsg44 = bodyTag.Text.Contains("Invalid ABN length");
                SeleniumSetMethods.WaitOnPage(secdelay3);
                Assert.IsTrue(errmsg44 == true);

                AddCustomerPg.Abn().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.Abn().Clear();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.Abn().SendKeys("11111111111*");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.AddBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                bool errmsg55 = bodyTag.Text.Contains("The value entered was not a valid 11 digit ABN (numbers and spaces only).");
                SeleniumSetMethods.WaitOnPage(secdelay3);
                Assert.IsTrue(errmsg44 == true);

                AddCustomerPg.Abn().Click();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.Abn().Clear();
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.Abn().SendKeys("11 111 111 111");
                SeleniumSetMethods.WaitOnPage(secdelay2);
                AddCustomerPg.AddBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);



                String PaymentTerms = "14 days";
                IssueInvoicePg.PaymentTerms().SendKeys(PaymentTerms);
                IssueInvoicePg.CreateInvoice().Click();
                IssueInvoicePg.InvoiceReferenceCreate().SendKeys("Ext-Inv@" + randnumber1);
                IssueInvoicePg.Description().SendKeys("Test Invoice issued to External Payer");
                IssueInvoicePg.LineItemAmount().SendKeys("185.12");
                IssueInvoicePg.PreviewInvoice().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
                var tabs = WebDriver.WindowHandles;
                if (tabs.Count > 1)
                {
                    WebDriver.SwitchTo().Window(tabs[1]);
                    WebDriver.Close();
                    WebDriver.SwitchTo().Window(tabs[0]);
                }
                SeleniumSetMethods.WaitOnPage(secdelay2);
                IssueInvoicePg.Outside().Click();
                IssueInvoicePg.Message().SendKeys("Test invoice has been sent");
                string subject     = IssueInvoicePg.Subject().GetAttribute("value");
                string TotalGSTMsg = IssueInvoicePg.TotalGSTMsg().Text;
                string TotalValue  = IssueInvoicePg.TotalValue().Text;
                SeleniumSetMethods.WaitOnPage(secdelay2);
                Assert.IsTrue(subject.Contains("madcowtesting10+agstbiller has sent you an invoice") && TotalGSTMsg.Contains("(incl. GST)") && TotalValue.Contains("$203.63"));
                IssueInvoicePg.SendInvoiceBTN().Click();
                SeleniumSetMethods.WaitOnPage(secdelay5);
                SendPg.SearchInvoiceSent().SendKeys("Ext-Inv@" + randnumber1);
                SeleniumSetMethods.WaitOnPage(secdelay2);
                SendPg.BillzyRefResult().Click();
                SeleniumSetMethods.WaitOnPage(secdelay3);
            }
            finally
            {
                SeleniumSetMethods.WaitOnPage(secdelay2);
                WebDriver.Navigate().GoToUrl("https://demo.billzy.com/received");
                SeleniumSetMethods.WaitOnPage(secdelay4);
                HomePg.SignOutBTN().Click();
            }
        }