public void ThenIshouldberedirectedtoselectaccountpage()
        {
            try
            {
                AccountSystemObject = new AccountSystem(TestSuit.webdriver);

                Thread.Sleep(3000);

                TestSuit.TakeScreenShot("Pass");

                if (AccountSystemObject.SelectAccountLabel.Displayed)
                {
                    TestSuit.pass++;

                    ExtentReport.test = ExtentReport.extent.StartTest("Account and System Selection");
                    ExtentReport.PrintExtentReport(LogStatus.Pass, "\"Select an Account\" page is displaying", "Pass");
                }
                else
                {
                    TestSuit.fail++;
                    ExtentReport.PrintExtentReport(LogStatus.Fail, "\"Select an Account\" page is not displaying", "Fail");
                }
            }
            catch (Exception Ex)
            {
                TestSuit.TakeScreenShot("Fail");
                TestSuit.fail++;
                logger.WriteLog(Ex);
                ExtentReport.EndReport();
                SendEmail.email_send(ExtentReport.reportPath, logger.ErrorLogFilePath, TestSuit.SystemMachineName, TestSuit.MailCollection, TestSuit.ProjectName);
                TestSuit.webdriver.Quit();
            }
        }
示例#2
0
        public void AfterTest()
        {
            var status     = TestContext.CurrentContext.Result.Outcome.Status;
            var stacktrace = string.IsNullOrEmpty(TestContext.CurrentContext.Result.StackTrace)
                    ? ""
                    : string.Format("{0}", TestContext.CurrentContext.Result.StackTrace);
            Status logstatus;

            switch (status)
            {
            case TestStatus.Failed:
                logstatus = Status.Fail;
                DateTime time           = DateTime.Now;
                string   fileName       = "Screenshot_" + time.ToString("h_mm_ss") + ".png";
                string   screenShotPath = ExtentReport.Capture(_driver, fileName);
                ExtentReport.test.Log(Status.Fail, "Fail");
                ExtentReport.test.Log(Status.Fail, "Snapshot below: " + ExtentReport.test.AddScreenCaptureFromPath("Screenshots\\" + fileName));
                break;

            case TestStatus.Inconclusive:
                logstatus = Status.Warning;
                break;

            case TestStatus.Skipped:
                logstatus = Status.Skip;
                break;

            default:
                logstatus = Status.Pass;
                break;
            }

            ExtentReport.test.Log(logstatus, "Test ended with " + logstatus + stacktrace);
            _driver.Quit();
        }
        public void GivenThatIamonOHSConnectWebsite()
        {
            try
            {
                ExtentReport ExRepo = new ExtentReport();

                //Open Browser
                TestSuit.OpenBrowser();

                //Open Website
                TestSuit.OpenURL();

                LoginObject = new LoginPage(TestSuit.webdriver);
                ExtentReport.PrintExtentReport(LogStatus.Pass, "OHS Connect Website Open", "Pass");
            }
            catch (Exception Ex)
            {
                TestSuit.TakeScreenShot("Fail");
                TestSuit.fail++;
                logger.WriteLog(Ex);
                ExtentReport.EndReport();
                SendEmail.email_send(ExtentReport.reportPath, logger.ErrorLogFilePath, TestSuit.SystemMachineName, TestSuit.MailCollection, TestSuit.ProjectName);
                TestSuit.webdriver.Quit();
            }
        }
示例#4
0
 public void TC02LaunchEMail()
 {
     try
     {
         ExtentReport.StartReport("Verify that the user is able to Login to Gmail and launching specific searched Email", "Verify that the user is able to Login to Gmail and launching specific searched Email");
         result = LogIn(ExcelDriver.GetTestData("Login:0", "TestData1"), ExcelDriver.GetTestData("Login:1", "TestData1")); AssertTest();
         // result = HomeBO.ClickGMailIcon();AssertTest();
         result = HomeBO.VerifyComposeButton(); AssertTest(); Report(RelevantCodes.ExtentReports.LogStatus.Pass, "Verified Home Page Loaded Successfully for Gmail");
         string EmailToBeSearched = ExcelDriver.GetTestData("EMailSubject", "TestData1");
         result = HomeBO.EnterSearchText(EmailToBeSearched); AssertTest(); Report(RelevantCodes.ExtentReports.LogStatus.Pass, "Entered Searched Text: " + EmailToBeSearched);
         result = HomeBO.PressEnter(); AssertTest(); Report(RelevantCodes.ExtentReports.LogStatus.Pass, "Pressed Enter");
         result = HomeBO.LaunchEMail(EmailToBeSearched); AssertTest(); Report(RelevantCodes.ExtentReports.LogStatus.Pass, "Email Launched");
     }
     catch (Exception e)
     {
         if (!string.IsNullOrEmpty(result.Screenpath))
         {
             ExtentReport.LogTestStepsWithScreen(RelevantCodes.ExtentReports.LogStatus.Fail, e.Message, result.Screenpath);
         }
         else
         {
             ExtentReport.LogTestSteps(RelevantCodes.ExtentReports.LogStatus.Fail, e.Message);
         }
     }
     finally
     {
         //jira update
     }
 }
