microsoft / microsoft/playwright-dotnet

[Feature]: Subtype `PlaywrightException` in the case of failing assertions

Open
#2,940 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3-collecting-feedback
Dominant language
C#
Stars
3k
Forks
304
Avg merge
20h 47m
Merged PRs (30d)
6

Description

🚀 Feature Request

Playwright exceptions that come from Expects would be be subtyped.

public sealed class PlaywrightAssertionException : PlaywrightException
{
    public PlaywrightAssertionException()
    {
    }

    public PlaywrightAssertionException(string message) : base(message)
    {
    }

    public PlaywrightAssertionException(string message, Exception innerException) : base(message, innerException)
    {
    }
Example

No response

Motivation

I am following the guidance of `Expect'- first assertions and migrating away from NUnit assertions in the process. However, it was useful to me to know when a test failed because of an assertion exception, or when the test was was improperly crafted.

I am happy to implement this feature myself.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin at the .NET Expect assertion implementation, locating where assertion failures currently throw PlaywrightException, and inspect nearby tests. Use the proposed PlaywrightAssertionException constructors as the API reference. Done means failing Expect assertions expose the subtype while the existing exception behavior remains covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.