/*
* MIT License
*
* Copyright (c) Microsoft Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.Playwright.Transport.Protocol;
namespace Microsoft.Playwright.Core
{
internal class LocatorAssertions : AssertionsBase, ILocatorAssertions
{
public LocatorAssertions(ILocator locator, bool isNot) : base(locator, isNot)
{
}
public ILocatorAssertions Not => new LocatorAssertions(ActualLocator, !IsNot);
public Task ToBeCheckedAsync(LocatorAssertionsToBeCheckedOptions options = null)
{
var isChecked = options == null || options.Checked == null || options.Checked == true;
return ExpectTrueAsync(isChecked ? "to.be.checked" : "to.be.unchecked", $"Locator expected {(!isChecked ? "not " : string.Empty)}to be checked", ConvertToFrameExpectOptions(options));
}
public Task ToBeDisabledAsync(LocatorAssertionsToBeDisabledOptions options = null) => ExpectTrueAsync("to.be.disabled", "Locator expected to be disabled", ConvertToFrameExpectOptions(options));
public Task ToBeEditableAsync(LocatorAssertionsToBeEditableOptions options = null) => ExpectTrueAsync("to.be.editable", "Locator expected to be editable", ConvertToFrameExpectOptions(options));
public Task ToBeEmptyAsync(LocatorAssertionsToBeEmptyOptions options = null) => ExpectTrueAsync("to.be.empty", "Locator expected to be empty", ConvertToFrameExpectOptions(options));
public Task ToBeEnabledAsync(LocatorAssertionsToBeEnabledOptions options = null) => ExpectTrueAsync("to.be.enabled", "Locator expected to be enabled", ConvertToFrameExpectOptions(options));
public Task ToBeFocusedAsync(LocatorAssertionsToBeFocusedOptions options = null) => ExpectTrueAsync("to.be.focused", "Locator expected to be focused", ConvertToFrameExpectOptions(options));
public Task ToBeHiddenAsync(LocatorAssertionsToBeHiddenOptions options = null) => ExpectTrueAsync("to.be.hidden", "Locator expected to be hidden", ConvertToFrameExpectOptions(options));
public Task ToBeVisibleAsync(LocatorAssertionsToBeVisibleOptions options = null) => ExpectTrueAsync("to.be.visible", "Locator expected to be visible", ConvertToFrameExpectOptions(options));
private Task ExpectTrueAsync(string expression, string message, FrameExpectOptions options)
{
ExpectedTextValue[] expectedText = null;
return ExpectImplAsync(expression, expectedText, null, message, options);
}
public Task ToContainTextAsync(string expected, LocatorAssertionsToContainTextOptions options = null) =>
ExpectImplAsync("to.have.text", new ExpectedTextValue() { String = expected, MatchSubstring = true, NormalizeWhiteSpace = true }, expected, "Locator expected to contain text", ConvertToFrameExpectOptions(options));
public Task ToContainTextAsync(Regex expected, LocatorAssertionsToContainTextOptions options = null) =>
ExpectImplAsync("to.have.text", ExpectedRegex(expected, new() { MatchSubstring = true, NormalizeWhiteSpace = true }), expected, "Locator expected text matching regex", ConvertToFrameExpectOptions(options));
public Task ToContainTextAsync(IEnumerable<string> expected, LocatorAssertionsToContainTextOptions options = null) =>
ExpectImplAsync("to.contain.text.array", expected.Select(text => new ExpectedTextValue() { String = text, MatchSubstring = true, NormalizeWhiteSpace = true }).ToArray(), expected, "Locator expected to contain text", ConvertToFrameExpectOptions(options));
public Task ToContainTextAsync(IEnumerable<Regex> expected, LocatorAssertionsToContainTextOptions options = null) =>
ExpectImplAsync("to.contain.text.array", expected.Select(regex => ExpectedRegex(regex, new() { MatchSubstring = true, NormalizeWhiteSpace = true })).ToArray(), expected, "Locator expected text matching regex", ConvertToFrameExpectOptions(options));
public Task ToHaveAttributeAsync(string name, string value, LocatorAssertionsToHaveAttributeOptions options = null) =>
ToHaveAttributeAsync(name, new() { String = value }, value, options);
public Task ToHaveAttributeAsync(string name, Regex value, LocatorAssertionsToHaveAttributeOptions options = null) =>
ToHaveAttributeAsync(name, ExpectedRegex(value), value, options);
private Task ToHaveAttributeAsync(string name, ExpectedTextValue expectedText, object expectedValue, LocatorAssertionsToHaveAttributeOptions options = null)
{
var commonOptions = ConvertToFrameExpectOptions(options);
commonOptions.ExpressionArg = name;
string message = $"Locator expected to have attribute '{name}'";
if (expectedValue is Regex)
{
message += " matching regex";
}
return ExpectImplAsync("to.have.attribute", expectedText, expectedValue, message, commonOptions);
}
public Task ToHaveClassAsync(string expected, LocatorAssertionsToHaveClassOptions options = null) =>
ExpectImplAsync("to.have.class", new ExpectedTextValue() { String = expected }, expected, "Locator expected to have class", ConvertToFrameExpectOptions(options));
public Task ToHaveClassAsync(Regex expected, LocatorAssertionsToHaveClassOptions options = null) =>
ExpectImplAsync("to.have.class", ExpectedRegex(expected), expected, "Locator expected matching regex", ConvertToFrameExpectOptions(options));
public Task ToHaveClassAsync(IEnumerable<string> expected, LocatorAssertionsToHaveClassOptions options = null) =>
ExpectImplAsync("to.have.class.array", expected.Select(text => new ExpectedTextValue() { String = text }).ToArray(), expected, "Locator expected to have class", ConvertToFrameExpectOptions(options));
public Task ToHaveClassAsync(IEnumerable<Regex> expected, LocatorAssertionsToHaveClassOptions options = null) =>
ExpectImplAsync("to.have.class.array", expected.Select(regex => ExpectedRegex(regex)).ToArray(), expected, "Locator expected to have class matching regex", ConvertToFrameExpectOptions(options));
public Task ToHaveCountAsync(int count, LocatorAssertionsToHaveCountOptions options = null)
{
ExpectedTextValue[] expectedText = null;
var commonOptions = ConvertToFrameExpectOptions(options);
commonOptions.ExpectedNumber = count;
return ExpectImplAsync("to.have.count", expectedText, count, "Locator expected to have count", commonOptions);
}
public Task ToHaveCSSAsync(string name, string value, LocatorAssertionsToHaveCSSOptions options = null) =>
ToHaveCSSAsync(name, new ExpectedTextValue() { String = value }, value, options);
public Task ToHaveCSSAsync(string name, Regex value, LocatorAssertionsToHaveCSSOptions options = null) =>
ToHaveCSSAsync(name, ExpectedRegex(value), value, options);
internal Task ToHaveCSSAsync(string name, ExpectedTextValue expectedText, object expectedValue, LocatorAssertionsToHaveCSSOptions options = null)
{
var commonOptions = ConvertToFrameExpectOptions(options);
commonOptions.ExpressionArg = name;
var message = $"Locator expected to have CSS property '{name}'";
if (expectedValue is Regex)
{
message += " matching regex";
}
return ExpectImplAsync("to.have.css", expectedText, expectedValue, message, commonOptions);
}
public Task ToHaveIdAsync(string id, LocatorAssertionsToHaveIdOptions options = null) =>
ExpectImplAsync("to.have.id", new ExpectedTextValue() { String = id }, id, "Locator expected to have ID", ConvertToFrameExpectOptions(options));
public Task ToHaveIdAsync(Regex id, LocatorAssertionsToHaveIdOptions options = null) =>
ExpectImplAsync("to.have.id", ExpectedRegex(id), id, "Locator expected to have ID", ConvertToFrameExpectOptions(options));
public Task ToHaveJSPropertyAsync(string name, object value, LocatorAssertionsToHaveJSPropertyOptions options = null)
{
var commonOptions = ConvertToFrameExpectOptions(options);
commonOptions.ExpressionArg = name;
commonOptions.ExpectedValue = ScriptsHelper.SerializedArgument(value);
ExpectedTextValue[] expectedText = null;
return ExpectImplAsync("to.have.property", expectedText, value, $"Locator expected to have JavaScript property '{name}'", commonOptions);
}
public Task ToHaveTextAsync(string expected, LocatorAssertionsToHaveTextOptions options = null) =>
ExpectImplAsync("to.have.text", new ExpectedTextValue() { String = expected, NormalizeWhiteSpace = true }, expected, "Locator expected to have text", ConvertToFrameExpectOptions(options));
public Task ToHaveTextAsync(Regex expected, LocatorAssertionsToHaveTextOptions options = null) =>
ExpectImplAsync("to.have.text", ExpectedRegex(expected, new() { NormalizeWhiteSpace = true }), expected, "Locator expected to have text matching regex", ConvertToFrameExpectOptions(options));
public Task ToHaveTextAsync(IEnumerable<string> expected, LocatorAssertionsToHaveTextOptions options = null) =>
ExpectImplAsync("to.have.text.array", expected.Select(text => new ExpectedTextValue() { String = text, NormalizeWhiteSpace = true }).ToArray(), expected, "Locator expected to have text", ConvertToFrameExpectOptions(options));
public Task ToHaveTextAsync(IEnumerable<Regex> expected, LocatorAssertionsToHaveTextOptions options = null) =>
ExpectImplAsync("to.have.text.array", expected.Select(regex => ExpectedRegex(regex, new() { NormalizeWhiteSpace = true })).ToArray(), expected, "Locator expected to have text", ConvertToFrameExpectOptions(options));
public Task ToHaveValueAsync(string value, LocatorAssertionsToHaveValueOptions options = null) =>
ExpectImplAsync("to.have.value", new ExpectedTextValue() { String = value }, value, "Locator expected to have value", ConvertToFrameExpectOptions(options));
public Task ToHaveValueAsync(Regex value, LocatorAssertionsToHaveValueOptions options = null) =>
ExpectImplAsync("to.have.value", ExpectedRegex(value), value, "Locator expected to have value matching regex", ConvertToFrameExpectOptions(options));
}
}
/*
* MIT License
*
* Copyright (c) Microsoft Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Runtime.Serialization;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
#nullable enable
namespace Microsoft.Playwright
{
/// <summary>
/// <para>
/// The <see cref="ILocatorAssertions"/> class provides assertion methods that can be
/// used to make assertions about the <see cref="ILocator"/> state in the tests. A new
/// instance of <see cref="ILocatorAssertions"/> is created by calling <see cref="IPlaywrightAssertions.Expect"/>:
/// </para>
/// <code>
/// using System.Text.RegularExpressions;<br/>
/// using System.Threading.Tasks;<br/>
/// using Microsoft.Playwright.NUnit;<br/>
/// using NUnit.Framework;<br/>
/// <br/>
/// namespace PlaywrightTests<br/>
/// {<br/>
/// public class ExampleTests : PageTest<br/>
/// {<br/>
/// [Test]<br/>
/// public async Task StatusBecomesSubmitted()<br/>
/// {<br/>
/// // ..<br/>
/// await Page.ClickAsync("#submit-button");<br/>
/// await Expect(Page.Locator(".status")).ToHaveTextAsync("Submitted");<br/>
/// }<br/>
/// }<br/>
/// }
/// </code>
/// </summary>
public partial interface ILocatorAssertions
{
/// <summary>
/// <para>
/// Makes the assertion check for the opposite condition. For example, this code tests
/// that the Locator doesn't contain text <c>"error"</c>:
/// </para>
/// <code>await Expect(locator).Not.ToContainTextAsync("error");</code>
/// </summary>
public ILocatorAssertions Not { get; }
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to a checked input.</para>
/// <code>
/// var locator = Page.Locator(".subscribe");<br/>
/// await Expect(locator).ToBeCheckedAsync();
/// </code>
/// </summary>
/// <param name="options">Call options</param>
Task ToBeCheckedAsync(LocatorAssertionsToBeCheckedOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to a disabled element.</para>
/// <code>
/// var locator = Page.Locator("button.submit");<br/>
/// await Expect(locator).ToBeDisabledAsync();
/// </code>
/// </summary>
/// <param name="options">Call options</param>
Task ToBeDisabledAsync(LocatorAssertionsToBeDisabledOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to an editable element.</para>
/// <code>
/// var locator = Page.Locator("input");<br/>
/// await Expect(locator).ToBeEditableAsync();
/// </code>
/// </summary>
/// <param name="options">Call options</param>
Task ToBeEditableAsync(LocatorAssertionsToBeEditableOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an empty editable element or to a DOM
/// node that has no text.
/// </para>
/// <code>
/// var locator = Page.Locator("div.warning");<br/>
/// await Expect(locator).ToBeEmptyAsync();
/// </code>
/// </summary>
/// <param name="options">Call options</param>
Task ToBeEmptyAsync(LocatorAssertionsToBeEmptyOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to an enabled element.</para>
/// <code>
/// var locator = Page.Locator("button.submit");<br/>
/// await Expect(locator).toBeEnabledAsync();
/// </code>
/// </summary>
/// <param name="options">Call options</param>
Task ToBeEnabledAsync(LocatorAssertionsToBeEnabledOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to a focused DOM node.</para>
/// <code>
/// var locator = Page.Locator("input");<br/>
/// await Expect(locator).ToBeFocusedAsync();
/// </code>
/// </summary>
/// <param name="options">Call options</param>
Task ToBeFocusedAsync(LocatorAssertionsToBeFocusedOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to a hidden DOM node, which is the opposite
/// of <a href="https://playwright.dev/dotnet/docs/api/actionability#visible">visible</a>.
/// </para>
/// <code>
/// var locator = Page.Locator(".my-element");<br/>
/// await Expect(locator).ToBeHiddenAsync();
/// </code>
/// </summary>
/// <param name="options">Call options</param>
Task ToBeHiddenAsync(LocatorAssertionsToBeHiddenOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to a <a href="https://playwright.dev/dotnet/docs/api/actionability#visible">visible</a>
/// DOM node.
/// </para>
/// <code>
/// var locator = Page.Locator(".my-element");<br/>
/// await Expect(locator).ToBeVisibleAsync();
/// </code>
/// </summary>
/// <param name="options">Call options</param>
Task ToBeVisibleAsync(LocatorAssertionsToBeVisibleOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element that contains the given
/// text. You can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator(".title");<br/>
/// await Expect(locator).ToContainTextAsync("substring");<br/>
/// await Expect(locator).ToContainTextAsync(new Regex("\\d messages"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .list-item");<br/>
/// await Expect(locator).ToContainTextAsync(new string[] { "Text 1", "Text 4", "Text 5" });
/// </code>
/// </summary>
/// <param name="expected">Expected substring or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToContainTextAsync(string expected, LocatorAssertionsToContainTextOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element that contains the given
/// text. You can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator(".title");<br/>
/// await Expect(locator).ToContainTextAsync("substring");<br/>
/// await Expect(locator).ToContainTextAsync(new Regex("\\d messages"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .list-item");<br/>
/// await Expect(locator).ToContainTextAsync(new string[] { "Text 1", "Text 4", "Text 5" });
/// </code>
/// </summary>
/// <param name="expected">Expected substring or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToContainTextAsync(Regex expected, LocatorAssertionsToContainTextOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element that contains the given
/// text. You can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator(".title");<br/>
/// await Expect(locator).ToContainTextAsync("substring");<br/>
/// await Expect(locator).ToContainTextAsync(new Regex("\\d messages"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .list-item");<br/>
/// await Expect(locator).ToContainTextAsync(new string[] { "Text 1", "Text 4", "Text 5" });
/// </code>
/// </summary>
/// <param name="expected">Expected substring or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToContainTextAsync(IEnumerable<string> expected, LocatorAssertionsToContainTextOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element that contains the given
/// text. You can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator(".title");<br/>
/// await Expect(locator).ToContainTextAsync("substring");<br/>
/// await Expect(locator).ToContainTextAsync(new Regex("\\d messages"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .list-item");<br/>
/// await Expect(locator).ToContainTextAsync(new string[] { "Text 1", "Text 4", "Text 5" });
/// </code>
/// </summary>
/// <param name="expected">Expected substring or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToContainTextAsync(IEnumerable<Regex> expected, LocatorAssertionsToContainTextOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to an element with given attribute.</para>
/// <code>
/// var locator = Page.Locator("input");<br/>
/// await Expect(locator).ToHaveAttributeAsync("type", "text");
/// </code>
/// </summary>
/// <param name="name">Attribute name.</param>
/// <param name="value">Expected attribute value.</param>
/// <param name="options">Call options</param>
Task ToHaveAttributeAsync(string name, string value, LocatorAssertionsToHaveAttributeOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to an element with given attribute.</para>
/// <code>
/// var locator = Page.Locator("input");<br/>
/// await Expect(locator).ToHaveAttributeAsync("type", "text");
/// </code>
/// </summary>
/// <param name="name">Attribute name.</param>
/// <param name="value">Expected attribute value.</param>
/// <param name="options">Call options</param>
Task ToHaveAttributeAsync(string name, Regex value, LocatorAssertionsToHaveAttributeOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to an element with given CSS class.</para>
/// <code>
/// var locator = Page.Locator("#component");<br/>
/// await Expect(locator).ToHaveClassAsync(new Regex("selected"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .component");<br/>
/// await Expect(locator).ToHaveClassAsync(new string[]{"component", "component selected", "component"});
/// </code>
/// </summary>
/// <param name="expected">Expected class or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToHaveClassAsync(string expected, LocatorAssertionsToHaveClassOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to an element with given CSS class.</para>
/// <code>
/// var locator = Page.Locator("#component");<br/>
/// await Expect(locator).ToHaveClassAsync(new Regex("selected"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .component");<br/>
/// await Expect(locator).ToHaveClassAsync(new string[]{"component", "component selected", "component"});
/// </code>
/// </summary>
/// <param name="expected">Expected class or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToHaveClassAsync(Regex expected, LocatorAssertionsToHaveClassOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to an element with given CSS class.</para>
/// <code>
/// var locator = Page.Locator("#component");<br/>
/// await Expect(locator).ToHaveClassAsync(new Regex("selected"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .component");<br/>
/// await Expect(locator).ToHaveClassAsync(new string[]{"component", "component selected", "component"});
/// </code>
/// </summary>
/// <param name="expected">Expected class or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToHaveClassAsync(IEnumerable<string> expected, LocatorAssertionsToHaveClassOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> points to an element with given CSS class.</para>
/// <code>
/// var locator = Page.Locator("#component");<br/>
/// await Expect(locator).ToHaveClassAsync(new Regex("selected"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .component");<br/>
/// await Expect(locator).ToHaveClassAsync(new string[]{"component", "component selected", "component"});
/// </code>
/// </summary>
/// <param name="expected">Expected class or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToHaveClassAsync(IEnumerable<Regex> expected, LocatorAssertionsToHaveClassOptions? options = default);
/// <summary>
/// <para>Ensures the <see cref="ILocator"/> resolves to an exact number of DOM nodes.</para>
/// <code>
/// var locator = Page.Locator("list > .component");<br/>
/// await Expect(locator).ToHaveCountAsync(3);
/// </code>
/// </summary>
/// <param name="count">Expected count.</param>
/// <param name="options">Call options</param>
Task ToHaveCountAsync(int count, LocatorAssertionsToHaveCountOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> resolves to an element with the given computed
/// CSS style.
/// </para>
/// <code>
/// var locator = Page.Locator("button");<br/>
/// await Expect(locator).ToHaveCSSAsync("display", "flex");
/// </code>
/// </summary>
/// <param name="name">CSS property name.</param>
/// <param name="value">CSS property value.</param>
/// <param name="options">Call options</param>
Task ToHaveCSSAsync(string name, string value, LocatorAssertionsToHaveCSSOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> resolves to an element with the given computed
/// CSS style.
/// </para>
/// <code>
/// var locator = Page.Locator("button");<br/>
/// await Expect(locator).ToHaveCSSAsync("display", "flex");
/// </code>
/// </summary>
/// <param name="name">CSS property name.</param>
/// <param name="value">CSS property value.</param>
/// <param name="options">Call options</param>
Task ToHaveCSSAsync(string name, Regex value, LocatorAssertionsToHaveCSSOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element with the given DOM Node
/// ID.
/// </para>
/// <code>
/// var locator = Page.Locator("input");<br/>
/// await Expect(locator).ToHaveIdAsync("lastname");
/// </code>
/// </summary>
/// <param name="id">Element id.</param>
/// <param name="options">Call options</param>
Task ToHaveIdAsync(string id, LocatorAssertionsToHaveIdOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element with the given DOM Node
/// ID.
/// </para>
/// <code>
/// var locator = Page.Locator("input");<br/>
/// await Expect(locator).ToHaveIdAsync("lastname");
/// </code>
/// </summary>
/// <param name="id">Element id.</param>
/// <param name="options">Call options</param>
Task ToHaveIdAsync(Regex id, LocatorAssertionsToHaveIdOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element with given JavaScript property.
/// Note that this property can be of a primitive type as well as a plain serializable
/// JavaScript object.
/// </para>
/// <code>
/// var locator = Page.Locator(".component");<br/>
/// await Expect(locator).ToHaveJSPropertyAsync("loaded", true);
/// </code>
/// </summary>
/// <param name="name">Property name.</param>
/// <param name="value">Property value.</param>
/// <param name="options">Call options</param>
Task ToHaveJSPropertyAsync(string name, object value, LocatorAssertionsToHaveJSPropertyOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element with the given text. You
/// can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator(".title");<br/>
/// await Expect(locator).ToHaveTextAsync(new Regex("Welcome, Test User"));<br/>
/// await Expect(locator).ToHaveTextAsync(new Regex("Welcome, .*"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .component");<br/>
/// await Expect(locator).toHaveTextAsync(new string[]{ "Text 1", "Text 2", "Text 3" });
/// </code>
/// </summary>
/// <param name="expected">Expected substring or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToHaveTextAsync(string expected, LocatorAssertionsToHaveTextOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element with the given text. You
/// can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator(".title");<br/>
/// await Expect(locator).ToHaveTextAsync(new Regex("Welcome, Test User"));<br/>
/// await Expect(locator).ToHaveTextAsync(new Regex("Welcome, .*"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .component");<br/>
/// await Expect(locator).toHaveTextAsync(new string[]{ "Text 1", "Text 2", "Text 3" });
/// </code>
/// </summary>
/// <param name="expected">Expected substring or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToHaveTextAsync(Regex expected, LocatorAssertionsToHaveTextOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element with the given text. You
/// can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator(".title");<br/>
/// await Expect(locator).ToHaveTextAsync(new Regex("Welcome, Test User"));<br/>
/// await Expect(locator).ToHaveTextAsync(new Regex("Welcome, .*"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .component");<br/>
/// await Expect(locator).toHaveTextAsync(new string[]{ "Text 1", "Text 2", "Text 3" });
/// </code>
/// </summary>
/// <param name="expected">Expected substring or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToHaveTextAsync(IEnumerable<string> expected, LocatorAssertionsToHaveTextOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element with the given text. You
/// can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator(".title");<br/>
/// await Expect(locator).ToHaveTextAsync(new Regex("Welcome, Test User"));<br/>
/// await Expect(locator).ToHaveTextAsync(new Regex("Welcome, .*"));
/// </code>
/// <para>
/// Note that if array is passed as an expected value, entire lists of elements can
/// be asserted:
/// </para>
/// <code>
/// var locator = Page.Locator("list > .component");<br/>
/// await Expect(locator).toHaveTextAsync(new string[]{ "Text 1", "Text 2", "Text 3" });
/// </code>
/// </summary>
/// <param name="expected">Expected substring or RegExp or a list of those.</param>
/// <param name="options">Call options</param>
Task ToHaveTextAsync(IEnumerable<Regex> expected, LocatorAssertionsToHaveTextOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element with the given input value.
/// You can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator("input[type=number]");<br/>
/// await Expect(locator).ToHaveValueAsync(new Regex("[0-9]"));
/// </code>
/// </summary>
/// <param name="value">Expected value.</param>
/// <param name="options">Call options</param>
Task ToHaveValueAsync(string value, LocatorAssertionsToHaveValueOptions? options = default);
/// <summary>
/// <para>
/// Ensures the <see cref="ILocator"/> points to an element with the given input value.
/// You can use regular expressions for the value as well.
/// </para>
/// <code>
/// var locator = Page.Locator("input[type=number]");<br/>
/// await Expect(locator).ToHaveValueAsync(new Regex("[0-9]"));
/// </code>
/// </summary>
/// <param name="value">Expected value.</param>
/// <param name="options">Call options</param>
Task ToHaveValueAsync(Regex value, LocatorAssertionsToHaveValueOptions? options = default);
}
}
#nullable disable