示例#5
0
 public void AfterTestFixture()
 {
     //Flush the extent report
     ExtentReport.EndReport();
     //Close the browser
     driver.Close();
 }
        public void WhenIhaveenteredusernameandpassword()
        {
            try
            {
                TestSuit.Readdata.ProcessOnCollection(TestSuit.LoginCollection, "UserName");

                LoginObject.UserNameTextBox.Clear();
                LoginObject.UserNameTextBox.SendKeys(TestSuit.Readdata.ProcessOnCollection(TestSuit.LoginCollection, "UserName"));
                ExtentReport.PrintExtentReport(LogStatus.Pass, "Entered Valid User Name", "Pass");

                LoginObject.PasswordTextBox.SendKeys(TestSuit.Readdata.ProcessOnCollection(TestSuit.LoginCollection, "Password"));
                ExtentReport.PrintExtentReport(LogStatus.Pass, "Entered Valid Password", "Pass");

                TestSuit.TakeScreenShot("Pass");

                LoginObject.LoginButton.Click();
                ExtentReport.PrintExtentReport(LogStatus.Pass, "Login button Clicked", "Pass");

                //ExtentReport.GetResult();
            }
            catch (Exception Ex)
            {
                TestSuit.TakeScreenShot("Fail");
                TestSuit.fail++;
                logger.WriteLog(Ex);
                ExtentReport.EndReport();
                SendEmail.email_send(ExtentReport.reportPath, logger.ErrorLogFilePath, TestSuit.SystemMachineName, TestSuit.MailCollection, TestSuit.ProjectName);
                TestSuit.webdriver.Quit();
            }
        }
        public void GivenIAddNewIncident()
        {
            try
            {
                AddIncidentObjectObj = new AddIncidentObject(TestSuit.webdriver);

                TestSuit.WaitForElementToBeClickable(AddIncidentObjectObj.AddMenu, 10);

                AddIncidentObjectObj.AddMenu.Click();
                ExtentReport.test = ExtentReport.extent.StartTest("Add an Incident");
                ExtentReport.PrintExtentReport(LogStatus.Pass, "\"Add\" menu clicked", "Pass");

                TestSuit.TakeScreenShot("Pass");

                AddIncidentObjectObj.AddanIncidentMenu.Click();
                ExtentReport.PrintExtentReport(LogStatus.Pass, "\"Add an Incident\" menu clicked", "Pass");

                Thread.Sleep(8000);
            }
            catch (Exception Ex)
            {
                TestSuit.TakeScreenShot("Fail");
                logger.WriteLog(Ex);
                ExtentReport.EndReport();
                SendEmail.email_send(ExtentReport.reportPath, logger.ErrorLogFilePath, TestSuit.SystemMachineName, TestSuit.MailCollection, TestSuit.ProjectName);
                TestSuit.webdriver.Quit();
            }
        }
