-
Notifications
You must be signed in to change notification settings - Fork 18
[Playground] Component - list of deployment models (UI only) #172 #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
justinyoo
merged 40 commits into
aliencube:main
from
yjchun626:feature/172-deployment-model-list
Sep 6, 2024
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
5a716e2
Update GHA workflow
justinyoo cd02479
Merge branch 'aliencube:main' into main
yjchun626 8a0e04f
Merge branch 'aliencube:main' into main
yjchun626 831c6a1
Playground project에 FluentUI 패키지 추가 & dropdown UI 컴포넌트 .razor 파일 생성
yjchun626 916d068
Home.razor에 DeploymentModelListComponent 추가
yjchun626 a4b34b8
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 652e8b6
Merge branch 'aliencube:main' into main
yjchun626 2b7cd4b
DeploymentModelListComponent에 대한 test 코드 파일 추가
yjchun626 401853d
test code 파일 수정
yjchun626 504634f
Merge branch 'main' of https://github.com/yjchun626/azure-openai-sdk-…
yjchun626 a003f6c
DeploymentModelList 컴포넌트 파일 & 테스트 코드 파일 수정
yjchun626 13d5817
Merge branch 'feature/172-deployment-model-list' of https://github.co…
yjchun626 4427061
PackageReference 관련 파일 수정
yjchun626 ed640f6
Merge branch 'feature/172-deployment-model-list' of https://github.co…
yjchun626 1b9fc5c
Test code (Playwright, bUnit) 수정
yjchun626 3f9c2dc
Playwright test code - Headless mode 설정
yjchun626 7cfe09e
Playwright test code 수정 및 컴포넌트 테스트 용 Tests.razor 페이지 추가
yjchun626 3a190c2
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 74c05ca
Playwright 로컬 호스트 접속 url 수정
yjchun626 6f30180
Playwright 테스트 코드 수정
yjchun626 86aa7a7
중복 코드 및 bUnit 테스트 삭제
yjchun626 03d54e5
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 cd545ac
DeploymentModelListComponent.razor 수정 - 컴포넌트 이벤트 콜백 부분 수정
yjchun626 b820b07
Playwright 테스트 코드 수정(현재 로컬에서 테스트 시 모두 fail - 수정 더 필요함)
yjchun626 a5d4b50
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 4a67022
DeploymentModelList 컴포넌트 파일에 OnInitializedAsync(), Tests.razor에 OnAft…
yjchun626 7449723
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 3b8b85f
DeploymentModelList 컴포넌트 파일 이벤트 콜백 메소드 & 테스트 코드 파일 메소드 이름 수정, Tests.r…
yjchun626 cb045ea
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 101c17e
Tests.razor OnInitialized -> OnInitializedAsync로 변경
yjchun626 9dfcaeb
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 07a052c
Test 코드 - Arrange, Act, Assert 명시 및 파라미터라이징 등 수정, 드롭다운 컴포넌트 코드 - 필드 s…
yjchun626 34a9bae
Merge branch 'feature/172-deployment-model-list' of https://github.co…
yjchun626 8e20784
드롭다운 컴포넌트 파일 - 불필요한 using 삭제
yjchun626 48f9ea7
Tests.razor 메소드 async 수정 및 드롭다운 컴포넌트 값 확인 DebugButtonComponent로 가능하게 수정
yjchun626 f3ed222
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 c02dd33
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 1b882c9
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 f2d63f7
DeploymentModelListComponent - Id 파라미터 추가 및 Tests.razor 컴포넌트에 Id 값 지정…
yjchun626 f540bb6
Merge branch 'aliencube:main' into feature/172-deployment-model-list
yjchun626 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/AzureOpenAIProxy.PlaygroundApp/Components/UI/DeploymentModelListComponent.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<FluentLayout Id="@Id" Style="margin: 10px;"> | ||
<div style="display: flex; align-items: center; margin-bottom: 5px;"> | ||
<label id="deployment-model-label" for="deployment-model-list-options" style="margin-right: 5px;">Deployment</label> | ||
<span style="color: red;">*</span> | ||
</div> | ||
|
||
<FluentSelect Items=@deploymentModelOptions Id="deployment-model-list-options" name="deployment-models" | ||
TOption="Option<string>" Height="300px" | ||
OptionText="@(e => e.Text?.ToString())" | ||
OptionValue="@(e => e.Value?.ToString())" | ||
OptionSelected="@(e => e.Selected)" | ||
@bind-SelectedOption="@selectedOption" | ||
@onclick="OnValueChanged" | ||
aria-labelledby="deployment-model-label"> | ||
</FluentSelect> | ||
</FluentLayout> | ||
|
||
@code { | ||
[Parameter] | ||
justinyoo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public string? Id { get; set; } | ||
private Option<string>? selectedOption { get; set; } = new(); | ||
|
||
justinyoo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[Parameter] | ||
public EventCallback<string> OnUserOptionSelected { get; set; } | ||
|
||
private async Task OnValueChanged() | ||
{ | ||
string? selectedValue = selectedOption?.Value?.ToString(); | ||
await OnUserOptionSelected.InvokeAsync(selectedValue); | ||
} | ||
|
||
static List<Option<string>> deploymentModelOptions = new() | ||
{ | ||
new Option<string> { Value = "AL", Text = "Alabama" }, | ||
new Option<string> { Value = "AK", Text = "Alaska" }, | ||
new Option<string> { Value = "AZ", Text = "Arizona" }, | ||
new Option<string> { Value = "AR", Text = "Arkansas" }, | ||
new Option<string> { Value = "CA", Text = "California" }, | ||
new Option<string> { Value = "CO", Text = "Colorado" }, | ||
new Option<string> { Value = "CT", Text = "Connecticut" }, | ||
new Option<string> { Value = "DE", Text = "Delaware" }, | ||
new Option<string> { Value = "FL", Text = "Florida" }, | ||
new Option<string> { Value = "GA", Text = "Georgia" }, | ||
new Option<string> { Value = "HI", Text = "Hawaii" }, | ||
new Option<string> { Value = "ID", Text = "Idaho" }, | ||
new Option<string> { Value = "IL", Text = "Illinois" }, | ||
new Option<string> { Value = "IN", Text = "Indiana" }, | ||
new Option<string> { Value = "IA", Text = "Iowa" }, | ||
new Option<string> { Value = "KS", Text = "Kansas" }, | ||
new Option<string> { Value = "KY", Text = "Kentucky" }, | ||
new Option<string> { Value = "LA", Text = "Louisiana" }, | ||
new Option<string> { Value = "ME", Text = "Maine" }, | ||
new Option<string> { Value = "MD", Text = "Maryland" }, | ||
new Option<string> { Value = "MA", Text = "Massachussets" }, | ||
new Option<string> { Value = "MI", Text = "Michigain" }, | ||
new Option<string> { Value = "MN", Text = "Minnesota" }, | ||
new Option<string> { Value = "MS", Text = "Mississippi" }, | ||
new Option<string> { Value = "MO", Text = "Missouri" }, | ||
new Option<string> { Value = "MT", Text = "Montana" }, | ||
new Option<string> { Value = "NE", Text = "Nebraska" }, | ||
new Option<string> { Value = "NV", Text = "Nevada" }, | ||
new Option<string> { Value = "NH", Text = "New Hampshire" }, | ||
new Option<string> { Value = "NJ", Text = "New Jersey" }, | ||
new Option<string> { Value = "NM", Text = "New Mexico" }, | ||
new Option<string> { Value = "NY", Text = "New York" }, | ||
new Option<string> { Value = "NC", Text = "North Carolina" }, | ||
new Option<string> { Value = "ND", Text = "North Dakota" }, | ||
new Option<string> { Value = "OH", Text = "Ohio" }, | ||
new Option<string> { Value = "OK", Text = "Oklahoma" }, | ||
new Option<string> { Value = "OR", Text = "Oregon" }, | ||
new Option<string> { Value = "PA", Text = "Pennsylvania" } | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
test/AzureOpenAIProxy.PlaygroundApp.Tests/UI/DeploymentModelListComponentTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
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(); | ||
justinyoo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
[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<string>("() => document.querySelector('fluent-select#deployment-model-list-options').value"); // 페이지 내 컴포넌트 값 가져오기 | ||
|
||
// Assert | ||
actualValue.Should().Be(expectedValue); | ||
} | ||
|
||
[TearDown] | ||
public async Task CleanUp() | ||
{ | ||
await Page.CloseAsync(); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.