public void RemoveAllServices()
        {
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "ListingManagement");
            Global.GlobalDefinitions.wait(2000);
            ManageListing.Click();
            Base.test.Log(LogStatus.Info, "Starting removing Service");
            Global.GlobalDefinitions.wait(5000);

            try
            {
                foreach (IWebElement ele in Remove)
                {
                    WebDriverWait wait = new WebDriverWait(Global.GlobalDefinitions.driver, TimeSpan.FromSeconds(10));
                    wait.Until(ExpectedConditions.ElementToBeClickable((ele)));
                    ele.Click();
                    ModalYesButton.Click();
                    Global.GlobalDefinitions.wait(5000);
                }
            }
            catch (Exception e)
            {
                IWebElement NoListings = Global.GlobalDefinitions.driver.FindElement(By.XPath("//h3[contains(text(),'You do not have any service listings!')]"));
                if (NoListing.Displayed)
                {
                    Global.Base.test.Log(LogStatus.Info, "There are no services to remove");
                }
                else
                {
                    Global.Base.test.Log(LogStatus.Info, "Something went wrong!" + e);
                }
            }
        }
        public void EditServiceDetails()
        {
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "ListingManagement");
            ManageListing.Click();
            Base.test.Log(LogStatus.Info, "Starting editing Service");
            Global.GlobalDefinitions.wait(5000);
            bool RecordFound = false;

            try
            {
                for (int p = 0; p < NoOfPages.Count; p++)
                {
                    for (int i = 0; i < Title.Count; i++)
                    {
                        if ((Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title") == Title[i].Text) && (Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category") == Category[i].Text))
                        {
                            RecordFound = true;
                            Edit[i].Click();
                            ServiceListing service = new ServiceListing();
                            service.AddService();
                            Global.GlobalDefinitions.wait(2000);
                            i = i + 1;
                        }
                    }
                    if (NextPage.Enabled)
                    {
                        NextPage.Click();
                    }
                    else if (RecordFound == false)
                    {
                        Global.Base.test.Log(LogStatus.Info, "There are no matching listings!");
                    }
                }
            }
            catch (Exception e)
            {
                IWebElement NoListings = Global.GlobalDefinitions.driver.FindElement(By.XPath("//h3[contains(text(),'You do not have any service listings!')]"));
                if (NoListings.Displayed)
                {
                    Global.Base.test.Log(LogStatus.Info, "You do not have any service listings to display");
                }
                else
                {
                    Global.Base.test.Log(LogStatus.Info, "Something went wrong!" + e);
                }
            }
        }
Пример #3
0
        //[FindsBy(How = How.XPath, Using = "//label[contains(text(),'Hourly basis service')]")]
        //private IWebElement ActualResult1 { get; set; }



        public void EditData()
        {
            Thread.Sleep(7000);
            ManageListing.Click();

            Thread.Sleep(7000);
            EditIcon.Click();

            Thread.Sleep(7000);
            Service.Click();

            Thread.Sleep(6000);
            Save.Click();


            //verify
            Thread.Sleep(9000);
            ManagelistingsMenu.Click();
            Thread.Sleep(9000);
            try
            {
                Console.WriteLine("Entered try");
                EditIcon.Click();

                //if selected true
                Assert.IsFalse(Service.Selected);
                {
                    Console.WriteLine("Test case 2 PASS : Record not edited");
                    Base.test.Log(LogStatus.Info, "Editing Done");
                }



                ////Screenshot
                //String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report");
                ////AddScreenCapture(@"E:\Dropbox\VisualStudio\Projects\Beehive\TestReports\ScreenShots\");
                //Base.test.Log(LogStatus.Info, "Image example: " + img);
                //// end test. (Reports)
                //Base.extent.EndTest(Base.test);
                //// calling Flush writes everything to the log file (Reports)
                //Base.extent.Flush();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #4
0
        public void DeleteData()
        {
            Thread.Sleep(7000);
            ManageListing.Click();

            Thread.Sleep(7000);
            DeleteIcon.Click();

            ConfirmYes.Click();
            Thread.Sleep(4000);

            //Verfication
            try
            {
                Assert.IsTrue(ActResult3.Displayed);
                Console.WriteLine("Test 3 Pass : Record deleted successfully");

                Base.test.Log(LogStatus.Info, "Deleting Done");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public void RemoveServiceDetails()
        {
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "ListingManagement");
            Global.GlobalDefinitions.wait(2000);
            ManageListing.Click();
            Base.test.Log(LogStatus.Info, "Starting removing Service");
            Global.GlobalDefinitions.wait(5000);
            bool RecordFound = false;
            int  flag        = 0;

            //try
            //{
            //    for (int p = 0; p < NoOfPages.Count; p++)
            //    {
            //        for (int i = 0; i < Title.Count; i++)
            //        {
            //            Console.WriteLine("i value:" + i);
            //            if ((Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title") == Title[i].Text) && (Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category") == Category[i].Text))
            //            {
            //                RecordFound = true;
            //                WebDriverWait wait = new WebDriverWait(Global.GlobalDefinitions.driver, TimeSpan.FromSeconds(10));
            //                wait.Until(ExpectedConditions.ElementToBeClickable((Remove[i])));
            //                Remove[i].Click();
            //                Console.WriteLine("removing row:"+i);
            //                Global.GlobalDefinitions.wait(2000);
            //                ModalYesButton.Click();
            //                i = i - 1;
            //            }
            //        }
            //        if (NextPage.Enabled)
            //            NextPage.Click();
            //        else if (RecordFound == false)
            //        {
            //            Global.Base.test.Log(LogStatus.Info, "There are no matching listings!");
            //        }
            //    }
            //}
            try
            {
                for (int p = 0; p < NoOfPages.Count; p++)
                {
                    for (int i = 0; i < Title.Count; i++)
                    {
                        Global.GlobalDefinitions.wait(7000);
                        if (flag == Title.Count)
                        {
                            break;
                        }
                        else
                        if ((Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title") == Title[i].Text) && (Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category") == Category[i].Text))
                        {
                            RecordFound = true;
                            WebDriverWait wait = new WebDriverWait(Global.GlobalDefinitions.driver, TimeSpan.FromSeconds(10));
                            wait.Until(ExpectedConditions.ElementToBeClickable((Remove[i])));
                            Remove[i].Click();
                            ModalYesButton.Click();
                            Global.GlobalDefinitions.wait(2000);
                            i = i - 1;
                            flag++;
                        }
                    }
                    if (NextPage.Enabled)
                    {
                        NextPage.Click();
                    }
                    else if (RecordFound == false)
                    {
                        Global.Base.test.Log(LogStatus.Info, "There are no matching listings!");
                    }
                }
            }
            catch (Exception e)
            {
                IWebElement NoListings = Global.GlobalDefinitions.driver.FindElement(By.XPath("//h3[contains(text(),'You do not have any service listings!')]"));
                if (NoListing.Displayed)
                {
                    Global.Base.test.Log(LogStatus.Info, "There are no services to remove");
                }
                else
                {
                    Global.Base.test.Log(LogStatus.Info, "Something went wrong!" + e);
                }
            }
        }