internal void DeleteShareSkill(string CategoryToFind, string TitleToFind, string DescriptionToFind)
        {
            GenericWait.ElementIsVisible(GlobalDefinitions.driver, "LinkText", "Manage Listings", 8);

            //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.LinkText("Manage Listings"), 10);
            manageListingsLink.Click();

            Thread.Sleep(2000);
            //Loop for searching the record through the pages
            for (int i = 0; i < paginationButtons.Count - 2; i++)
            {
                Thread.Sleep(2000);

                foreach (IWebElement listingRecord in tableRows)

                {
                    string Category    = listingRecord.FindElement(By.XPath("td[2]")).Text;
                    string Title       = listingRecord.FindElement(By.XPath("td[3]")).Text;
                    string Description = listingRecord.FindElement(By.XPath("td[4]")).Text;

                    //Comparing Category,title,description to find out corresponding delete button and deleting item
                    if (Category.ToLower() == CategoryToFind.ToLower() && Title.ToLower() == TitleToFind.ToLower() && Description.ToLower().Contains(TitleToFind.ToLower()))
                    {
                        int rowToBeDeleted = tableRows.IndexOf(listingRecord) + 1;
                        Thread.Sleep(3000);
                        listingRecord.FindElement(By.XPath("//tr[" + rowToBeDeleted + "]/td[8]/div/button[3]/i")).Click();

                        Thread.Sleep(3000);
                        //Clicking on "Yes" button from the delete popup
                        deletePopupYesButton.Click();

                        //Validating deleted share skill
                        ManageListings manageListings = new ManageListings();
                        int            MatchingRecordFoundAfterAdding = manageListings.SearchListings(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "Title"), GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

                        try
                        {
                            if (MatchingRecordFoundAfterAdding < 1)
                            {
                                Base.test.Log(LogStatus.Pass, "Share Skill deleted successfully");
                                Assert.IsTrue(true);
                            }
                            else
                            {
                                Base.test.Log(LogStatus.Fail, "Share Skill deletion is unsuccessful" + " " + "Screenshot Image " + GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "ShareSkillScreenshot"));
                            }
                        }
                        catch (Exception e)
                        {
                            Base.test.Log(LogStatus.Fail, "Share Skill deletion is unsuccessful", e.Message);
                        }
                        return;
                    }
                }
                if (nextButton.Enabled == true)
                {
                    nextButton.Click();
                }
            }
        }
Пример #2
0
        //Add Share skill
        internal void AddShareSkill()
        {
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathShareSkill, "ShareSkill");

            //Call NavigateToManageListing Method to navigate to Manage Listing Page
            ManageListings manageListings = new ManageListings();

            manageListings.NavigateToManageListing();

            //Call SearchListings Method to get count for existing records with same category,title and description as we are going to add
            int MatchingRecordsBeforeAdd = manageListings.SearchListings(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "Title"), GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            //Click Share Skill Button
            ClickShareSkillButton();

            //Call EnterShareSkillData Method to enter Share Skill data
            EnterShareSkillData();

            //Call ValidateShareSkillData Method to Validate entered Share Skill data
            ValidateShareSkillData();

            //Save Share Skill
            SaveShareSkill();

            //Call SearchListings Method to get count for records with same category,title and description as we added
            int MatchingRecordsAfterAdd = manageListings.SearchListings(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "Title"), GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            //checking if number of records with same category,title and description is 1 more than it has before
            int ExpectedRecords = MatchingRecordsBeforeAdd + 1;

            GlobalDefinitions.ValidateBoolean(ExpectedRecords == MatchingRecordsAfterAdd, "Share Skill Added");
        }
Пример #3
0
        internal void AddShareSkill()
        {
            //Clicking on Share Skill Button
            ClickShareSkillButton();

            //Calling EnterShareSkill Method to enter Share Skill data
            EnterShareSkill();

            //Validating added share skill
            ManageListings manageListings = new ManageListings();
            int            MatchingRecordFoundAfterAdding = manageListings.SearchListings(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "Title"), GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            try
            {
                if (MatchingRecordFoundAfterAdding > 0)
                {
                    Base.test.Log(LogStatus.Pass, "Added a Share Skill Successfully");
                    Assert.IsTrue(true);
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Adding a Share Skill is unsuccessful" + " " + "Screenshot Image " + GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "ShareSkillScreenshot"));
                }
            }
            catch (Exception e)
            {
                Base.test.Log(LogStatus.Fail, "Adding a Share Skill is unsuccessful", e.Message);
            }
        }
Пример #4
0
 internal void DeleteShareSkill()
 {
     try
     {
         //Click on Manage Listings
         ManageListings.Click();
         GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ManageListingExcelPath, "ManageListings");
         string FirstPath  = "//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[";
         string SecondPath = "]/td[3]";
         string getTitle   = null;
         bool   flag       = false;
         int    temp       = 0;
         while (true)
         {
             for (int rownum = 1; rownum <= (Totalrows.Count); rownum++)
             {
                 getTitle = GlobalDefinitions.driver.FindElement(By.XPath(FirstPath + rownum + SecondPath)).Text;
                 temp     = 1;
                 if (getTitle == GlobalDefinitions.ExcelLib.ReadData(2, "Title"))
                 {
                     if (GlobalDefinitions.ExcelLib.ReadData(2, "Deleteaction") == "Yes")
                     {
                         //Click on Delete
                         GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + rownum + "]/td[8]/div/button[3]/i")).Click();
                         GlobalDefinitions.wait(10000);
                         Yes.Click();
                         GlobalDefinitions.wait(10000);
                         Assert.Pass("Record is successfully deleted");
                         flag = true;
                         return;
                     }
                     else
                     {
                         //Click on Delete
                         GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + rownum + "]/td[8]/div/button[3]/i")).Click();
                         GlobalDefinitions.wait(10000);
                         No.Click();
                         GlobalDefinitions.wait(10000);
                         Assert.Pass("There is matching record but it is not deleted");
                         flag = true;
                         return;
                     }
                 }
             }
             if (flag == false)
             {
                 NextPage.Click();
             }
             if (temp == 1)
             {
                 Assert.Pass("There is no matching record to delete");
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);;
     }
 }