示例#8
0
        public static void TakeScreenShot(string ScrShtSts)
        {
            try
            {
                Thread.Sleep(2000);
                //Take the screen-shot
                Screenshot ScrShtImg = ((ITakesScreenshot)webdriver).GetScreenshot();

                if (ScrShtSts == "Pass")
                {
                    //Save the screen-shot
                    ScrShtImg.SaveAsFile(ConfigurationManager.AppSettings["ScreenShotPathPass"] + DateTime.Now.ToString("dd_MM_yyyy_HH_mm_ss") + ".png", ScreenshotImageFormat.Png);
                }
                else if (ScrShtSts == "Fail")
                {
                    //Save the screen-shot
                    ScrShtImg.SaveAsFile(ConfigurationManager.AppSettings["ScreenShotPathFail"] + DateTime.Now.ToString("dd_MM_yyyy_HH_mm_ss") + ".png", ScreenshotImageFormat.Png);
                }
                else
                {
                }
            }
            catch (Exception Ex)
            {
                logger.WriteLog(Ex);
                ExtentReport.EndReport();
                SendEmail.email_send(ExtentReport.reportPath, logger.ErrorLogFilePath, SystemMachineName, MailCollection, ProjectName);
                webdriver.Quit();
            }
        }
        public void ThenIncidentReportShouldBeSavedAndFinish()
        {
            try
            {
                AddIncidentObjectObj.SaveandFinishbtn.Click();
                ExtentReport.PrintExtentReport(LogStatus.Pass, "Clicked Save and Finish button successfully", "Pass");

                Thread.Sleep(5000);

                TestSuit.TakeScreenShot("Pass");

                AddIncidentObjectObj.HomeMenu.Click();
                ExtentReport.PrintExtentReport(LogStatus.Pass, "Home menu clicked successfully", "Pass");

                TestSuit.pass++;

                Thread.Sleep(5000);

                ExtentReport.EndReport();
                SendEmail.email_send(ExtentReport.reportPath, logger.ErrorLogFilePath, TestSuit.SystemMachineName, TestSuit.MailCollection, TestSuit.ProjectName);
                TestSuit.webdriver.Quit();
            }
            catch (Exception Ex)
            {
                TestSuit.TakeScreenShot("Fail");
                TestSuit.fail++;
                logger.WriteLog(Ex);
                ExtentReport.EndReport();
                SendEmail.email_send(ExtentReport.reportPath, logger.ErrorLogFilePath, TestSuit.SystemMachineName, TestSuit.MailCollection, TestSuit.ProjectName);
                TestSuit.webdriver.Quit();
            }
        }
示例#10
0
        public void ContextClick(IWebDriver driver)
        {
            try
            {
                Column_ContextClick.Columnselection_1(driver, 7, 2);

                Page_Object.Monitor mon = new Page_Object.Monitor(driver);
                Frame.Switch_to_Frames1(driver);
                mon.Format_Number.Click();
                Thread.Sleep(TimeSpan.FromSeconds(3));
                mon.Format_Number_Sign.Click();
                mon.Format_OKbtn.Click();

                ExtentReport.ReportLog(test, "Pass", "Successfully Formated", driver);
            }

            catch
            {
                ExtentReport.ReportLog(test, "Fail", "Formate Failed", driver);
            }

            //try
            //{
            Column_ContextClick.Columnselection_2(driver, 6, 3, 2, "sortAscEveryUpdate");

            ExtentReport.ReportLog(test, "Pass", "Successfully Sorted in Ascending Order", driver);
            //}

            //catch
            //{
            //  ExtentReport.ReportLog(test, "Fail", "Formate Failed", driver);
            //}

            ExtentReport.ReportStop(test);
        }
示例#11
0
文件: Hooks.cs 项目: peletin/Amazon
 public static void AfterScenario()
 {
     ExtentReport.LogStep("<br>===================================</br>");
     //get the count for script
     ExtentReport.counter          = ExtentReport.counter + 1;
     ScenarioContext.Current["id"] = ExtentReport.counter;
 }
示例#12
0
 public void TC01VerifyHomePage()
 {
     try
     {
         ExtentReport.StartReport("Verify that the user is able to Login to Gmail", "Verify that the user is able to Login to GMail and Verify home page loaded");
         result = LogIn(ExcelDriver.GetTestData("Login:0", "TestData1"), ExcelDriver.GetTestData("Login:1", "TestData1")); AssertTest();
         //result = HomeBO.ClickGMailIcon(); AssertTest();
         result = HomeBO.VerifyComposeButton(); AssertTest(); Report(RelevantCodes.ExtentReports.LogStatus.Pass, "Verified Home Page Loaded Successfully for Gmail");
         //we can add more controls for verification as an enhancement
     }
     catch (Exception e)
     {
         if (!string.IsNullOrEmpty(result.Screenpath))
         {
             ExtentReport.LogTestStepsWithScreen(RelevantCodes.ExtentReports.LogStatus.Fail, e.Message, result.Screenpath);
         }
         else
         {
             ExtentReport.LogTestSteps(RelevantCodes.ExtentReports.LogStatus.Fail, e.Message);
         }
     }
     finally
     {
         //we can add Jira updates
     }
 }
示例#13
0
 public void SetupTests()
 {
     report = new ExtentReport("Flipkart");
     report.StartReport();
     androidDriver = new DriverInitialization();
     commonMethods = new CommonMethods();
 }
