Verify.HeadlessBrowsers icon indicating copy to clipboard operation
Verify.HeadlessBrowsers copied to clipboard

Configure HTML or Screenshot and give the user the choice what to Verify

Open infinitejest69 opened this issue 8 months ago • 2 comments

Is the feature request related to a problem

I don't need the HTML content part of the Verify, as we can run on multiple environments and use Angular it means i would either have to add Mutiple scrubbers or hassle with dealing with the HTML when i am only interesting in the screenshot comparison for lLocator and IPage

Describe the solution

Either Set something in the VerifierSettings class that makes the HTML adding to the list optional. or maybe extend that class to partial so we can override that method while still taking use of the other methods like removing style

Describe alternatives considered

not using Verify headless with C# playwright and just using a TS version of playwright for just visual testing which doubles work and code just to allow visual testing

Additional context

i Think an optional bool in the verification or on the method it self ? for both screenshot and HTML to cater for those who might only want HTML ?

 public static void Initialize(bool installPlaywright = false, bool HTML = true, bool Screenshot = true)

Then a simple check when building the list?

            List<Target> targets = new();

            if (HTML) {
                var html = await page.ContentAsync();
                targets.Add(new("html", html));
                }
            if (Screenshot) {
                targets.Add(new(imageType, new MemoryStream(await bytes)));
                }
            if (!HTML && !Screenshot) { throw new Exception(""); }
            return targets;

infinitejest69 avatar Mar 24 '25 10:03 infinitejest69

happy to consider a pull request

SimonCropp avatar Mar 26 '25 09:03 SimonCropp

I have already this in my custom implementation, and have in my personal todo list to prepare it also here, especially html optional :) but maybe @infinitejest69 can implement that, if no i will later

zdmta avatar Mar 26 '25 10:03 zdmta