Пример #5
0
 internal void EditShareSkill()
 {
     try
     {
         //Click on Manage Listings
         ManageListings.Click();
         //Populate the excel data
         GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
         string FirstPath  = "//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[";
         string SecondPath = "]/td[3]";
         string getTitle   = null;
         bool   flag       = false;
         int    temp       = 0;
         while (true)
         {
             for (int rownum = 1; rownum <= (Totalrows.Count); rownum++)
             {
                 getTitle = GlobalDefinitions.driver.FindElement(By.XPath(FirstPath + rownum + SecondPath)).Text;
                 temp     = 1;
                 if (getTitle == GlobalDefinitions.ExcelLib.ReadData(2, "Title"))
                 {
                     //Click on Edit button
                     GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + rownum + "]/td[8]/div/button[2]/i")).Click();
                     GlobalDefinitions.wait(7000);
                     //Clear the title and description
                     Title.Clear();
                     //Edit the title and Description
                     Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Edittitle"));
                     Description.Clear();
                     Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Editdescription"));
                     GlobalDefinitions.wait(6000);
                     Save.Click();
                     GlobalDefinitions.wait(7000);
                     flag = true;
                     Assert.Pass("Successfully Updated");
                     return;
                 }
             }
             if (flag == false)
             {
                 NextPage.Click();
             }
             if (temp == 1)
             {
                 Assert.Pass("There is no matching record to edit");
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Пример #6
0
        internal void AddShareSkill()
        {
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathShareSkill, "ShareSkill");

            //Call NavigateToManageListing Method to navigate to Manage Listing Page
            ManageListings manageListings = new ManageListings();

            manageListings.NavigateToManageListing();

            //Call SearchListings Method to get count for existing records with same category,title and description as we are going to add
            int MatchingRecordsBeforeAdd = manageListings.SearchListings(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "Title"), GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            //Click Share Skill Button
            ClickShareSkillButton();

            //Call EnterShareSkillData Method to enter Share Skill data
            EnterShareSkillData();

            //Call ValidateShareSkillData Method to Validate entered Share Skill data
            ValidateShareSkillData();

            //Call SaveShareSkill Method to save the Share Skill
            String img = SaveShareSkill();

            //Call SearchListings Method to get count for records with same category,title and description as we added
            int MatchingRecordsAfterAdd = manageListings.SearchListings(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "Title"), GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            Console.WriteLine("MatchingRecordsBeforeAdd== {0}", MatchingRecordsBeforeAdd);
            Console.WriteLine("MatchingRecordsAfterAdd =={0}", MatchingRecordsAfterAdd);

            //checking if number of records with same category,title and description is 1 more than it has before
            int ExpectedRecords = MatchingRecordsBeforeAdd + 1;

            try
            {
                if (ExpectedRecords == MatchingRecordsAfterAdd)
                {
                    Base.test.Log(LogStatus.Pass, "Test Passed, Added a Share Skill Successfully");
                    Base.test.Log(LogStatus.Pass, "Image-" + img);
                    Assert.IsTrue(true);
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Test Failed, Added a Share Skill Successfully" + img);
                }
            }
            catch (Exception e)
            {
                Base.test.Log(LogStatus.Fail, "Test Failed, Added a Share Skill Successfully", e.Message);
            }
        }
Пример #7
0
        public void SanityTest()
        {
            // Create an class and object to call the method
            Profile obj = new Profile();

            //Click on Edit button
            obj.AvailabilityTimeEdit.Click();

            //Availability Hours Edit
            obj.AvailabilityHoursEdit.Click();

            //Salary
            obj.SalaryEdit.Click();

            //Click on Add New Language button
            //obj.LanBtn.Click();

            //Click on Skill Button
            obj.SkillBtn.Click();

            //Click on Education Tab
            obj.EduBtn.Click();

            //Click on Certificates Tab
            obj.CertiBtn.Click();


            // Create an class and object to call the method
            ManageListings obj1 = new ManageListings();

            //Click on Manage Listings
            obj1.manageListingsLink.Click();


            // Create an class and object to call the method
            ShareSkill obj2 = new ShareSkill();

            //Click on Manage Listings
            obj2.ShareSkillButton.Click();
        }
Пример #8
0
        //Validating added share skill
        internal void ValidatingAddedShareSkill()
        {
            Thread.Sleep(2000);
            ManageListings manageListings = new ManageListings();
            int            MatchingRecordFoundAfterAdding = manageListings.SearchListings(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "Title"), GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            try
            {
                if (MatchingRecordFoundAfterAdding > 0)
                {
                    Base.test.Log(LogStatus.Pass, "Added a Share Skill Successfully");
                    Assert.IsTrue(true);
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Adding a Share Skill is unsuccessful" + " " + "Screenshot Image " + GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "ShareSkillScreenshot"));
                }
            }
            catch (Exception e)
            {
                Base.test.Log(LogStatus.Fail, "Adding a Share Skill is unsuccessful", e.Message);
            }
        }