//Navigate to Manage Listing page
        internal void NavigateToManageListing()
        {
            //Wait till Manage Listing is visible
            Extension.WaitForElementDisplayed(GlobalDefinitions.Driver, By.LinkText("Manage Listings"), 5);

            //Click Manage Listing Link
            ManageListingsLink.Click();
        }
Beispiel #2
0
        internal void EditListing()
        {
            GlobalDefinitions.wait(20);
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Manage List");
            //Click on Manage Listings Link
            ManageListingsLink.Click();
            //count number of rows
            IList <IWebElement> noOfrows = driver.FindElements(By.XPath("//*[@id = 'listing-management-section']//table//tbody//tr"));
            int rows = noOfrows.Count;

            Thread.Sleep(5000);
            Console.WriteLine(rows);

            for (int x = 1; x <= rows; x++)
            {
                var titleName = driver.FindElement(By.XPath("//table[@class = 'ui striped table']//tr[" + x + "]//td[3]")).Text;
                Thread.Sleep(5000);
                var edit = driver.FindElement(By.XPath("//table[@class ='ui striped table']//tr[" + x + "]//td[8]//div//button[2]"));

                if (titleName == "Selenium")
                {
                    Thread.Sleep(5000);
                    //GlobalDefinitions.WaitForElement(driver, By.XPath("//table[@class ='ui striped table']//tr["+x+"]//td[8]//div//button[1]//i[1]"),10);
                    edit.Click();
                    Thread.Sleep(5000);
                    var serviceListing = "ServiceListing";
                    Assert.AreEqual(serviceListing, driver.Title, "Service listing not opened");
                    Console.WriteLine("Edit clicked");
                    break;
                }
                else
                {
                    Console.WriteLine("Test fail");
                }
            }
            Thread.Sleep(5000);
            Title.Click();
            //CLear the current tilte
            Title.Clear();

            //Edit the new Title
            Title.SendKeys(ExcelLib.ReadData(2, "SKillTitle"));

            //CLick on save to save updated title
            Save.Click();
            GlobalDefinitions.WaitForElement(driver, By.XPath("//div[@class ='ui center aligned']"), 10);
            var listingManagement = "ListingManagement";

            Assert.AreEqual(listingManagement, driver.Title, "skill Not updated");
            Console.WriteLine("Skill updated Successfully");
        }
Beispiel #3
0
        internal void Listings()
        {
            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListings");

            // click on managelistings link
            ManageListingsLink.Click();

            // click on Eye icon on manage listings page
            View.Click();

            //click on edit icon on manage listing page
            Edit.Click();
            Thread.Sleep(2000);

            // click on action button
            ClickActionsButton.Click();
        }
Beispiel #4
0
        internal void Viewlistings()
        {
            GlobalDefinitions.wait(20);
            //Populate data from Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Manage List");
            //Click on Manage Listings Link
            ManageListingsLink.Click();
            //GlobalDefinitions.WaitForElement(driver, By.XPath("//td[@class='four wide'][text()= 'Selenium']"), 10);
            IList <IWebElement> noOfrows = driver.FindElements(By.XPath("//*[@id = 'listing-management-section']//table//tbody//tr"));
            int rows = noOfrows.Count;

            Console.WriteLine(rows);
            for (int i = 1; i <= rows; i++)
            {
                //var pagination = driver.FindElements(By.XPath("//div[@class='ui buttons semantic-ui-react-button-pagination']//button[i]")).Count;
                var titleName = driver.FindElement(By.XPath("//table[@class = 'ui striped table']//tr[" + i + "]//td[3]")).Text;
                Thread.Sleep(5000);
                var viewSkill = driver.FindElement(By.XPath("//table[@class ='ui striped table']//tr[" + i + "]//td[8]//div//button[1]"));

                var expectedValue = "Selenium";

                if (titleName == expectedValue)
                {
                    Assert.IsTrue(expectedValue == titleName, "Titlename Selenium not found");

                    //var pagination = driver.FindElements(By.XPath("//div[@class='ui buttons semantic-ui-react-button-pagination']//button[2]")).Count;
                    //GlobalDefinitions.WaitForElement(driver, By.XPath("//table[@class ='ui striped table']//tr["+i+"]//td[8]//div//button[1]//i[1]"),10);
                    viewSkill.Click();
                    var viewPage = "Service Detail";
                    Assert.AreEqual(viewPage, driver.Title, "Service Listing not opened");
                    Console.WriteLine("Service Listing opened");
                    Thread.Sleep(5000);
                    //GoBack to Previous Page
                    GlobalDefinitions.goback();
                    Thread.Sleep(5000);
                }
                else
                {
                    Console.WriteLine("Test fail");
                }
            }
        }
