Skip to content

Add HasClass extension method - #138

Merged
kzu merged 1 commit into
mainfrom
dev/hasclass
Oct 18, 2024
Merged

Add HasClass extension method#138
kzu merged 1 commit into
mainfrom
dev/hasclass

Conversation

@kzu

@kzukzu commented Oct 18, 2024

Copy link
Copy Markdown
Member

This is a common enough check on web elements that it deserves an easy built-in method.

This is a common enough check on web elements that it deserves an easy built-in method.
@kzukzu added the enhancement New feature or request label Oct 18, 2024
@kzu
kzu enabled auto-merge (rebase) October 18, 2024 10:47
@devlooped-bot

Copy link
Copy Markdown
Member

112 passed112 passed

🧪 Details on Ubuntu 22.04.5 LTS

✅ AttributeSelectorNormalizesQuotes(expression: "[[data*='hello world']]", xpath: "[[contains(@DaTa,"hello world")]]")
✅ AttributeSelectorNormalizesQuotes(expression: "[[data*="hello world"]]", xpath: "[[contains(@DaTa,"hello world")]]")
✅ AttributeSelectorNormalizesQuotes(expression: "[[data='hello world']]", xpath: "[[@DaTa="hello world"]]")
✅ AttributeSelectorNormalizesQuotes(expression: "[[data="hello world"]]", xpath: "[[@DaTa="hello world"]]")
✅ AttributeSelectorNormalizesQuotes(expression: "[[data=hello world]]", xpath: "[[@DaTa="hello world"]]")
✅ AttributeSelectorNormalizesQuotes(expression: "[[text()='hello world']]", xpath: "[[contains(text(),"hello world")]]")
✅ AttributeSelectorNormalizesQuotes(expression: "[[text()
="hello world"]]", xpath: "[[contains(text(),"hello world")]]")
✅ AttributeSelectorNormalizesQuotes(expression: "[[text()='hello world']]", xpath: "[[text()="hello world"]]")
✅ AttributeSelectorNormalizesQuotes(expression: "[[text()="hello world"]]", xpath: "[[text()="hello world"]]")
✅ AttributeSelectorNormalizesQuotes(expression: "[[text()=hello world]]", xpath: "[[text()="hello world"]]")
✅ CanChangeToUpperCaseHtml
✅ CanParseAttributeSelector(expression: "[[ role= ui ]]", attributeName: "role", attributeValue: "ui", matching: Equals)
✅ CanParseAttributeSelector(expression: "[[role = ui]]", attributeName: "role", attributeValue: "ui", matching: Equals)
✅ CanParseAttributeSelector(expression: "[[role]]", attributeName: "role", attributeValue: null, matching: null)
✅ CanParseAttributeSelector(expression: "[[role*=ui]]", attributeName: "role", attributeValue: "ui", matching: Substring)
✅ CanParseAttributeSelector(expression: "[[role^=ui]]", attributeName: "role", attributeValue: "ui", matching: Prefix)
✅ CanParseAttributeSelector(expression: "[[role=ui]]", attributeName: "role", attributeValue: "ui", matching: Equals)
✅ CanParseAttributeSelector(expression: "[[role|=ui]]", attributeName: "role", attributeValue: "ui", matching: Dash)
✅ CanParseAttributeSelector(expression: "[[role~=ui]]", attributeName: "role", attributeValue: "ui", matching: Includes)
✅ CanParseAttributeSelector(expression: "[[role$=ui]]", attributeName: "role", attributeValue: "ui", matching: Suffix)
✅ CanParseIdSequenceAlone
✅ CanParseMatching(expression: "=", matching: Substring)
✅ CanParseMatching(expression: "^=", matching: Prefix)
✅ CanParseMatching(expression: "=", matching: Equals)
✅ CanParseMatching(expression: "|=", matching: Dash)
✅ CanParseMatching(expression: "~=", matching: Includes)
✅ CanParseMatching(expression: "$=", matching: Suffix)
✅ CanParseSelector1
✅ CanParseSelector2
✅ CanParseSelectorWithEscapedChar
✅ CanParseTextSelector(expression: "[[ text()= ui ]]", attributeName: "text()", attributeValue: "ui", matching: Equals)
✅ CanParseTextSelector(expression: "[[text() = ui]]", attributeName: "text()", attributeValue: "ui", matching: Equals)
✅ CanParseTextSelector(expression: "[[text()]]", attributeName: "text()", attributeValue: null, matching: null)
✅ CanParseTextSelector(expression: "[[text()
=ui]]", attributeName: "text()", attributeValue: "ui", matching: Substring)
✅ CanParseTextSelector(expression: "[[text()^=ui]]", attributeName: "text()", attributeValue: "ui", matching: Prefix)
✅ CanParseTextSelector(expression: "[[text()=ui]]", attributeName: "text()", attributeValue: "ui", matching: Equals)
✅ CanParseTextSelector(expression: "[[text()|=ui]]", attributeName: "text()", attributeValue: "ui", matching: Dash)
✅ CanParseTextSelector(expression: "[[text()=ui]]", attributeName: "text()", attributeValue: "ui", matching: Includes)
✅ CanParseTextSelector(expression: "[[text()$=ui]]", attributeName: "text()", attributeValue: "ui", matching: Suffix)
✅ CanParseTypeAndClassSequence
✅ CanParseTypeSelector
✅ CanParseTypeSelectorWithNoNamespace
✅ CanParseTypeSelectorWithWidcardNamespace
✅ CanParseUniversalAndIdSequence
✅ CanParseUniversalSelector
✅ CanParseUniversalSelectorWithNoNamespace
✅ CanParseUniversalSelectorWithWidcardNamespace
✅ EvaluatePageHtml(expression: ":empty", expected: " ")
✅ EvaluatePageHtml(expression: ".container", expected: "Hello1234")
✅ EvaluatePageHtml(expression: ".item__hiden-content", expected: "Archivo")
✅ EvaluatePageHtml(expression: ".main", expected: "Hello1234")
✅ EvaluatePageHtml(expression: "[[tags
=flow]]", expected: "File Edit")
✅ EvaluatePageHtml(expression: "[[tags~=selected]]", expected: "File")
✅ EvaluatePageHtml(expression: "#title", expected: "Hello")
✅ EvaluatePageHtml(expression: "body > div > span", expected: "1 2 4")
✅ EvaluatePageHtml(expression: "body > div:nth-of-type(3)", expected: "Standard")
✅ EvaluatePageHtml(expression: "body > span:nth-child(5)", expected: "5")
✅ EvaluatePageHtml(expression: "div > div", expected: "Hello")
✅ EvaluatePageHtml(expression: "div span:first-of-type", expected: "1")
✅ EvaluatePageHtml(expression: "div span:last-of-type", expected: "4")
✅ EvaluatePageHtml(expression: "div:first-child", expected: "Warning Hello")
✅ EvaluatePageHtml(expression: "div:has(div[[id]], span[[id=one]])", expected: "Hello1234")
✅ EvaluatePageHtml(expression: "div:last-child", expected: "Footer")
✅ EvaluatePageHtml(expression: "div.menuitem", expected: "File Archivo Edit")
✅ EvaluatePageHtml(expression: "div[[role]],span", expected: "Warning 1 2 4 5 Standard File Archivo Edit Footer")
✅ EvaluatePageHtml(expression: "div[[role]]", expected: "Warning Standard File Archivo Edit Footer")
✅ EvaluatePageHtml(expression: "div[[role]][[lang|=es]]", expected: "Archivo")
✅ EvaluatePageHtml(expression: "div[[role*=nu]]", expected: "Standard File Archivo Edit")
✅ EvaluatePageHtml(expression: "div[[role^=menu]]:not([[role=menuitem]])", expected: "Standard")
✅ EvaluatePageHtml(expression: "div[[role^=menu]]", expected: "Standard File Archivo Edit")
✅ EvaluatePageHtml(expression: "div[[role=alert]]", expected: "Warning")
✅ EvaluatePageHtml(expression: "div[[role=menuitem]]:nth-of-type(2)", expected: "Archivo")
✅ EvaluatePageHtml(expression: "div[[role=menuitem]]", expected: "File Archivo Edit")
✅ EvaluatePageHtml(expression: "div[[role$=item]]", expected: "File Archivo Edit")
✅ EvaluatePageHtml(expression: "div[[tags^="selected flow"]] + div", expected: "Archivo")
✅ EvaluatePageHtml(expression: "div[[tags^="selected flow"]]+div", expected: "Archivo")
✅ EvaluatePageHtml(expression: "div[[text()=Hello]] + span:first-of-type", expected: "1")
✅ EvaluatePageHtml(expression: "h1:only-child", expected: "Sub-header")
✅ EvaluatePageHtml(expression: "input:checked", expected: " ")
✅ EvaluatePageHtml(expression: "option:checked", expected: "second")
✅ EvaluatePageHtml(expression: "option[[selected="selected"]]", expected: "second")
✅ EvaluatePageHtml(expression: "p:has(h1)", expected: "Sub-header")
✅ EvaluatePageHtml(expression: "span + p", expected: "3")
✅ EvaluatePageHtml(expression: "span:not([[id]])", expected: "4 5")
✅ EvaluatePageHtml(expression: "span:not([[text()='4']]),div[[role]]", expected: "Warning 1 2 5 Standard File Archivo Edit Footer")
✅ EvaluatePageHtml(expression: "span", expected: "1 2 4 5")
✅ ExcludesScriptsByDefault
✅ ExcludesStylesByDefault
✅ ExcludesXmlNamespacesByDefault
✅ HasCssClass
✅ HtmlSettings
✅ IncludeScriptsExplicitSettings
✅ IncludeStylesExplicitSettings
✅ IncludeXmlNamespacesExplicitly
✅ ParseIdentifier(expression: "_foo-bar", identifier: "_foo-bar")
✅ ParseIdentifier(expression: "-foo_bar", identifier: "-foo_bar")
✅ ParseIdentifier(expression: "foo__bar", identifier: "foo__bar")
✅ ParseIdentifier(expression: "foo_bar", identifier: "foo_bar")
✅ ParseIdentifier(expression: "foo\+bar", identifier: "foo+bar")
✅ ParseSelector
✅ RemoveElementsFromReader
✅ RemoveNamespacesFromElement
✅ Render
✅ RenderExpression
✅ SelectEmptyDiv
✅ ToXPath(css: ".foo", xpath: ".//[[contains(concat(" ",normalize-space(@Class)"···)
✅ ToXPath(css: "[[data-tags|=flow]]", xpath: ".//
[[@data-tags="flow" or starts-with(@data-tags"···)
✅ ToXPath(css: "[[role*=nu]]", xpath: ".//*[[contains(@ROLE,"nu")]]")
✅ ToXPath(css: "foo > bar > baz", xpath: ".//foo/bar/baz")
✅ ToXPath(css: "foo > bar", xpath: ".//foo/bar")
✅ ToXPath(css: "foo ~ bar", xpath: ".//foo/following-sibling::bar")
✅ ToXPath(css: "foo", xpath: ".//foo")

from dotnet-retest v0.6.3 on .NET 8.0.8 with 💜

@kzu
kzu merged commit c570b5f into mainOct 18, 2024
@kzu
kzu deleted the dev/hasclass branch October 18, 2024 10:48
@devloopeddevlooped locked and limited conversation to collaborators Nov 18, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@kzu@devlooped-bot