internal void SkillBtn()
        {
            //Check share skill button is present or not

            try
            {
                //Check ShareSkill button is displayed
                if (ShareSkillBtn.Displayed)
                {
                    //Click on  ShareSkill button
                    ShareSkillBtn.Click();
                    //Check whether navigated to Share Skill page
                    GlobalDefinitions.wait(2);

                    //Assert.That(driver.FindElement(By.XPath("//div[@id='service-listing-section']/div[2]/div/form/div/div/div/h3")).Displayed);

                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Navigated to share skill page ");
                    string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Navigated to share skill page");
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath));

                    SkillsSharePage skillPage = new SkillsSharePage();
                    skillPage.AddNewSkill();
                }
                else
                {
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "could not Navigated to share skill page ");
                    string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "could not Navigated to share skill page");
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath));
                }
            }
            catch (Exception e)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Could not Navigated to share skill page " + e.Message);
                string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Could not Navigated to share skill page");
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath));
            }
        }
Example #2
0
        internal void ViewListing()
        {
            try
            {
                //Clicking on Management Listing Tab
                MgmtListTab.Click();

                //Populating the test data from Excelsheet
                ExcelLib.PopulateInCollection(Base.ExcelPath, "EditListing");
                string SkillSelected = ExcelLib.ReadData(2, "Title");

                //Assigning the XPath of the whole table
                string TableRow = "//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr";

                //Gathering all elements of the table
                var listrows = Global.GlobalDefinitions.driver.FindElements(By.XPath(TableRow));
                foreach (var Row in listrows)

                {
                    // "td[3]" is the third column, Title, in the table. It should match the value in Excelsheet
                    if (Row.FindElement(By.XPath("td[3]")).Text.Equals(SkillSelected))
                    {
                        Thread.Sleep(2000);
                        //When the title matches the value in the Excelsheet then click on the "View Icon" for that particular title.
                        Row.FindElement(By.XPath("td[8]/i[1]")).Click();

                        Base.test.Log(LogStatus.Pass, "A listing is viewable");
                    }
                    else
                    {
                        ShareSkillBtn.Click();
                        //Thread.Sleep(1000);
                        Base.test.Log(LogStatus.Fail, "A listing is  not viewable");
                        SkillsSharePage skillsSharePage = new SkillsSharePage();
                        skillsSharePage.AddNewSkill();
                    }


                    //Verification
                    Thread.Sleep(2000);
                    string ActualValue = Global.GlobalDefinitions.driver.FindElement(By.XPath("//span[@class='skill-title']")).Text;

                    if (SkillSelected.Trim().Equals(ActualValue.Trim()))
                    {
                        Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "A listing cannot be viewed ");
                        string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "A listing is not viewable");
                        Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath));
                    }
                    else
                    {
                        Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "A listing cannot be viewed ");
                        string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "A listing is not viewable");
                        Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath));
                    }
                }
            }

            catch (Exception e)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "A listing cannot be viewed " + e.Message);
                string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "A listing is not viewable");
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath));
            }
        }