Beispiel #1
0
        protected override void PreTestCleanup(object sender, PluginEventArgs e)
        {
            try
            {
                if (_isEnabled && e.TestOutcome == TestOutcome.Failed)
                {
                    var    screenshotSaveDir  = _screenshotOutputProvider.GetOutputFolder();
                    var    screenshotFileName = _screenshotOutputProvider.GetUniqueFileName(e.TestFullName);
                    string image     = _screenshotEngine.TakeScreenshot(e.Container);
                    string imagePath = Path.Combine(screenshotSaveDir, screenshotFileName);
                    File.WriteAllBytes(imagePath, Convert.FromBase64String(image));
                    _screenshotPluginProvider.ScreenshotGenerated(e, imagePath);
                }
            }
            catch
            {
                // Ignore since it is failing often because of bugs in Remote driver for Chrome
            }

            base.PreTestCleanup(sender, e);
        }
Beispiel #2
0
        protected override void PreAfterScenario(object sender, TestWorkflowPluginEventArgs e)
        {
            GetTestScreenshotOnFailMode(e.TestOutcome);

            try
            {
                if (ScreenshotWorkflowPluginContext.ShouldTakeScreenshot)
                {
                    var    screenshotSaveDir  = _screenshotOutputProvider.GetOutputFolder();
                    var    screenshotFileName = _screenshotOutputProvider.GetUniqueFileName(e.TestFullName);
                    string image     = _screenshotEngine.TakeScreenshot(e.Container);
                    string imagePath = Path.Combine(screenshotSaveDir, screenshotFileName);
                    File.WriteAllBytes(imagePath, Convert.FromBase64String(image));
                    _screenshotPluginProvider.ScreenshotGenerated(e, imagePath);
                }
            }
            catch (Exception ex)
            {
                // Ignore
            }
        }
Beispiel #3
0
        protected override void PreTestCleanup(object sender, TestWorkflowPluginEventArgs e)
        {
            GetTestScreenshotOnFailMode(e.TestMethodMemberInfo, e.TestOutcome);

            try
            {
                if (_shouldTakeScreenshot)
                {
                    var    screenshotSaveDir  = _screenshotOutputProvider.GetOutputFolder();
                    var    screenshotFileName = _screenshotOutputProvider.GetUniqueFileName(e.TestFullName);
                    string image     = _screenshotEngine.TakeScreenshot(e.Container);
                    string imagePath = Path.Combine(screenshotSaveDir, screenshotFileName);
                    File.WriteAllBytes(imagePath, Convert.FromBase64String(image));
                    _screenshotPluginProvider.ScreenshotGenerated(e, imagePath);
                }
            }
            catch (Exception ex)
            {
                // Ignore since it is failing often because of bugs in Remote driver for Chrome
            }

            base.PreTestCleanup(sender, e);
        }