Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d145e0d

Browse files
committedOct 5, 2024·
Fix first execution error in playwright mouse move
1 parent bc0325b commit d145e0d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
 

‎test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/PlaygroundPageConfigWindowTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,11 @@ await configTab.Locator("fluent-tab#parameters-tab")
451451
(await slider.GetAttributeAsync("current-value")).Should().Be(start.ToString());
452452
(await textfield.GetAttributeAsync("current-value")).Should().Be(start.ToString());
453453

454-
await Page.Mouse.DragToPoint(handle, 0, bound!.Y);
454+
await Page.Mouse.DragElementToPoint(handle, 0, bound!.Y);
455455
(await slider.GetAttributeAsync("current-value")).Should().Be(min.ToString());
456456
(await textfield.GetAttributeAsync("current-value")).Should().Be(min.ToString());
457457

458-
await Page.Mouse.DragToPoint(handle, float.MaxValue, bound!.Y);
458+
await Page.Mouse.DragElementToPoint(handle, float.MaxValue, bound!.Y);
459459
(await slider.GetAttributeAsync("current-value")).Should().Be(max.ToString());
460460
(await textfield.GetAttributeAsync("current-value")).Should().Be(max.ToString());
461461
}

‎test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/PlaywrightPageExtensions.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages;
44

55
internal static class PlaywrightPageExtensions
66
{
7-
public static async Task DragToPoint(this IMouse mouse, ILocator source, float x, float y)
7+
public static async Task DragElementToPoint(this IMouse mouse, ILocator source, float x, float y)
88
{
99
await source.HoverAsync();
1010
await mouse.DownAsync();
11+
12+
// Double execution for reliable mouse move https://playwright.dev/docs/input
13+
await mouse.MoveAsync(x, y);
1114
await mouse.MoveAsync(x, y);
15+
1216
await mouse.UpAsync();
1317
}
14-
}
18+
}

0 commit comments

Comments
 (0)
Please sign in to comment.