public void AssertDefaultValuesOnInvoiceCreationPage()
        {
            //verify invoice number
            string invoiceNumber = DefaultLocators[1].Text;

            Assert.AreEqual(TotalLength, Convert.ToString(invoiceNumber.Length));
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Verified the total length of default invoice number=>{invoiceNumber}");
            //_logger.Info($"Verified the total length of default invoice number=>{invoiceNumber}");
            string firstFourDigits = invoiceNumber.Substring(0, 4);
            string finalSixDigits  = invoiceNumber.Substring(4);

            Assert.AreEqual(CNZBA, firstFourDigits);
            Assert.AreEqual(FinalSix, Convert.ToString(finalSixDigits.Length));
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Verified first four digits of default invoice number=>{firstFourDigits}");
            //_logger.Info($"Verified first four digits of default invoice number=>{firstFourDigits}");
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Verified final six digits of default invoice number=>{finalSixDigits}");
            //_logger.Info($"Verified final six digits of default invoice number=>{finalSixDigits}");
            //verify current date.

            Assert.IsTrue(DefaultLocators[3].Text.Contains(currentDate));
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Got current date=>{currentDate}");
            //_logger.Info($"Got current date=>{currentDate}");
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Verified default date on invoice creation page=>{DefaultLocators[3].Text}");
            //_logger.Info($"Verified default date on invoice creation page=>{DefaultLocators[3].Text}");
            Thread.Sleep(6000);
            //verify defaut value for totals and GSTs
            string totalAmount1 = DefaultLocators[5].Text;
            string totalAmount2 = Values[1].Text;

            string GST1 = DefaultLocators[7].Text;
            string GST2 = Values[2].Text;

            Assert.AreEqual(ZeroMoney, totalAmount1);
            Assert.AreEqual(totalAmount1, totalAmount2);
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Default Total amount was =>{totalAmount1} and {totalAmount2}");
            //_logger.Info($"Default Total amount was =>{totalAmount1} and {totalAmount2}");
            Assert.AreEqual(ZeroMoney, GST1);
            Assert.AreEqual(GST1, GST2);
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Default GST amount was =>{GST1} and {GST2}");
            //_logger.Info($"Default GST amount was =>{GST1} and {GST2}");
            Thread.Sleep(2000);
            //verify the defalt status is New
            Assert.AreEqual(DefaultStatus, DefaultLocators[9].Text);
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Got default status =>{DefaultStatus}");
            //_logger.Info($"Got default status =>{DefaultStatus}");
            Thread.Sleep(2000);
            //verify the due date value is two weeks after current date;
        }
Ejemplo n.º 2
0
        internal void InputUserInfoAndLogin(TestUser user)
        {
            EmailAddress.SendKeys(user.EmailAddress);
            Reporter.LogTestStepForBugLogger(Status.Info, $"Input email address=>{user.EmailAddress}");
            //_logger.Info($"Input email address=>{user.EmailAddress}");
            PassWord.SendKeys(user.PassWord);
            Reporter.LogTestStepForBugLogger(Status.Info, $"Input password=>{user.PassWord}");
            //_logger.Info($"Input password=>{user.PassWord}");

            LoginButton.Click();
            //Thread.Sleep(6000);
        }
