Skip to content

Commit

Permalink
[dotnet] implement pause action to match Java
Browse files Browse the repository at this point in the history
implements #10691
  • Loading branch information
titusfortner committed May 27, 2022
1 parent bf18835 commit 8977cf7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dotnet/src/webdriver/Interactions/Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,17 @@ public Actions ScrollFromOrigin(WheelInputDevice.ScrollOrigin scrollOrigin, int
return this;
}

/// <summary>
/// Performs a Pause.
/// </summary>
/// <param name="duration">How long to pause the action chain.</param>
/// <returns>A self-reference to this <see cref="Actions"/>.</returns>
public Actions Pause(TimeSpan duration)
{
this.actionBuilder.AddAction(new PauseInteraction(this.defaultMouse, duration));
return this;
}

/// <summary>
/// Builds the sequence of actions.
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions dotnet/test/common/Interactions/CombinedInputActionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,14 @@ public void CanClickOnSuckerFishMenuItem()
WaitFor(() => { return result.Text.Contains("item 1"); }, "Result element does not contain text 'item 1'");
}

[Test]
public void PerformsPause()
{
DateTime start = DateTime.Now;
new Actions(driver).Pause(TimeSpan.FromMilliseconds(1200)).Build().Perform();
Assert.IsTrue(DateTime.Now - start > TimeSpan.FromMilliseconds(1200));
}

private bool FuzzyPositionMatching(int expectedX, int expectedY, string locationTuple)
{
string[] splitString = locationTuple.Split(',');
Expand Down

0 comments on commit 8977cf7

Please sign in to comment.