microsoft / microsoft/playwright-dotnet

[Feature]: Represent ToHaveJSPropertyAsync for JS value undefined

Open
#3,299 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

🚀 Feature Request

Would like to be able to assert that an element has a property with JS value undefined using ToHaveJSPropertyAsync. It's not clear from documentation or tests in playwright-dotnet how that is done:

https://github.com/microsoft/playwright-dotnet/blob/9dd8feeae24be5be9aff9f53b835dd89790ddcb0/src/Playwright.Tests/Assertions/LocatorAssertionsTests.cs#L600-L618

Seems to be possible in the JS library based on tests:
https://github.com/microsoft/playwright/blob/dcd350445226ec3c54cc16e8cad1189c61bf07c8/tests/page/expect-misc.spec.ts#L193-L197

Example

No response

Motivation

Better align playwright-dotnet with capabilities of playwright JS

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

Start with src/Playwright.Tests/Assertions/LocatorAssertionsTests.cs around lines 600-618 and compare the referenced JavaScript test in tests/page/expect-misc.spec.ts. Trace how ToHaveJSPropertyAsync represents expected JavaScript values in the .NET assertions, then add coverage for an undefined property value. Done means the .NET assertion can verify undefined consistently with the JavaScript library and the relevant tests pass.

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
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.