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(); } } } }
public void BeforeScenario() { TestLogger.CurrentTextWriter = TestContext.Progress; AppiumManager.ResetApp(); }
public static void AfterTestRun() { AppiumManager.CloseDriver(); AppiumServer.StopLocalService(); AppiumServer.OutputDataReceived -= OnOutputDataReceived; }