feat: add hasAttribute(name) for attribute presence assertions - #1975
feat: add hasAttribute(name) for attribute presence assertions#1975JAYA DILEEP (seethinajayadileep) wants to merge 2 commits into
Conversation
Add LocatorAssertions.hasAttribute(String name) and options overload so users can assert attribute presence/absence, matching Node's presence-only toHaveAttribute(name). Uses expect expression "to.have.attribute" with expressionArg set to the attribute name. Signed-off-by: JAYA DILEEP <seethinajayadileep@hotmail.com>
@microsoft-github-policy-service agree |
| * @param name Attribute name. | ||
| * @since v1.62 | ||
| */ | ||
| default void hasAttribute(String name) { |
There was a problem hiding this comment.
This file is generated from the upstream definitions. You need to update LocatorAssertions.toHaveAttribute#2 definition upstream to include java in the filter. Once that change is rolled to this repo, the interface will get the method and you just need to update the implementation and add a test.
Interface is generated from upstream docs. Keep presence assertion implementation and tests only, per review feedback. Signed-off-by: JAYA DILEEP <seethinajayadileep@hotmail.com>
|
Opened upstream docs PR microsoft/playwright#42710 to enable java on toHaveAttribute#2. Removed the hand-edited generated LocatorAssertions.java from this PR; left implementation + tests. Will regenerate the interface once that rolls. |
Fixes #1844
Summary
Adds
LocatorAssertions.hasAttribute(String name)and an options overload so callers can assert attribute presence / absence (via.not()), matching Node's presence-onlytoHaveAttribute(name).Changes
LocatorAssertions:hasAttribute(name)+hasAttribute(name, HasAttributeOptions)LocatorAssertionsImpl:expectImpl("to.have.attribute", ...)withexpressionArg = name(value assertions continue to useto.have.attribute.value).not()absence pass + failNotes
ApiGeneratoralready special-cases theHasAttributeOptionsnull cast forLocatorAssertions.hasAttributeoverloads.valueparam marked for Java in upstreamdocs/src/api/class-locatorassertions.md(today that optional overload islangs: pythononly), then a regenerate.