示例#14
0
文件: Hooks.cs 项目: peletin/Amazon
 public static void BeforeScenario()
 {
     //Extent Report
     ScenarioContext.Current["id"] = ExtentReport.counter;
     Scenario = FeautureName.CreateNode <Scenario>(ScenarioContext.Current.ScenarioInfo.Title + "<br/>" + "Test Case: " + ScenarioContext.Current["id"] + "");
     //Add Scenario Title to EXternal Report
     ExtentReport.Log("Scenario: " + ScenarioContext.Current.ScenarioInfo.Title);
     //Add Test Case number to EXternal Report
     ExtentReport.Log("Test Case: " + ScenarioContext.Current["id"] + "");
 }
 public static void Initialize()
 {
     ExtentReportReq = bool.Parse(Configapp["Connection:ExtentReport"]);
     if (ExtentReportReq)
     {
         extent = ExtentReport.InitReport(Configapp["Connection:ExtentReportFolderName"]);
         path   = CommonUtility.DeleteOldFolders(Configapp["Connection:ScreenShotsFolderName"], Configapp["Connection:NumberOfDaysToKeepScreenShots"]);
         path   = CommonUtility.CreateFolder(path);
     }
 }
示例#16
0
        public static void OpenBrowser()
        {
            string browValue = Readdata.ProcessOnCollection(LoginCollection, "Browser");

            SystemOsversion   = System.Environment.OSVersion.ToString();
            SystemMachineName = System.Environment.MachineName;
            if (browValue != null)
            {
                switch (browValue)//BrowserName, BrowserVersion, BrowserPlatForm, SystemMachineName
                {
                case "Chrome":
                    webdriver = new ChromeDriver(Driverpath);
                    ICapabilities Chcapabilities = ((RemoteWebDriver)webdriver).Capabilities;
                    BrowserName     = Chcapabilities.BrowserName;
                    BrowserVersion  = Chcapabilities.Version;
                    BrowserPlatForm = Chcapabilities.Platform.ToString();

                    ExtentReport.test = ExtentReport.extent.StartTest("OHS Connect Login");
                    ExtentReport.PrintExtentReport(LogStatus.Pass, "\"Google Chrome Browser\" Opened", "Pass");

                    TakeScreenShot("Pass");
                    break;

                case "IE":
                    var optionsIE = new InternetExplorerOptions();
                    optionsIE.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                    webdriver = new InternetExplorerDriver(Driverpath, optionsIE);
                    ICapabilities IEcapabilities = ((RemoteWebDriver)webdriver).Capabilities;
                    BrowserName     = IEcapabilities.BrowserName;
                    BrowserVersion  = IEcapabilities.Version;
                    BrowserPlatForm = IEcapabilities.Platform.ToString();

                    ExtentReport.test = ExtentReport.extent.StartTest("OHS Connect Login");
                    ExtentReport.PrintExtentReport(LogStatus.Pass, "\"Internet Explorer Browser\" Opened", "Pass");

                    TestSuit.TakeScreenShot("Pass");
                    break;

                case "Firefox":
                    FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(TestSuit.Driverpath);
                    webdriver = new FirefoxDriver(service);
                    ICapabilities FFcapabilities = ((RemoteWebDriver)webdriver).Capabilities;
                    BrowserName     = FFcapabilities.BrowserName;
                    BrowserVersion  = FFcapabilities.Version;
                    BrowserPlatForm = FFcapabilities.Platform.ToString();

                    ExtentReport.test = ExtentReport.extent.StartTest("OHS Connect Login");
                    ExtentReport.PrintExtentReport(LogStatus.Pass, "\"Mozilla Firefox Browser\" Opened", "Pass");

                    TakeScreenShot("Pass");
                    break;
                }
            }
        }
        public static void InitializeSettings()
        {
            ConfigReader.SetConfigSetting();
            if (Settings.ExtentReportReq)
            {
                extent = ExtentReport.InitReport(Settings.ReportPath);

                CommonUtility.DeleteOldFolders(Settings.ReportPath, Settings.KeepExtentReportDays);
                new Utils().DeleteFilesFromFolder(Settings.ReportPath, numberOfDaysToKeepExtent);
            }
        }
