Exemplo n.º 1
0
        public void AfterScenario()
        {
            if (CurrentScenarioContext.TestError != null)
            {
                try
                {
                    var screenshot = AppiumManager.Driver.GetScreenshot();
                    ScenarioScreenshots.Add(new ScenarioScreenshotInfo(CurrentScenarioContext.ScenarioInfo.Title, screenshot.AsBase64EncodedString));

                    string screenshotPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, $"{TestContext.CurrentContext.Test.Name}.png");
                    File.WriteAllBytes(screenshotPath, screenshot.AsByteArray);

                    TestContext.AddTestAttachment(screenshotPath);
                }
                catch
                {
                    if (AppiumManager.Platform == PlatformEnum.IOS)
                    {
                        AppiumManager.CreateDriver();
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void BeforeScenario()
        {
            TestLogger.CurrentTextWriter = TestContext.Progress;

            AppiumManager.ResetApp();
        }
Exemplo n.º 3
0
 public static void AfterTestRun()
 {
     AppiumManager.CloseDriver();
     AppiumServer.StopLocalService();
     AppiumServer.OutputDataReceived -= OnOutputDataReceived;
 }