File tree Expand file tree Collapse file tree 9 files changed +91
-39
lines changed
src/AzureOpenAIProxy.PlaygroundApp/Components/Layout
AzureOpenAIProxy.ApiApp.Tests
AzureOpenAIProxy.PlaygroundApp.Tests Expand file tree Collapse file tree 9 files changed +91
-39
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,18 @@ jobs:
5353 run : |
5454 dotnet build
5555
56+ - name : Install playwright
57+ shell : pwsh
58+ run : |
59+ $playwright = Get-ChildItem -File Microsoft.Playwright.dll -Path . -Recurse
60+ $installer = "$($playwright[0].Directory.FullName)/playwright.ps1"
61+ & "$installer" install
62+
5663 - name : Run unit tests
5764 shell : bash
5865 run : |
59- dotnet test ./test/AzureOpenAIProxy.AppHost.Tests --logger "trx" --collect:"XPlat Code Coverage"
60- dotnet test ./test/AzureOpenAIProxy.ApiApp.Tests --logger "trx" --collect:"XPlat Code Coverage"
66+ dotnet test ./test/AzureOpenAIProxy.AppHost.Tests --no-build -- logger "trx" --collect:"XPlat Code Coverage"
67+ dotnet test ./test/AzureOpenAIProxy.ApiApp.Tests --no-build -- logger "trx" --collect:"XPlat Code Coverage"
6168
6269 - name : Run integration tests
6370 shell : bash
6875
6976 sleep 30
7077
71- dotnet test ./test/AzureOpenAIProxy.PlaygroundApp.Tests --logger "trx" --collect:"XPlat Code Coverage"
78+ dotnet test ./test/AzureOpenAIProxy.PlaygroundApp.Tests --no-build -- logger "trx" --collect:"XPlat Code Coverage"
7279
7380 kill $DOTNET_PID
7481
Original file line number Diff line number Diff line change @@ -65,13 +65,20 @@ jobs:
6565 - name : Build solution
6666 shell : bash
6767 run : |
68- dotnet build
68+ dotnet build -c Release
69+
70+ - name : Install playwright
71+ shell : pwsh
72+ run : |
73+ $playwright = Get-ChildItem -File Microsoft.Playwright.dll -Path . -Recurse
74+ $installer = "$($playwright[0].Directory.FullName)/playwright.ps1"
75+ & "$installer" install
6976
7077 - name : Run unit tests
7178 shell : bash
7279 run : |
73- dotnet test ./test/AzureOpenAIProxy.AppHost.Tests --logger "trx" --collect:"XPlat Code Coverage"
74- dotnet test ./test/AzureOpenAIProxy.ApiApp.Tests --logger "trx" --collect:"XPlat Code Coverage"
80+ dotnet test ./test/AzureOpenAIProxy.AppHost.Tests -c Release --no-build - -logger "trx" --collect:"XPlat Code Coverage"
81+ dotnet test ./test/AzureOpenAIProxy.ApiApp.Tests -c Release --no-build - -logger "trx" --collect:"XPlat Code Coverage"
7582
7683 - name : Run integration tests
7784 shell : bash
8289
8390 sleep 30
8491
85- dotnet test ./test/AzureOpenAIProxy.PlaygroundApp.Tests --logger "trx" --collect:"XPlat Code Coverage"
92+ dotnet test ./test/AzureOpenAIProxy.PlaygroundApp.Tests -c Release --no-build - -logger "trx" --collect:"XPlat Code Coverage"
8693
8794 kill $DOTNET_PID
8895
Original file line number Diff line number Diff line change 1515 <OpenTelemetryExtensionsVersion >1.*</OpenTelemetryExtensionsVersion >
1616 <OpenTelemetryInstrumentationVersion >1.*</OpenTelemetryInstrumentationVersion >
1717 <SwashbuckleVersion >6.*</SwashbuckleVersion >
18+ <SystemTextJsonVersion >8.*</SystemTextJsonVersion >
1819 <FluentUIVersion >4.*</FluentUIVersion >
1920
2021 <CoverletVersion >6.*</CoverletVersion >
2122 <FluentAssertionsVersion >6.*</FluentAssertionsVersion >
2223 <MicrosoftTestSdkVersion >17.*</MicrosoftTestSdkVersion >
2324 <NSubstituteVersion >5.*</NSubstituteVersion >
24- <SystemTextJsonVersion >8.*</SystemTextJsonVersion >
25+ <NUnitVersion >4.*</NUnitVersion >
26+ <PlaywrightVersion >1.*</PlaywrightVersion >
2527 <XunitVersion >2.*</XunitVersion >
2628 </PropertyGroup >
2729</Project >
Original file line number Diff line number Diff line change 11@inherits LayoutComponentBase
22
33<div class =" page" >
4- <div class =" sidebar" >
5- <NavMenu />
6- </div >
7-
8- <main >
9- <div class =" top-row px-4" >
10- <a href =" https://learn.microsoft.com/aspnet/core/" target =" _blank" >About</a >
4+ @if (this ._isAdmin == true )
5+ {
6+ <div class =" sidebar" >
7+ <NavMenu />
118 </div >
9+ }
1210
11+ <main >
1312 <article class =" content px-4" >
1413 @Body
1514 </article >
Original file line number Diff line number Diff line change 1+ using Microsoft . AspNetCore . Components ;
2+
3+ namespace AzureOpenAIProxy . PlaygroundApp . Components . Layout ;
4+
5+ /// <summary>
6+ /// This represents the layout component for the main layout.
7+ /// </summary>
8+ public partial class MainLayout : LayoutComponentBase
9+ {
10+ private bool _isAdmin ;
11+
12+ /// <summary>
13+ /// Injects the <see cref="NavigationManager"/> instance.
14+ /// </summary>
15+ [ Inject ]
16+ private NavigationManager ? NavMan { get ; set ; }
17+
18+ /// <inheritdoc />
19+ protected override async Task OnInitializedAsync ( )
20+ {
21+ var path = new Uri ( this . NavMan ! . Uri ) . AbsolutePath ;
22+ this . _isAdmin = path . StartsWith ( "/admin" , StringComparison . CurrentCultureIgnoreCase ) ;
23+
24+ await Task . CompletedTask ;
25+ }
26+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- <Project Sdk =" Microsoft.NET.Sdk" >
1+ <Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
44 <IsPackable >false</IsPackable >
1515 </PackageReference >
1616 <PackageReference Include =" FluentAssertions" Version =" $(FluentAssertionsVersion)" />
1717 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" $(MicrosoftTestSdkVersion)" />
18- <PackageReference Include =" xunit " Version =" $(XunitVersion )" />
19- <PackageReference Include =" xunit.runner.visualstudio " Version =" $(XunitVersion )" >
18+ <PackageReference Include =" Microsoft.Playwright.NUnit " Version =" $(PlaywrightVersion )" />
19+ <PackageReference Include =" NUnit.Analyzers " Version =" $(NUnitVersion )" >
2020 <PrivateAssets >all</PrivateAssets >
2121 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
2222 </PackageReference >
23+ <PackageReference Include =" NUnit3TestAdapter" Version =" $(NUnitVersion)" />
2324 </ItemGroup >
2425
25- <ItemGroup >
26+ <!-- < ItemGroup>
2627 <ProjectReference Include="..\..\src\AzureOpenAIProxy.PlaygroundApp\AzureOpenAIProxy.PlaygroundApp.csproj" />
27- </ItemGroup >
28+ </ItemGroup>-->
2829
2930 <ItemGroup >
30- <Using Include =" Xunit " />
31+ <Using Include =" NUnit.Framework " />
3132 </ItemGroup >
3233
3334</Project >
Original file line number Diff line number Diff line change 1+ using Microsoft . Playwright ;
2+ using Microsoft . Playwright . NUnit ;
3+
4+ namespace AzureOpenAIProxy . PlaygroundApp . Tests . Pages ;
5+
6+ [ Parallelizable ( ParallelScope . Self ) ]
7+ [ TestFixture ]
8+ [ Property ( "Category" , "Integration" ) ]
9+ public class HomePageTests : PageTest
10+ {
11+ public override BrowserNewContextOptions ContextOptions ( ) => new ( )
12+ {
13+ IgnoreHTTPSErrors = true ,
14+ } ;
15+
16+ [ Test ]
17+ public async Task Given_Root_Page_When_Navigated_Then_It_Should_No_Sidebar ( )
18+ {
19+ // Arrange
20+ await this . Page . GotoAsync ( "https://localhost:5001" ) ;
21+
22+ // Act
23+ var sidebar = this . Page . Locator ( "div.sidebar" ) ;
24+
25+ // Assert
26+ Expect ( sidebar ) . Equals ( null ) ;
27+ }
28+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments