diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminEvents.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminEvents.razor
index 0882151e..a70d183e 100644
--- a/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminEvents.razor
+++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/AdminEvents.razor
@@ -6,4 +6,4 @@
This component demonstrates showing admin events.
-
+
diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/Tests.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/Tests.razor
index dcc16730..40ebae28 100644
--- a/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/Tests.razor
+++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/Tests.razor
@@ -1,26 +1,29 @@
-@page "/tests"
-@rendermode InteractiveServer
-
-Debug Button
-
-
-
-
-
-
-@code {
- private object? currentValue;
- private string? selectedModelValue = "";
-
- private async Task SetInput(int newValue)
- {
- currentValue = newValue;
- await Task.CompletedTask;
- }
-
- private async Task HandleSelectedModelValue(string val)
- {
- selectedModelValue = val;
- await Task.CompletedTask;
- }
-}
+@page "/tests"
+@rendermode InteractiveServer
+
+Component Tests
+
+Debug Button
+
+
+
+Deployment Models
+
+
+
+@code {
+ private object? targetValue;
+ private string? selectedModel;
+
+ private async Task SetInput(int value)
+ {
+ targetValue = value;
+ await Task.CompletedTask;
+ }
+
+ private async Task SetDeploymentModel(string value)
+ {
+ selectedModel = value;
+ await Task.CompletedTask;
+ }
+}
diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/AdminEventsComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/AdminEventsComponent.razor
index 97db777b..09c43446 100644
--- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/AdminEventsComponent.razor
+++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/Admin/AdminEventsComponent.razor
@@ -1,6 +1,6 @@
@using AzureOpenAIProxy.PlaygroundApp.Models
-
+
@if (eventDetails == null)
{
Loading...
@@ -41,12 +41,15 @@
}
}
-
+
@code {
private IQueryable? eventDetails;
private PaginationState pagination = new PaginationState { ItemsPerPage = 10 };
+ [Parameter]
+ public string? Id { get; set; }
+
protected override async Task OnInitializedAsync()
{
// Simulate asynchronous loading to demonstrate streaming rendering
diff --git a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/DeploymentModelListComponent.razor b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/DeploymentModelListComponent.razor
index 13783dd1..ac39ba4c 100644
--- a/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/DeploymentModelListComponent.razor
+++ b/src/AzureOpenAIProxy.PlaygroundApp/Components/UI/DeploymentModelListComponent.razor
@@ -16,9 +16,10 @@
@code {
+ private Option? selectedOption { get; set; } = new();
+
[Parameter]
public string? Id { get; set; }
- private Option? selectedOption { get; set; } = new();
[Parameter]
public EventCallback OnUserOptionSelected { get; set; }
diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/AdminEventsPageTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/AdminEventsPageTests.cs
index 9fe77857..6708b13b 100644
--- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/AdminEventsPageTests.cs
+++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/AdminEventsPageTests.cs
@@ -16,7 +16,7 @@ public class AdminEventsPageTests : PageTest
};
[SetUp]
- public async Task Setup()
+ public async Task Init()
{
await Page.GotoAsync("https://localhost:5001/admin/events");
await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
@@ -26,7 +26,7 @@ public async Task Setup()
public async Task Given_Events_Page_When_Navigated_Then_It_Should_Have_ListEventDetailsComponent()
{
// Act
- var adminEventsComponent = await Page.QuerySelectorAsync("#admin-events-component");
+ var adminEventsComponent = await Page.QuerySelectorAsync("#admin-events");
// Assert
adminEventsComponent.Should().NotBeNull();
@@ -44,4 +44,10 @@ public async Task Given_Events_Page_When_Navigated_Then_It_Should_Have_EventDeta
// Assert
adminEventsTable.Should().NotBeNull();
}
+
+ [TearDown]
+ public async Task CleanUp()
+ {
+ await Page.CloseAsync();
+ }
}
diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/HomePageTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/HomePageTests.cs
index e81b6ee1..61d2e50d 100644
--- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/HomePageTests.cs
+++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/HomePageTests.cs
@@ -1,32 +1,38 @@
-using Microsoft.Playwright;
-using Microsoft.Playwright.NUnit;
-
-namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages;
-
-[Parallelizable(ParallelScope.Self)]
-[TestFixture]
-[Property("Category", "Integration")]
-public class HomePageTests : PageTest
-{
- public override BrowserNewContextOptions ContextOptions() => new()
- {
- IgnoreHTTPSErrors = true,
- };
-
- [SetUp]
- public async Task Setup()
- {
- await Page.GotoAsync("https://localhost:5001");
- await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
- }
-
- [Test]
- public void Given_Root_Page_When_Navigated_Then_It_Should_No_Sidebar()
- {
- // Act
- var sidebar = Page.Locator("div.sidebar");
-
- // Assert
- Expect(sidebar).Equals(null);
- }
-}
+using Microsoft.Playwright;
+using Microsoft.Playwright.NUnit;
+
+namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages;
+
+[Parallelizable(ParallelScope.Self)]
+[TestFixture]
+[Property("Category", "Integration")]
+public class HomePageTests : PageTest
+{
+ public override BrowserNewContextOptions ContextOptions() => new()
+ {
+ IgnoreHTTPSErrors = true,
+ };
+
+ [SetUp]
+ public async Task Init()
+ {
+ await Page.GotoAsync("https://localhost:5001");
+ await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
+ }
+
+ [Test]
+ public void Given_Root_Page_When_Navigated_Then_It_Should_No_Sidebar()
+ {
+ // Act
+ var sidebar = Page.Locator("div.sidebar");
+
+ // Assert
+ Expect(sidebar).Equals(null);
+ }
+
+ [TearDown]
+ public async Task CleanUp()
+ {
+ await Page.CloseAsync();
+ }
+}
diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/PlaygroundPageTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/PlaygroundPageTests.cs
index 338975ce..c4b4da2a 100644
--- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/PlaygroundPageTests.cs
+++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/PlaygroundPageTests.cs
@@ -1,101 +1,107 @@
-using FluentAssertions;
-
-using Microsoft.Playwright;
-using Microsoft.Playwright.NUnit;
-
-namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages;
-
-[Parallelizable(ParallelScope.Self)]
-[TestFixture]
-[Property("Category", "Integration")]
-public class PlaygroundPageTests : PageTest
-{
- public override BrowserNewContextOptions ContextOptions() => new() { IgnoreHTTPSErrors = true, };
-
- [SetUp]
- public async Task SetUp()
- {
- await Page.GotoAsync("https://localhost:5001/playground/");
- await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
- }
-
- [Test]
- public async Task Given_Page_When_Endpoint_Invoked_Then_It_Should_Show_Header()
- {
- // Arrange
- var header = Page.Locator("div.layout")
- .Locator("header.header")
- .Locator("div.header-gutters")
- .Locator("h1");
-
- // Act
- var headerText = await header.TextContentAsync();
-
- // Assert
- headerText.Should().Be("Azure OpenAI Proxy Playground");
- }
-
- [Test]
- [TestCase("config-grid")]
- [TestCase("chat-grid")]
- public async Task Given_Page_When_Endpoint_Invoked_Then_It_Should_Show_Panels(string id)
- {
- // Act
- var panel = Page.Locator($"div.{id}");
-
- // Assert
- await Expect(panel).ToBeVisibleAsync();
- }
-
- [Test]
- public async Task Given_ConfigTab_When_Endpoint_Invoked_Then_ConfigTab_Should_Be_Displayed()
- {
- // Act
- var configTab = Page.Locator("fluent-tabs#config-tab");
-
- // Assert
- await Expect(configTab).ToBeVisibleAsync();
- }
-
- [Test]
- public async Task Given_ConfigTab_When_Endpoint_Invoked_Then_Id_Should_Be_System_Message_Tab()
- {
- // Act
- var systemMessagePanel = Page.Locator("fluent-tab-panel#system-message-tab-panel");
- var parameterPanel = Page.Locator("fluent-tab-panel#parameters-tab-panel");
-
- // Assert
- await Expect(systemMessagePanel).ToBeVisibleAsync();
- await Expect(parameterPanel).ToBeHiddenAsync();
- }
-
- [Test]
- [TestCase(
- "fluent-tab#parameters-tab",
- "fluent-tab-panel#parameters-tab-panel",
- "fluent-tab-panel#system-message-tab-panel"
- )]
- [TestCase(
- "fluent-tab#system-message-tab",
- "fluent-tab-panel#system-message-tab-panel",
- "fluent-tab-panel#parameters-tab-panel"
- )]
- public async Task Given_ConfigTab_When_Changed_Then_Tab_Should_Be_Updated(
- string selectedTabSelector,
- string selectedPanelSelector,
- string hiddenPanelSelector
- )
- {
- // Arrange
- var selectedTab = Page.Locator(selectedTabSelector);
- var selectedPanel = Page.Locator(selectedPanelSelector);
- var hiddenPanel = Page.Locator(hiddenPanelSelector);
-
- // Act
- await selectedTab.ClickAsync();
-
- // Assert
- await Expect(selectedPanel).ToBeVisibleAsync();
- await Expect(hiddenPanel).ToBeHiddenAsync();
- }
+using FluentAssertions;
+
+using Microsoft.Playwright;
+using Microsoft.Playwright.NUnit;
+
+namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages;
+
+[Parallelizable(ParallelScope.Self)]
+[TestFixture]
+[Property("Category", "Integration")]
+public class PlaygroundPageTests : PageTest
+{
+ public override BrowserNewContextOptions ContextOptions() => new() { IgnoreHTTPSErrors = true, };
+
+ [SetUp]
+ public async Task Init()
+ {
+ await Page.GotoAsync("https://localhost:5001/playground/");
+ await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
+ }
+
+ [Test]
+ public async Task Given_Page_When_Endpoint_Invoked_Then_It_Should_Show_Header()
+ {
+ // Arrange
+ var header = Page.Locator("div.layout")
+ .Locator("header.header")
+ .Locator("div.header-gutters")
+ .Locator("h1");
+
+ // Act
+ var headerText = await header.TextContentAsync();
+
+ // Assert
+ headerText.Should().Be("Azure OpenAI Proxy Playground");
+ }
+
+ [Test]
+ [TestCase("config-grid")]
+ [TestCase("chat-grid")]
+ public async Task Given_Page_When_Endpoint_Invoked_Then_It_Should_Show_Panels(string id)
+ {
+ // Act
+ var panel = Page.Locator($"div.{id}");
+
+ // Assert
+ await Expect(panel).ToBeVisibleAsync();
+ }
+
+ [Test]
+ public async Task Given_ConfigTab_When_Endpoint_Invoked_Then_ConfigTab_Should_Be_Displayed()
+ {
+ // Act
+ var configTab = Page.Locator("fluent-tabs#config-tab");
+
+ // Assert
+ await Expect(configTab).ToBeVisibleAsync();
+ }
+
+ [Test]
+ public async Task Given_ConfigTab_When_Endpoint_Invoked_Then_Id_Should_Be_System_Message_Tab()
+ {
+ // Act
+ var systemMessagePanel = Page.Locator("fluent-tab-panel#system-message-tab-panel");
+ var parameterPanel = Page.Locator("fluent-tab-panel#parameters-tab-panel");
+
+ // Assert
+ await Expect(systemMessagePanel).ToBeVisibleAsync();
+ await Expect(parameterPanel).ToBeHiddenAsync();
+ }
+
+ [Test]
+ [TestCase(
+ "fluent-tab#parameters-tab",
+ "fluent-tab-panel#parameters-tab-panel",
+ "fluent-tab-panel#system-message-tab-panel"
+ )]
+ [TestCase(
+ "fluent-tab#system-message-tab",
+ "fluent-tab-panel#system-message-tab-panel",
+ "fluent-tab-panel#parameters-tab-panel"
+ )]
+ public async Task Given_ConfigTab_When_Changed_Then_Tab_Should_Be_Updated(
+ string selectedTabSelector,
+ string selectedPanelSelector,
+ string hiddenPanelSelector
+ )
+ {
+ // Arrange
+ var selectedTab = Page.Locator(selectedTabSelector);
+ var selectedPanel = Page.Locator(selectedPanelSelector);
+ var hiddenPanel = Page.Locator(hiddenPanelSelector);
+
+ // Act
+ await selectedTab.ClickAsync();
+
+ // Assert
+ await Expect(selectedPanel).ToBeVisibleAsync();
+ await Expect(hiddenPanel).ToBeHiddenAsync();
+ }
+
+ [TearDown]
+ public async Task CleanUp()
+ {
+ await Page.CloseAsync();
+ }
}
\ No newline at end of file
diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/TestsPageTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/TestsPageTests.cs
index 4acd2d1d..0d4ca2f1 100644
--- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/TestsPageTests.cs
+++ b/test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/TestsPageTests.cs
@@ -1,72 +1,128 @@
-using Microsoft.Playwright;
-using Microsoft.Playwright.NUnit;
-
-namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages;
-
-[Parallelizable(ParallelScope.Self)]
-[TestFixture]
-[Property("Category", "Integration")]
-public class TestsPageTests : PageTest
-{
- public override BrowserNewContextOptions ContextOptions() => new()
- {
- IgnoreHTTPSErrors = true,
- };
-
- [SetUp]
- public async Task Setup()
- {
- // Arrange
- await Page.GotoAsync("https://localhost:5001/tests");
- await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
- }
-
- [Test]
- [TestCase("debug-target")]
- [TestCase("debug-button")]
- [TestCase("deployment-model-list")]
- [TestCase("debug-button-selected-model")]
- public async Task Given_ComponentID_When_Page_Loaded_Then_Component_Should_Be_Visible(string id)
- {
- // Arrange
- var expectedId = id;
-
- // Act
- var component = Page.Locator($"#{expectedId}");
-
- // Assert
- await Expect(component).ToBeVisibleAsync();
- }
-
- [Test]
- public async Task Given_No_Input_On_DebugTarget_When_DebugButton_Clicked_Then_Toast_Should_Show_NullMessage()
- {
- // Arrange
- var button = Page.Locator("fluent-button#debug-button");
-
- // Act
- await button.ClickAsync();
-
- // Assert
- await Expect(Page.Locator(".fluent-toast-title")).ToHaveTextAsync("Input is null.");
- }
-
- [Test]
- [TestCase(123, typeof(int))]
- [TestCase(456, typeof(int))]
- [TestCase(789, typeof(int))]
- public async Task Given_Input_On_DebugTarget_When_DebugButton_Clicked_Then_Toast_Should_Show_Input(int inputValue, Type inputType)
- {
- // Arrange
- var radio = Page.Locator("fluent-radio-group#debug-target")
- .Locator($"fluent-radio[current-value='{inputValue}']");
- var button = Page.Locator("fluent-button#debug-button");
-
- // Act
- await radio.ClickAsync();
- await button.ClickAsync();
-
- // Assert
- await Expect(Page.Locator(".fluent-toast-title")).ToHaveTextAsync($"{inputValue} (Type: {inputType})");
- }
+using FluentAssertions;
+
+using Microsoft.Playwright;
+using Microsoft.Playwright.NUnit;
+
+namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages;
+
+[Parallelizable(ParallelScope.Self)]
+[TestFixture]
+[Property("Category", "Integration")]
+public class TestsPageTests : PageTest
+{
+ public override BrowserNewContextOptions ContextOptions() => new()
+ {
+ IgnoreHTTPSErrors = true,
+ };
+
+ [SetUp]
+ public async Task Setup()
+ {
+ // Arrange
+ await Page.GotoAsync("https://localhost:5001/tests");
+ await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
+ }
+
+ [Test]
+ public async Task Given_No_Input_On_DebugTarget_When_DebugButton_Clicked_Then_Toast_Should_Show_NullMessage()
+ {
+ // Arrange
+ var button = Page.Locator("fluent-button#debug-button");
+
+ // Act
+ await button.ClickAsync();
+
+ // Assert
+ await Expect(Page.Locator(".fluent-toast-title")).ToHaveTextAsync("Input is null.");
+ }
+
+ [Test]
+ [TestCase(123, typeof(int))]
+ [TestCase(456, typeof(int))]
+ [TestCase(789, typeof(int))]
+ public async Task Given_Input_On_DebugTarget_When_DebugButton_Clicked_Then_Toast_Should_Show_Input(int inputValue, Type expectedType)
+ {
+ // Arrange
+ var radio = Page.Locator("fluent-radio-group#debug-target")
+ .Locator($"fluent-radio[current-value='{inputValue}']");
+ var button = Page.Locator("fluent-button#debug-button");
+
+ // Act
+ await radio.ClickAsync();
+ await button.ClickAsync();
+
+ // Assert
+ await Expect(Page.Locator(".fluent-toast-title")).ToHaveTextAsync($"{inputValue} (Type: {expectedType})");
+ }
+
+ [Test]
+ [TestCase("deployment-model-label", "Deployment")]
+ public async Task Given_Label_When_Page_Loaded_Then_Label_Should_Be_Visible(string id, string expected)
+ {
+ // Arrange
+ var label = Page.Locator($"label#{id}");
+
+ // Act
+ var result = await label.TextContentAsync();
+
+ // Assert
+ result.Should().Be(expected);
+ }
+
+ [Test]
+ [TestCase("deployment-model-list-options")]
+ public async Task Given_DropdownList_When_Page_Loaded_Then_DropdownList_Should_Be_Visible(string id)
+ {
+ // Act
+ var select = Page.Locator($"fluent-select#{id}");
+
+ // Assert
+ await Expect(select).ToBeVisibleAsync();
+ }
+
+ [Test]
+ [TestCase("deployment-model-list-options")]
+ public async Task Given_DropdownList_When_DropdownList_Clicked_And_DropdownOptions_Appeared_Then_All_DropdownOptions_Should_Be_Visible(string id)
+ {
+ // Arrange
+ var fluentSelect = Page.Locator($"fluent-select#{id}");
+
+ // Act
+ await fluentSelect.ClickAsync();
+ var fluentOptions = fluentSelect.Locator("fluent-option");
+
+ // Assert
+ for (int i = 0; i < await fluentOptions.CountAsync(); i++)
+ {
+ await Expect(fluentOptions.Nth(i)).ToBeVisibleAsync();
+ }
+ }
+
+ [Test]
+ [TestCase(2, "AZ", typeof(string))]
+ [TestCase(4, "CA", typeof(string))]
+ [TestCase(6, "CT", typeof(string))]
+ [TestCase(8, "FL", typeof(string))]
+ public async Task Given_DropdownOptions_And_ExpectedValue_When_Third_DropdownOption_Selected_And_DropdownValue_Updated_Then_DropdownValue_Should_Match_ExpectedValue(int index, string expectedValue, Type expectedType)
+ {
+ // Arrange
+ var fluentSelect = Page.Locator("fluent-select#deployment-model-list-options");
+ await fluentSelect.ClickAsync();
+ var fluentOptions = fluentSelect.Locator("fluent-option");
+ var button = Page.Locator("fluent-button#debug-button-deployment-model-list");
+
+ // Act
+ await fluentOptions.Nth(index).ScrollIntoViewIfNeededAsync();
+ await fluentOptions.Nth(index).ClickAsync();
+ await button.ClickAsync();
+
+ // Assert
+ await Expect(Page.Locator(".fluent-toast-title")).ToHaveTextAsync($"{expectedValue} (Type: {expectedType})");
+ }
+
+ [TearDown]
+ public async Task CleanUp()
+ {
+ await Page.CloseAsync();
+ }
}
\ No newline at end of file
diff --git a/test/AzureOpenAIProxy.PlaygroundApp.Tests/UI/DeploymentModelListComponentTests.cs b/test/AzureOpenAIProxy.PlaygroundApp.Tests/UI/DeploymentModelListComponentTests.cs
deleted file mode 100644
index d418011d..00000000
--- a/test/AzureOpenAIProxy.PlaygroundApp.Tests/UI/DeploymentModelListComponentTests.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-using Microsoft.Playwright.NUnit;
-using Microsoft.Playwright;
-using FluentAssertions;
-
-namespace AzureOpenAIProxy.PlaygroundApp.Tests.UI
-{
- [Parallelizable(ParallelScope.Self)]
- [TestFixture]
- [Property("Category", "Integration")]
- public class ModelDropdownListComponentTests : PageTest
- {
- public override BrowserNewContextOptions ContextOptions() => new()
- {
- IgnoreHTTPSErrors = true,
- };
-
- [SetUp]
- public async Task Init()
- {
- await Page.GotoAsync("http://localhost:5000/tests");
- await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
- }
-
- [Test]
- public async Task Given_DropdownComponentID_When_Page_Loaded_Then_DropdownComponent_Should_Be_Visible()
- {
- // Arrange
- var expectedId = "deployment-model-list";
-
- // Act
- var component = Page.Locator($"#{expectedId}");
-
- // Assert
- await Expect(component).ToBeVisibleAsync();
- }
-
- [Test]
- // 페이지에서 컴포넌트 레이블이 올바르게 표시되는지 확인
- public async Task Given_Label_When_Page_Loaded_Then_Label_Should_Be_Visible()
- {
- // Act
- var label = Page.GetByText("Deployment");
-
- // Assert
- await Expect(label).ToBeVisibleAsync();
- }
-
- [Test]
- // 페이지에서 드롭다운 컴포넌트가 올바르게 표시되는지 확인
- public async Task Given_DropdownList_When_Page_Loaded_Then_DropdownList_Should_Be_Visible()
- {
- // Act
- var fluentSelect = Page.Locator("fluent-select#deployment-model-list-options");
-
- // Assert
- await Expect(fluentSelect).ToBeVisibleAsync();
- }
-
- [Test]
- // 드롭다운의 옵션 값이 존재하는지 확인
- public async Task Given_DropdownList_When_DropdownList_Clicked_And_DropdownOptions_Appeared_Then_All_DropdownOptions_Should_Be_Visible()
- {
- // Arrange
- var fluentSelect = Page.Locator("fluent-select#deployment-model-list-options");
-
- // Act
- await fluentSelect.ClickAsync();
- var fluentOptions = fluentSelect.Locator("fluent-option");
-
- // Assert
- for (int i = 0; i < await fluentOptions.CountAsync(); i++)
- {
- await Expect(fluentOptions.Nth(i)).ToBeVisibleAsync();
- }
- }
-
- [Test]
- [TestCase("AZ", 2)]
- [TestCase("CA", 4)]
- [TestCase("CT", 6)]
- [TestCase("FL", 8)]
- // 드롭다운의 옵션 값을 선택하면 부모 컴포넌트(페이지 컴포넌트)에 올바르게 업데이트 되는지 확인
- public async Task Given_DropdownOptions_And_ExpectedValue_When_Third_DropdownOption_Selected_And_DropdownValue_Updated_Then_DropdownValue_Should_Match_ExpectedValue(string exp, int n)
- {
- // Arrange
- var fluentSelect = Page.Locator("fluent-select#deployment-model-list-options");
- await fluentSelect.ClickAsync();
- var fluentOptions = fluentSelect.Locator("fluent-option");
- var expectedValue = exp; // 실제 컴포넌트 옵션 값
-
- // Act
- await fluentOptions.Nth(n).ScrollIntoViewIfNeededAsync(); // 선택할 컴포넌트 옵션 보이도록 스크롤
- await fluentOptions.Nth(n).ClickAsync(); // 옵션 클릭
- var actualValue = await Page.EvaluateAsync("() => document.querySelector('fluent-select#deployment-model-list-options').value"); // 페이지 내 컴포넌트 값 가져오기
-
- // Assert
- actualValue.Should().Be(expectedValue);
- }
-
- [TearDown]
- public async Task CleanUp()
- {
- await Page.CloseAsync();
- }
- }
-}
\ No newline at end of file