Skip to content
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

[Playground] 177 auth UI component #280

Merged
merged 43 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
88c3a3d
Add files via upload
pmj-chosim Aug 31, 2024
ae6e63a
testcode
pmj-chosim Aug 31, 2024
e523195
add Api key comoponent
pmj-chosim Aug 31, 2024
1ed7d57
Action test
pmj-chosim Aug 31, 2024
6694f2f
Merge branch 'aliencube:main' into feature/177-auth-ui-component
pmj-chosim Aug 31, 2024
7122e72
component code(callback) modify
pmj-chosim Aug 31, 2024
5931901
test code modify
pmj-chosim Aug 31, 2024
d29f2a3
upstream
pmj-chosim Aug 31, 2024
0b7b4f2
upstream update
pmj-chosim Aug 31, 2024
cb4a7d6
Merge branch 'main' of https://github.com/aliencube/azure-openai-sdk-…
pmj-chosim Aug 31, 2024
19f25e6
test code modify 1
pmj-chosim Aug 31, 2024
6a8adfd
test code modify from Assert to FluentAssertions
pmj-chosim Aug 31, 2024
1edd331
전반적인 수정
pmj-chosim Aug 31, 2024
6c2542f
update upstream
pmj-chosim Aug 31, 2024
04f3c00
Action test
pmj-chosim Aug 31, 2024
96ad4f5
Merge branch 'aliencube:main' into feature/177-auth-ui-component
pmj-chosim Aug 31, 2024
e556a10
Update Home.razor
pmj-chosim Aug 31, 2024
302fadf
Action error test
pmj-chosim Aug 31, 2024
fa6eac3
Update ApiKeyInputComponent.razor
pmj-chosim Aug 31, 2024
5a7cd97
Update Home.razor
pmj-chosim Aug 31, 2024
48a6edb
testcode error modify
pmj-chosim Aug 31, 2024
8947ac0
test code modify2
pmj-chosim Aug 31, 2024
473e28b
Merge branch 'aliencube:main' into feature/177-auth-ui-component
pmj-chosim Sep 1, 2024
214a9f5
html id & testcode pwd & eliment checking
pmj-chosim Sep 1, 2024
cad251b
add test code for testpage
pmj-chosim Sep 1, 2024
0f00ed3
전반적인 수정
pmj-chosim Sep 1, 2024
f927e52
Merge remote-tracking branch 'upstream/main' into feature/177-auth-ui…
pmj-chosim Sep 1, 2024
5f4c83d
Merge branch 'aliencube:main' into feature/177-auth-ui-component
pmj-chosim Sep 3, 2024
673ddfd
fluent delete
pmj-chosim Sep 3, 2024
2ac45c6
apikey component razor modify
pmj-chosim Sep 5, 2024
badb4aa
playground page test code modify
pmj-chosim Sep 5, 2024
91f41c9
playground.razor apikeycomponent id modify
pmj-chosim Sep 5, 2024
c5326d1
add test code for test page
pmj-chosim Sep 5, 2024
14b9955
testcode for testpage modify about apikeyinputcomponent
pmj-chosim Sep 6, 2024
9b55986
sync new merge in upstream
pmj-chosim Sep 12, 2024
44774cf
back to test page latest modify: here is 2nd latest modify code
pmj-chosim Sep 12, 2024
fbe0181
merge conflict modify
pmj-chosim Sep 14, 2024
05c88d8
add required and data-type in api component.razor
pmj-chosim Sep 14, 2024
7dc21ab
Merge branch 'aliencube:main' into feature/177-auth-ui-component
pmj-chosim Sep 14, 2024
f2133e3
playwright package miss commit delete
pmj-chosim Sep 14, 2024
12a4e09
Merge branch 'feature/177-auth-ui-component' of https://github.com/pm…
pmj-chosim Sep 14, 2024
4613595
delete unnecessary variable in playgroundtest
pmj-chosim Sep 14, 2024
b7ab576
delete unnecessary library in testpagestests.cs
pmj-chosim Sep 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
Welcome to your new app.

