/// <summary>
        /// Builds the path of the file without the extension.
        /// </summary>
        /// <param name="screenshotInfo">The screenshot information.</param>
        /// <returns>The file path without the extension.</returns>
        protected override string BuildFilePath(ScreenshotInfo screenshotInfo)
        {
            if (FilePathBuilder != null)
            {
                return(FilePathBuilder(screenshotInfo).SanitizeForPath());
            }
            else if (!string.IsNullOrWhiteSpace(FilePath))
            {
                return(FormatPath(FilePath, screenshotInfo).SanitizeForPath());
            }

            string folderPath = FolderPathBuilder?.Invoke()
                                ?? (!string.IsNullOrWhiteSpace(FolderPath)
                    ? FormatPath(FolderPath, screenshotInfo)
                    : $@"Logs\{AtataContext.BuildStart.Value.ToString(DefaultDateTimeFormat)}\{AtataContext.Current.TestName}");

            folderPath = folderPath.SanitizeForPath();

            string fileName = FileNameBuilder?.Invoke(screenshotInfo)
                              ?? (!string.IsNullOrWhiteSpace(FileName)
                    ? FormatPath(FileName, screenshotInfo)
                    : $"{screenshotInfo.Number:D2} - {screenshotInfo.PageObjectFullName}{screenshotInfo.Title?.Prepend(" - ")}");

            fileName = fileName.SanitizeForFileName();

            return(Path.Combine(folderPath, fileName));
        }
        /// <summary>
        /// Builds the path of the file without the extension.
        /// </summary>
        /// <param name="screenshotInfo">The screenshot information.</param>
        /// <returns>The file path without the extension.</returns>
        protected override string BuildFilePath(ScreenshotInfo screenshotInfo)
        {
            if (FilePathBuilder != null)
            {
                return(FilePathBuilder(screenshotInfo).SanitizeForPath());
            }
            else if (!string.IsNullOrWhiteSpace(FilePath))
            {
                return(FormatPath(FilePath, screenshotInfo).SanitizeForPath());
            }

            string folderPath = FolderPathBuilder?.Invoke()
                                ?? (!string.IsNullOrWhiteSpace(FolderPath)
                    ? FormatPath(FolderPath, screenshotInfo)
                    : BuildDefaultFolderPath());

            folderPath = folderPath.SanitizeForPath();

            string fileName = FileNameBuilder?.Invoke(screenshotInfo)
                              ?? (!string.IsNullOrWhiteSpace(FileName)
                    ? FormatPath(FileName, screenshotInfo)
                    : $"{screenshotInfo.Number:D2} - {screenshotInfo.PageObjectFullName}{screenshotInfo.Title?.Prepend(" - ")}");

            fileName = fileName.SanitizeForFileName();

            return(Path.Combine(folderPath, fileName));
        }
Beispiel #3
0
        /// <summary>
        /// Builds the path of the file without the extension.
        /// </summary>
        /// <param name="screenshotInfo">The screenshot information.</param>
        /// <returns>The file path without the extension.</returns>
        protected override string BuildFilePath(ScreenshotInfo screenshotInfo)
        {
            if (FilePathBuilder != null)
            {
                return(FilePathBuilder(screenshotInfo).SanitizeForPath());
            }
            else if (!string.IsNullOrWhiteSpace(FilePath))
            {
                return(FormatPath(FilePath, screenshotInfo).SanitizeForPath());
            }

            string folderPath = FolderPathBuilder?.Invoke()
                                ?? (!string.IsNullOrWhiteSpace(FolderPath)
                    ? FormatPath(FolderPath, screenshotInfo)
                    : BuildDefaultFolderPath());

            folderPath = folderPath.SanitizeForPath();

            string fileName = FileNameBuilder?.Invoke(screenshotInfo)
                              ?? (!string.IsNullOrWhiteSpace(FileName)
                    ? FormatPath(FileName, screenshotInfo)
                    : BuildDefaultFileName(screenshotInfo));

            fileName = fileName.SanitizeForFileName();

            return(Path.Combine(folderPath, fileName));
        }
Beispiel #4
0
        /// <summary>
        /// Builds the path of the file without the extension.
        /// </summary>
        /// <param name="screenshotInfo">The screenshot information.</param>
        /// <returns>The file path without the extension.</returns>
        protected override string BuildFilePath(ScreenshotInfo screenshotInfo)
        {
            if (FilePathBuilder != null)
            {
                return(FilePathBuilder(screenshotInfo));
            }

            string folderPath = FolderPathBuilder?.Invoke()
                                ?? $@"Logs\{AtataContext.BuildStart:yyyy-MM-dd HH_mm_ss}\{AtataContext.Current.TestName}";

            folderPath = folderPath.SanitizeForPath();

            string fileName = FileNameBuilder?.Invoke(screenshotInfo)
                              ?? $"{screenshotInfo.Number:D2} - {screenshotInfo.PageObjectFullName}{screenshotInfo.Title?.Prepend(" - ")}";

            fileName = fileName.SanitizeForFileName();

            return(Path.Combine(folderPath, fileName));
        }
        private string BuildFilePath()
        {
            AtataContext context = AtataContext.Current;

            if (FilePathBuilder != null)
            {
                return(FilePathBuilder.Invoke(context).SanitizeForPath());
            }

            string folderPath = FolderPathBuilder?.Invoke(context)
                                ?? BuildDefaultFolderPath();

            folderPath = folderPath.SanitizeForPath();

            string fileName = FileNameBuilder?.Invoke(context)
                              ?? BuildDefaultFileName(context);

            fileName = fileName.SanitizeForFileName();

            return(Path.Combine(folderPath, fileName));
        }