From 89cad4ebcc52dcc27eb2f72fefd61ab7412828ba Mon Sep 17 00:00:00 2001 From: Haiping Chen Date: Sat, 1 Jun 2024 21:15:47 -0500 Subject: [PATCH] Change StepId to GUID. --- .../Browsing/Enums/BroswerActionEnum.cs | 1 + .../BotSharp.Abstraction/Browsing/Models/MessageInfo.cs | 2 +- .../BotSharp.OpenAPI/Controllers/UserController.cs | 2 ++ .../PlaywrightDriver/PlaywrightWebDriver.DoAction.cs | 8 ++++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/Browsing/Enums/BroswerActionEnum.cs b/src/Infrastructure/BotSharp.Abstraction/Browsing/Enums/BroswerActionEnum.cs index 6dd0fb63..f06acc82 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Browsing/Enums/BroswerActionEnum.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Browsing/Enums/BroswerActionEnum.cs @@ -4,4 +4,5 @@ public enum BroswerActionEnum { Click = 1, InputText = 2, + Typing = 3, } diff --git a/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/MessageInfo.cs b/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/MessageInfo.cs index a39e97db..b273749f 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/MessageInfo.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/MessageInfo.cs @@ -7,5 +7,5 @@ public class MessageInfo public string ContextId { get; set; } = null!; public string? MessageId { get; set; } public string? TaskId { get; set; } - public int StepNum { get; set; } + public string StepId { get; set; } = Guid.NewGuid().ToString(); } diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/UserController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/UserController.cs index 9012e0d1..f0ab46ad 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/UserController.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/UserController.cs @@ -95,12 +95,14 @@ public class UserController : ControllerBase return UserViewModel.FromUser(user); } + [AllowAnonymous] [HttpGet("/user/name/existing")] public async Task VerifyUserNameExisting([FromQuery] string userName) { return await _userService.VerifyUserNameExisting(userName); } + [AllowAnonymous] [HttpGet("/user/email/existing")] public async Task VerifyEmailExisting([FromQuery] string email) { diff --git a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs index 91a99aa8..60bd4139 100644 --- a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs +++ b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs @@ -34,5 +34,13 @@ public partial class PlaywrightWebDriver await locator.PressAsync(action.PressKey); } } + else if (action.Action == BroswerActionEnum.Typing) + { + await locator.PressSequentiallyAsync(action.Content); + if (action.PressKey != null) + { + await locator.PressAsync(action.PressKey); + } + } } }