Skip to content

Commit

Permalink
New Fill component method
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko committed Jan 21, 2024
1 parent fad2673 commit 11aff12
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Yapoml.Playwright/Components/BaseComponent.Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,30 @@ public virtual TComponent Type(string text, Action<TConditions> when)
return Type(text);
}

/// <summary>
/// Clears and types a text in the component.
/// </summary>
/// <param name="text">A text to typed.</param>
/// <returns>The same instance of the component to continue interaction with it.</returns>
public virtual TComponent Fill(string text)
{
using (_logger.BeginLogScope($"Filling in {component.Metadata.Name} within '{text}'"))
{
RelocateOnStaleReference(() => WrappedElement.FillAsync(text).GetAwaiter().GetResult());
}

return component;
}

/// <inheritdoc cref="Fill(string)"/>
/// <param name="when">Condition to be satisfied before simulating a mouse click.</param>
public virtual TComponent Fill(string text, Action<TConditions> when)
{
when(conditions);

return Fill(text);
}

/// <summary>
/// Simulates a mouse click on a component. It can be used to interact with buttons, links,
/// checkboxes, radio buttons, and other clickable components on a page.
Expand Down

0 comments on commit 11aff12

Please sign in to comment.