Beispiel #5
0
        internal void DeleteListing()
        {
            GlobalDefinitions.wait(20);
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Manage List");
            //Click on Manage Listings Link
            ManageListingsLink.Click();
            Thread.Sleep(5000);
            IList <IWebElement> noOfrows = driver.FindElements(By.XPath("//*[@id = 'listing-management-section']//table//tbody//tr"));
            int rows = noOfrows.Count;

            Thread.Sleep(5000);
            for (int y = 1; y <= rows; y++)
            {
                var titleName = driver.FindElement(By.XPath("//table[@class = 'ui striped table']//tr[" + y + "]//td[3]")).Text;

                var delete = driver.FindElement(By.XPath("//table[@class ='ui striped table']//tr[" + y + "]//td[8]//div//button[3]"));
                Thread.Sleep(5000);

                if (titleName == "Selenium WebDriver")
                {
                    //GlobalDefinitions.WaitForElement(driver, By.XPath("//table[@class ='ui striped table']//tr["+x+"]//td[8]//div//button[1]//i[1]"),10);
                    delete.Click();
                    Console.WriteLine("Delete clicked");
                    break;
                }
                else
                {
                    Console.WriteLine("Test fail");
                }
            }

            if (ExcelLib.ReadData(2, "Deleteaction") == "Yes")
            {
                YesDelete.Click();
                Console.WriteLine("Deleted");
            }
            else
            {
                DonotDelete.Click();
                Console.WriteLine("NotDeleted");
            }
        }
Beispiel #6
0
        public void Listings()
        {
            GlobalDefinitions.Wait();
            ManageListingsLink.Click();
            //Checking the right page
            Assert.AreEqual("ListingManagement", GlobalDefinitions.driver.Title);
            Base.test = Base.extent.StartTest("On Share Manage Listing page");
            edit.Click();
            //Populate the Excel Sheet
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            Title.SendKeys(ExcelLib.ReadData(3, "Title"));
            GenericMethods.CheckLength(4, 100, ExcelLib.ReadData(3, "Title"), "Title");
            Description.SendKeys(ExcelLib.ReadData(3, "Description"));
            GenericMethods.CheckLength(4, 600, ExcelLib.ReadData(3, "Description"), "Description");
            CategoryDropDown.SendKeys(ExcelLib.ReadData(3, "Category"));
            SubCategoryDropDown.SendKeys(ExcelLib.ReadData(3, "SubCategory"));

            TxtTags.SendKeys(ExcelLib.ReadData(3, "Tags"));
            TxtTags.SendKeys(Keys.Enter);
            IWebElement ServiceTypeOptions = GlobalDefinitions.driver.FindElement(By.XPath("//div[5]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            ServiceTypeOptions.Click();

            IWebElement LocationTypeOption = GlobalDefinitions.driver.FindElement(By.XPath("//div[6]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            LocationTypeOption.Click();

            StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Startdate"));
            EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "Enddate"));

            for (int i = 2; i < 9; i++)
            {
                for (int j = 2; j < 9; j++)
                {
                    IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input"));
                    IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input"));
                    if (i == 2 && j == 2)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[contains(@class,'twelve wide column')]//div[2]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0230PM");
                        StartTime.SendKeys(Keys.Tab);
                        EndTime.SendKeys("3052PM");
                    }
                    if (i == 3 && j == 3)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[3]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0530PM");
                        EndTime.SendKeys("0856PM");
                    }
                }
            }

            IWebElement credit = GlobalDefinitions.driver.FindElement(By.XPath("//div[8]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            if (!credit.Selected)
            {
                credit.Click();
                CreditAmount.SendKeys("9");
            }


            WorkSample.Click();

            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinWait("Open", "File Upload", 1);

            autoIt.WinActivate("Open", "File Upload");

            autoIt.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]");

            autoIt.Send(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..")) + "\\Test.txt");                                 //autoIt

            autoIt.Send("{ENTER}");
            autoIt.Sleep(1000);

            IWebElement ActiveOption = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']"));

            ActiveOption.Click();
            GlobalDefinitions.Wait();
            Save.Click();
            GlobalDefinitions.Wait();
            Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills edited succesfully");
            string searchInput1 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[2]")).Text;

            Assert.AreEqual(searchInput1, ExcelLib.ReadData(3, "Category"));
            string searchInput2 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[3]")).Text;

            Assert.AreEqual(searchInput2, ExcelLib.ReadData(3, "Title"));
            string searchInput3 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[5]")).Text;

            Assert.AreEqual(searchInput3, ExcelLib.ReadData(3, "ServiceType"));
        }