示例#18
0
        public void verifyLoginpage()
        {
            ExtentReport.CExtentReport();
            ExtentReport.test = ExtentReport.extent.StartTest("Verify the Login Page");
            LoginPage login = new LoginPage(_driver);

            BaseMethods.verifyWebElement(login.EperformUserNameText, "Eperform UserName Text is not displayed in login page", "Eperform UserName Text is displayed in login page");
            BaseMethods.verifyWebElement(login.EperformPasswordText, "Eperform Password Text is not displayed in login page", "Eperform Password Text  is  displayed in login page");
            BaseMethods.verifyWebElement(login.EperformSubmitButton, "Eperform Submit Button is not displayed in login page", "Eperform Submit Button is  displayed in login page");
            BaseMethods.verifyWebElement(login.EperformForgotPasswordLink, "Eperform ForgotPassword Link is not displayed in login page", "Eperform ForgotPassword Link  is  displayed in login page");
        }
示例#19
0
        public void PreSetup()
        {
            executionStartTime      = DateTimeUtils.GetCurrentDateAndTime();
            currentWorkingDirectory = ConfigurationManager.AppSettings["currentWorkingDirectory"];

            extentReport = new ExtentReport($"{currentWorkingDirectory}/Reports/AmazonTestReport-{executionStartTime}.html");

            extentReport.CreateATestCase("Setup - Setting up the pre-requisites for the test cases");

            extentReport.AddTestLog(Status.Info, "Initializing chrome browser");
        }
 public void GenerateReport()
 {
     try
     {
         ExtentReport.flushReport();
     }
     catch (Exception E)
     {
         throw (E);
     }
 }
        public void GetResult()
        {
            var status       = TestContext.CurrentContext.Result.Outcome.Status;
            var stackTrace   = "<pre>" + TestContext.CurrentContext.Result.StackTrace + "</pre>";
            var errorMessage = TestContext.CurrentContext.Result.Message;

            if (status == TestStatus.Failed)
            {
                string screenShotPath = ExtentReport.Capture(_driver);
                ExtentReport.test.Log(LogStatus.Fail, stackTrace + errorMessage);
                ExtentReport.test.Log(LogStatus.Fail, "Please find the Screenshot below: " + ExtentReport.test.AddScreenCapture(screenShotPath));
            }
            ExtentReport.extent.EndTest(ExtentReport.test);
        }
 public void SetupReporting()
 {
     try
     {
         if (extent == null)
         {
             extent = ExtentReport.generateExtentReport();
         }
     }
     catch (Exception e)
     {
         throw (e);
     }
 }
示例#23
0
        public void loginEperformApplicaton()
        {
            ExtentReport.CExtentReport();
            ExtentReport.test = ExtentReport.extent.StartTest("Login to the Application");
            LoginPage login    = new LoginPage(_driver);
            ArrayList list     = BaseClass.GetData("ER_TESTDATA", "LoginTest", "KeyName", "Admin");
            string    username = list[1].ToString();
            string    pwd      = list[2].ToString();

            login.Login(username, pwd);
            login.EperformSystemAdministratorArrowDropDownIcon.Click();
            BaseMethods.verifyWebElement(login.EperformLogoutOption, "The Logout option is not displayed in the home page", "Logout option is displayed in the Home page");

            login.EperformLogoutOption.Click();
        }
示例#24
0
        public void verifyUsernamePasswordInvalidBlankErrorMessage()
        {
            ExtentReport.CExtentReport();
            ExtentReport.test = ExtentReport.extent.StartTest("Verify the Login Page");
            LoginPage login = new LoginPage(_driver);
            ArrayList list  = BaseClass.GetData("ER_TESTDATA", "LoginTest", "KeyName", "User3");

            login.EperformSubmitButton.Click();
            BaseMethods.verifyWebElement(login.EperfromUserNameBlankErrorMessageText, "The Username field is required. is not displayed in login page", "The Username field is required. is displayed in login page");
            BaseMethods.verifyWebElement(login.EperfromPasswordBlankErrorMessageText, "The Password field is required. is not displayed in login page", "he Password field is required. is displayed in login page");
            login.EPerformUserNameTextBox.SendKeys(list[1].ToString());
            login.EperformPasswordTextBox.SendKeys(list[2].ToString());
            login.EperformSubmitButton.Click();
            BaseMethods.verifyWebElement(login.EperfromUserNamePasswordInvalidText, "The username or password you entered is incorrect. Please check your details and try again. is not displayed in login page", "The username or password you entered is incorrect. Please check your details and try again. is displayed in login page");
        }