Ejemplo n.º 3
0
        internal void NoInput()
        {
            Actions actionsObj = new Actions(Driver);

            //Move the cursor From the user account to password field
            actionsObj.Click(EmailAddress).Perform();
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Inputed no mail address=>{EmailAddress}");
            //_logger.Info($"Inputed no mail address=>{EmailAddress}");
            actionsObj.Click(PassWord).Perform();
            Reporter.LogTestStepForBugLogger(Status.Info, $"Inputed no password=>{PassWord}");
            //_logger.Info($"Inputed no password=>{PassWord}");
            actionsObj.Click(EmailAddress).Perform();
            Reporter.LogTestStepForBugLogger(Status.Info, $"moved mouse back to login field");
            //_logger.Info($"moved mouse back to login field");
        }
        public void CreateAnInvoice()
        {
            //input client name
            ClientName.SendKeys(clientName);
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Inputed client name =>{clientName}");
            //_logger.Info($"Inputed client name =>{clientName}");
            Email.SendKeys(email);
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Inputed Email =>{email}");
            //_logger.Info($"Inputed Email =>{email}");
            PurchaseOrderNumber.SendKeys(purchaOrderNumber);
            Reporter.LogTestStepForBugLogger(Status.Info,
                                             $"Inputed purcha order number =>{purchaOrderNumber}");
            //_logger.Info($"Inputed purcha order number =>{purchaOrderNumber}");

            //open add address button and deleted this field then add it again
            AddAddressButton.Click();
            Reporter.LogTestStepForBugLogger(Status.Info, $"Address button was added");
            //_logger.Info($"Address button was added");
            RemoveAddressButton.Click();
            Reporter.LogTestStepForBugLogger(Status.Info, $"Address button was removed");
            //_logger.Info($"Address button was removed");
            Assert.IsTrue(AddAddressButton.Enabled);
            Reporter.LogTestStepForBugLogger(Status.Info, $"Address button was removed successfully");
            //_logger.Info($"Address button was removed successfully");
            AddAddressButton.Click();
            Reporter.LogTestStepForBugLogger(Status.Info, $"Address button was added again");
            //_logger.Info($"Address button was added again");
            ClientContact.SendKeys(clientContact);
            Reporter.LogTestStepForBugLogger(Status.Info, $"Inputed clinet contact =>{clientContact}");
            //_logger.Info($"Inputed clinet contact =>{clientContact}");

            //open add item button and deleted this field then add it again
            Items[0].Click();
            Actions actionsObj = new Actions(Driver);

            actionsObj.MoveToElement(DeleteItemButton).Perform();
            Assert.IsTrue(Columns[0].Enabled);
            actionsObj.Click(DeleteItemButton).Perform();

            bool present;

            try
            {
                Driver.FindElement(By.XPath("//*[@class='btn btn-outline-danger btn-sm']"));
                present = true;
            }
            catch (NoSuchElementException)
            {
                present = false;
            }

            Assert.IsFalse(present);

            Items[0].Click();
            Thread.Sleep(3000);
            //add descriptions
            //find description element
            Description1.SendKeys(description1);

            Thread.Sleep(1000);
            //add quantity and unit prices
            IReadOnlyList <IWebElement> Quantity = Driver.FindElements(By.XPath("//*[@class='form-control text-right ng-untouched ng-pristine ng-valid']"));

            Quantity[0].SendKeys(quantity1);
            Quantity[1].SendKeys(unitPrice1);
            Thread.Sleep(1000);

            //add more items
            Items[1].Click();
            Thread.Sleep(10000);
            //add descriptions
            Description2.SendKeys(description2);
            Thread.Sleep(1000);
            //add quantity and unit prices

            IReadOnlyList <IWebElement> Quantity1 = Driver.FindElements(By.XPath("//*[@class='form-control text-right ng-untouched ng-pristine ng-valid']"));

            Quantity1[0].SendKeys(quantity2);
            Quantity1[1].SendKeys(unitPrice2);
            Thread.Sleep(1000);
            //verify the totals and gsts after adding items

            string newTotalOnTopRight  = ValueUpdatedOnTopRight[5].Text;
            string newTotalOnTheBottom = ValueUpdatedOnTheBottom[1].Text;
            string newGSTOnTopRight    = ValueUpdatedOnTopRight[7].Text;
            string newGSTOnTheBottom   = ValueUpdatedOnTheBottom[2].Text;

            Assert.AreEqual("1,040.00", newTotalOnTopRight);
            Assert.AreEqual(newTotalOnTopRight, newTotalOnTheBottom);
            Assert.AreEqual("156.00", newGSTOnTopRight);
            Assert.AreEqual(newGSTOnTopRight, newGSTOnTheBottom);
            Thread.Sleep(2000);
            SaveInvoiceButton.Click();
            Thread.Sleep(6000);

            //Firstly, verify if the status is draft
            Assert.AreEqual("Draft", ValueUpdatedOnTopRight[9].Text);
            Thread.Sleep(2000);
            //if invoice total =0, stay on the current page, and no new button is added.

            if (Convert.ToInt32(Convert.ToDouble(newTotalOnTopRight)) > 0)
            {
                Assert.IsTrue(FinalisedAndSendButton.Enabled);
                Thread.Sleep(2000);
            }
            else
            {
                //if invoice total >0, go to the new page, and verify if there is a new button called"finalise & send invoice" on the new page
                Assert.IsFalse(FinalisedAndSendButton.Enabled);
                Thread.Sleep(2000);
            };
        }