コード例 #1
0
 public static void AfterFeature()
 {
     ClassDriver.GetInstance().QuitDriver();
 }
コード例 #2
0
 public static void BeforeFeature(FeatureInfo featureInfo)
 {
     ClassDriver.GetInstance().StartDriver();
 }
コード例 #3
0
 public void FormControls()
 {
     PageFactory.InitElements(ClassDriver.GetInstance().Driver, this);
 }
コード例 #4
0
        public static void BeforeFeature(FeatureInfo featureInfo)
        {
            string typeBrowser = featureInfo.Title.Contains("-") ? featureInfo.Title.Split('-')[0] : null;

            ClassDriver.GetInstance().StartDriver(typeBrowser);
        }
コード例 #5
0
        public static void AfterStep()
        {
            string errorImage = ClassUtilities.PegarDataHora();
            var    stepType   = ScenarioStepContext.Current.StepInfo.StepDefinitionType.ToString();

            if (ScenarioContext.Current.ScenarioExecutionStatus.ToString() == "StepDefinitionPending")
            {
                if (stepType == "Given")
                {
                    scenario.CreateNode <Given>(ScenarioStepContext.Current.StepInfo.Text).Skip("Step pendente");
                }
                else if (stepType == "When")
                {
                    scenario.CreateNode <When>(ScenarioStepContext.Current.StepInfo.Text).Skip("Step pendente");
                }
                else if (stepType == "Then")
                {
                    scenario.CreateNode <Then>(ScenarioStepContext.Current.StepInfo.Text).Skip("Step pendente");
                }
            }
            else
            {
                if (ScenarioContext.Current.TestError == null)
                {
                    if (stepType == "Given")
                    {
                        scenario.CreateNode <Given>(ScenarioStepContext.Current.StepInfo.Text);
                    }
                    else if (stepType == "When")
                    {
                        scenario.CreateNode <When>(ScenarioStepContext.Current.StepInfo.Text);
                    }
                    else if (stepType == "Then")
                    {
                        scenario.CreateNode <Then>(ScenarioStepContext.Current.StepInfo.Text);
                    }
                    else if (stepType == "And")
                    {
                        scenario.CreateNode <And>(ScenarioStepContext.Current.StepInfo.Text);
                    }
                }
                else if (ScenarioContext.Current.TestError != null)
                {
                    if (stepType == "Given")
                    {
                        scenario.CreateNode <Given>(ScenarioStepContext.Current.StepInfo.Text).Fail(ScenarioContext.Current.TestError.Message)
                        .Fail("<br/>Screenshot <br/><br/>", MediaEntityBuilder.CreateScreenCaptureFromPath(GetScreenShot.Capture(ClassDriver.GetInstance().Driver, errorImage)).Build());
                    }
                    else if (stepType == "When")
                    {
                        scenario.CreateNode <When>(ScenarioStepContext.Current.StepInfo.Text).Fail(ScenarioContext.Current.TestError.Message)
                        .Fail("<br/>Screenshot <br/><br/>", MediaEntityBuilder.CreateScreenCaptureFromPath(GetScreenShot.Capture(ClassDriver.GetInstance().Driver, errorImage)).Build());
                    }
                    else if (stepType == "Then")
                    {
                        scenario.CreateNode <Then>(ScenarioStepContext.Current.StepInfo.Text).Fail(ScenarioContext.Current.TestError.Message)
                        .Fail("<br/>Screenshot <br/><br/>", MediaEntityBuilder.CreateScreenCaptureFromPath(GetScreenShot.Capture(ClassDriver.GetInstance().Driver, errorImage)).Build());
                    }
                }
            }
        }