示例#25
0
        public void OneTimeSetUp()
        {
            newrunflag = Convert.ToBoolean(ConfigurationManager.AppSettings["NewTestRun"]);
            resultflag = Convert.ToBoolean(ConfigurationManager.AppSettings["ResultFlag"]);
            devicetype = TestEngine.DeviceType;
            XML.deletefile();
            ExtentReport.TestMethod1();

            if (newrunflag)
            {
                //Generate Run GUID
                runguid          = _dbresults.ExecuteTestRun(Env, Browser, "1").ToString();
                TestData.RunGuid = runguid;
            }
        }
        public void TC002_VerifyingEmptyEmployeeOracleID(string strmobiledevice)
        {
            starttime  = DateTime.Now;
            strMessage = string.Format("\r\n\t " + TestContext.CurrentContext.Test.Name + " Starts");

            try
            {
                _driver      = _testengine.TestSetup(strmobiledevice);
                _homescreen1 = new HomeScreen1(_driver, "NR");

                ResultDbHelper _resul = new ResultDbHelper();

                // enter FirstName
                //_homescreen1.EnterFirstName();

                bool attrvalueempID = _homescreen1.GetEmployeeIDFieldStyle();
                Assert.IsTrue(attrvalueempID);

                bool attrvaluefName = _homescreen1.GetFirstNameFieldStyle();
                Assert.IsTrue(attrvaluefName);

                bool attrvaluelName = _homescreen1.GetLastNameFieldStyle();
                Assert.IsTrue(attrvaluelName);

                bool attrvalueemail = _homescreen1.GetEmailFieldStyle();
                Assert.IsTrue(attrvalueemail);

                bool attrvaluephone = _homescreen1.GetPhoneFieldStyle();
                Assert.IsTrue(attrvaluephone);

                bool attrvaluereturnoption = _homescreen1.GetReturnOptionFieldStyle();
                Assert.IsTrue(attrvaluereturnoption);

                // click on Next button
                _homescreen1.ClickNextBtn();

                ExtentReport.ReportPass(TestContext.CurrentContext.Test.FullName);
            }
            catch (Exception ex)
            {
                strMessage += ex.Message;
                ExtentReport.ReportFail(ex.Message);
                _xml.FailureTests(TestContext.CurrentContext.Test.FullName);
                _xml.FailurePlaylist(TestContext.CurrentContext.Test.FullName);
                Assert.Fail(ex.Message);
            }
        }
示例#27
0
        public void OneTimeTearDown()
        {
            ExtentReport.Flush();
            ExtentReport.email_send();
            XML.append();

            if (newrunflag)
            {
                //Generate Run GUID
                _dbresults.UpdateEndTime(TestData.RunGuid.ToString());
            }

            if (resultflag)
            {
                _dbresults.UpdateScriptPassCount();
            }
        }
示例#28
0
 public static void WaitForElementToBeClickable(IWebElement WebElement, double span)
 {
     try
     {
         WebDriverWait wait = new WebDriverWait(TestSuit.webdriver, System.TimeSpan.FromSeconds(span));
         wait.PollingInterval.Add(System.TimeSpan.FromMilliseconds(5));
         wait.Until(ExpectedConditions.ElementToBeClickable(WebElement));
     }
     catch (Exception Ex)
     {
         TakeScreenShot("Fail");
         logger.WriteLog(Ex);
         ExtentReport.EndReport();
         SendEmail.email_send(ExtentReport.reportPath, logger.ErrorLogFilePath, SystemMachineName, MailCollection, ProjectName);
         webdriver.Quit();
     }
 }
        public void preSetup()
        {
            string workingDirectory = Environment.CurrentDirectory;

            currentWorkingDirectory = Directory.GetParent(workingDirectory).Parent.Parent.Parent.FullName;

            currentProjectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.FullName;

            _configuration = new ConfigurationBuilder()
                             .AddJsonFile(currentProjectDirectory + "/appSettings.json").Build();


            testExecutionStartTime = DateUtils.GetCurrentDateAndTime();

            reportFilename = $"{currentWorkingDirectory}/reports/Guru99Report.html";

            extentReport = new ExtentReport(reportFilename);
        }
        public void EndTest()
        {
            try
            {
                var status     = TestContext.CurrentContext.Result.Outcome.Status;
                var testMethod = TestContext.CurrentContext.Test.FullName;
                if (status == TestStatus.Failed)
                {
                    var errorMessage = TestContext.CurrentContext.Result.Message;
                    ExtentReport.addScreenshotToReport(status, errorMessage, testMethod);
                }

                Close();
            }
            catch (Exception e)
            {
                throw (e);
            }
        }