Example #1
0
        protected string GetTestResultsPathWithTestName(bool createFolder)
        {
            string retString = CurrentTestMethodName.Replace(TestBaseNamespace, "").Replace(".", @"\").SanitisePath();

            /* need to sanitise the path before passing in to OutputPath method as it combines the paths
             * and throws an exception if illegal characters exist when combining paths.
             */
            retString = ExecutionSettings.OutputPath(
                $@"{TestResultsBaseFolder}\{retString}\{DateTime.Now.ToString("yyyyMMdd")}\{DateTime.Now.ToString(
                    "HHmmss")}", createFolder);

            return(retString.SanitisePath());
        }
Example #2
0
        private void TakeScreenshot(string overlayText, StoryScreenshotType screenshotType)
        {
            string rootPath = ExecutionSettings.OutputPath(
                $@"StoryAcceptance\{_storyId}\{DateTime.Now.ToString("yyyyMMdd_HHmmss")}", true);

            string fileName = GetScreenshotFileName();

            string fullSavePath = Path.Combine(rootPath, fileName);

            Screenshot screenshot = _session.DriverSession.Driver.TakeScreenshot();

            if (screenshot.PersistScreenshot(fullSavePath))
            {
                if (!string.IsNullOrWhiteSpace(overlayText))
                {
                    GenerateOverlayBlock(fullSavePath, overlayText, screenshotType);
                    //Utility.Imaging.ImagingUtilities.OverlayTextOntoImage(fullSavePath, overlayText, true);
                }
            }

            _screenshots.Add(fileName);
        }