<ChatWindowComponent @rendermode="InteractiveServer"/>
<ApiKeyInputComponent @rendermode="InteractiveServer" />
justinyoo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@

<h1>playground page!</h1>

<ConfigTabComponent @rendermode="InteractiveServer"/>
<ConfigTabComponent @rendermode="InteractiveServer"/>
<ApiKeyInputComponent @rendermode="InteractiveServer" />
justinyoo marked this conversation as resolved.
Show resolved Hide resolved


Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@using AzureOpenAIProxy.PlaygroundApp.Clients
justinyoo marked this conversation as resolved.
Show resolved Hide resolved

<FluentTextField @bind-Value=apiKeyValue TextFieldType="TextFieldType.Password" @oninput="SetApiKey">API key input</FluentTextField>

@code {
private string? apiKeyValue { get; set; }
justinyoo marked this conversation as resolved.
Show resolved Hide resolved

justinyoo marked this conversation as resolved.
Show resolved Hide resolved
[Parameter]
public EventCallback<string> OnKeyInput { get; set; }
justinyoo marked this conversation as resolved.
Show resolved Hide resolved

private async Task SetApiKey(ChangeEventArgs e)
{
apiKeyValue = e?.Value?.ToString();
justinyoo marked this conversation as resolved.
Show resolved Hide resolved
if (apiKeyValue != null)
{
await OnKeyInput.InvokeAsync(apiKeyValue);
}
justinyoo marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.Playwright;
using Microsoft.Playwright.NUnit;
using FluentAssertions;
justinyoo marked this conversation as resolved.
Show resolved Hide resolved

namespace AzureOpenAIProxy.PlaygroundApp.Tests.Pages;

Expand Down Expand Up @@ -68,4 +69,49 @@ string hiddenPanelSelector
await Expect(selectedPanel).ToBeVisibleAsync();
await Expect(hiddenPanel).ToBeHiddenAsync();
}

[Test]
justinyoo marked this conversation as resolved.
Show resolved Hide resolved
public async Task Given_ApiKeyInputField_When_FieldIsLoaded_Then_FieldIsMaskedByDefault()
justinyoo marked this conversation as resolved.
Show resolved Hide resolved
{
// Arrange
var apiKeyInput = Page.Locator("fluent-text-field >> input");
justinyoo marked this conversation as resolved.
Show resolved Hide resolved

// Act
var inputType = await apiKeyInput.GetAttributeAsync("type");

// Assert
inputType.Should().NotBeNull("API 키 입력 필드의 타입을 가져오는 데 실패했습니다.");
inputType.Should().Be("password", "API 키 입력 필드는 기본적으로 마스킹되어 있어야 합니다.");
justinyoo marked this conversation as resolved.
Show resolved Hide resolved
}

[Test]
[TestCase("test-api-key-1")]
[TestCase("example-key-123")]
public async Task Given_ApiKeyInputField_When_ValuesAreEntered_Then_FieldDisplaysInputValue(string apiKey)
{
// Arrange
var apiKeyInput = Page.Locator("fluent-text-field >> input");

// Act
await apiKeyInput.FillAsync(apiKey);

// Assert
await Expect(apiKeyInput).ToHaveValueAsync(apiKey);
}

[Test]
public async Task Given_ApiKeyInputField_When_ValueIsSet_Then_CurrentValueShouldBeCorrect()
{
// Arrange
var apiKeyInput = Page.Locator("fluent-text-field >> input");
var apiKey = "test-api-key";

// Act
await apiKeyInput.FillAsync(apiKey);
var currentValue = await apiKeyInput.InputValueAsync();

// Assert
currentValue.Should().Be(apiKey, "API 키 입력 필드에 값이 제대로 설정되지 않았습니다.");
}
justinyoo marked this conversation as resolved.
Show resolved Hide resolved

}