atata

Odd screenshot naming difference between linux and windows


Here are snippets from two different test logs.

Linux does this on a screenshot:

2022-01-07 19:34:02.6043 INFO - Screenshot saved to file "/source/fs.automation.fsol/FS.Automation.Tests/bin/Debug/net5.0/Logs/2022-01-07 19_33_47/CharityAKA/01 - "Charity Details FSOL" page - Test Failure.png"

Windows does this:

2021-12-17 22:49:29.5490 INFO - Screenshot saved to file "C:\BuildAgent\work\84629dc95880ab61\fs.automation.impactfully\FS.Automation.Tests\bin\Debug\net5.0\Logs\2021-12-17 22_48_13\ImportedCharityList\01 - Search Charities Impactfully Tab page - Test Failure.png"

Notice the double quotes in the file name in linux that are not there when running in windows - is thing something that can be made uniform between linux and windows?


Solution

  • Atata sanitizes the file names to be valid for current OS. Double quotes is invalid file name character in Windows, so they are removed there. But I agree that a name should be the same for both OS.

    The default screenshot file name format renders PageObjectFullName property, which looks like "Charity Details FSOL" page. But we can configure format to use {PageObjectName} {PageObjectTypeName} instead, which will render Charity Details FSOL page without quotes. You can reconfigure a screenshot file name format this way:

    AtataContext.GlobalConfiguration
        .AddScreenshotFileSaving()
            .WithFileName(screenshotInfo => $"{screenshotInfo.Number:D2} - {screenshotInfo.PageObjectName} {screenshotInfo.PageObjectTypeName}{screenshotInfo.Title?.Prepend(" - ")}");
    

    Or:

    AtataContext.GlobalConfiguration
        .AddScreenshotFileSaving()
            .WithFileName("{screenshot-number:D2} - {screenshot-pageobjectname} {screenshot-pageobjecttypename}{screenshot-title: - *}")
    

    By the way, I will apply such format as the default for Atata v2. Thanks for finding and reporting this issue.