Skip to content

Commit 31aeacd

Browse files
authored
feat(templates): refactor bit Boilerplate automated tests #11036 (#11037)
1 parent 934afc7 commit 31aeacd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4565
-2482
lines changed

.github/workflows/bit.full.ci.yml

Lines changed: 14 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
55

66
env:
77
ConnectionStrings__SqlServerConnectionString: 'Data Source=localhost; Initial Catalog=BoilerplateTestDb;Application Name=Boilerplate;TrustServerCertificate=True;User Id=sa;Password=P@ssw0rdP@ssw0rd;'
8-
SIMPLE_TEST_FILTER: "ClassName!~PageTests"
9-
BLAZOR_SERVER_TEST_FILTER: "ClassName~PageTests.BlazorServer"
10-
BLAZOR_WASM_TEST_FILTER: "ClassName~PageTests.BlazorWebAssembly"
11-
MULTILINGUAL_DISABLED_TEST_FILTER: "ClassName!~LocalizationTests|TestCategory=MultilingualDisabled"
128

139
jobs:
1410

@@ -55,9 +51,8 @@ jobs:
5551
sa-password: P@ssw0rdP@ssw0rd
5652
show-log: true
5753

58-
- name: Simple tests (no --advancedTests)
59-
id: simple-test
60-
continue-on-error: true
54+
- name: Run tests usign Sqlite
55+
id: run-test-sqlite
6156
run: |
6257
dotnet new bit-bp --name SimpleTest --database Sqlite
6358
cd SimpleTest/src/Server/SimpleTest.Server.Api/
@@ -71,74 +66,34 @@ jobs:
7166
7267
- name: Upload Tests Artifact
7368
uses: actions/upload-artifact@v4.4.1
74-
if: ${{ !env.ACT && failure() && steps.simple-test.conclusion == 'failure' }}
69+
if: ${{ !env.ACT && failure() && steps.run-test-sqlite.conclusion == 'failure' }}
7570
with:
7671
name: tests-artifact
7772
path: ./SimpleTest/src/Tests/TestResults
7873
retention-days: 14
7974

80-
- name: Test Sqlite database option
81-
id: sqlite-test
75+
- name: Run tests usign SQL Server
76+
id: run-test-sqlserver
8277
run: |
83-
dotnet new bit-bp --name TestSqlite --database Sqlite --advancedTests
84-
cd TestSqlite/src/Server/TestSqlite.Server.Api/
78+
dotnet new bit-bp --name TestSqlServer --database SqlServer
79+
cd TestSqlServer/src/Server/TestSqlServer.Server.Api/
8580
dotnet tool restore
8681
dotnet ef migrations add InitialMigration --verbose
8782
dotnet ef database update
8883
cd ../../Tests
8984
dotnet build
9085
pwsh bin/Debug/net9.0/playwright.ps1 install --with-deps
91-
# dotnet test --logger GitHubActions --filter "${{ env.BLAZOR_SERVER_TEST_FILTER }}"
92-
# dotnet test --logger GitHubActions --filter "${{ env.BLAZOR_WASM_TEST_FILTER }}" -- MSTest.Parallelize.Workers=1
93-
94-
- name: Upload Tests Artifact
95-
uses: actions/upload-artifact@v4.4.1
96-
if: ${{ !env.ACT && failure() && steps.sqlite-test.conclusion == 'failure' }}
97-
with:
98-
name: tests-artifact
99-
path: ./TestSqlite/src/Tests/TestResults
100-
retention-days: 14
101-
102-
- name: Test SqlServer database option
103-
id: sqlserver-test
104-
run: |
105-
dotnet new bit-bp --name TestSqlServer --database SqlServer --advancedTests
106-
cd TestSqlServer/src/Server/TestSqlServer.Server.Api/
107-
dotnet tool restore
108-
dotnet ef migrations add InitialMigration --verbose
109-
dotnet ef database update
110-
cd ../../Tests
111-
# dotnet test --logger GitHubActions --filter "${{ env.BLAZOR_SERVER_TEST_FILTER }}"
112-
# dotnet test --logger GitHubActions --filter "${{ env.BLAZOR_WASM_TEST_FILTER }}" -- MSTest.Parallelize.Workers=1
86+
dotnet test --logger GitHubActions --filter "${{ env.SIMPLE_TEST_FILTER }}"
11387
11488
- name: Upload Tests Artifact
11589
uses: actions/upload-artifact@v4.4.1
116-
if: ${{ !env.ACT && failure() && steps.sqlserver-test.conclusion == 'failure' }}
90+
if: ${{ !env.ACT && failure() && steps.run-test-sqlserver.conclusion == 'failure' }}
11791
with:
11892
name: tests-artifact
11993
path: ./TestSqlServer/src/Tests/TestResults
12094
retention-days: 14
12195

122-
- name: Test Multilingual disabled option
123-
id: multilingual-disabled-test
124-
run: |
125-
dotnet new bit-bp --name MultilingualDisabled --database Sqlite --advancedTests
126-
cd MultilingualDisabled/src/Server/MultilingualDisabled.Server.Api/
127-
dotnet tool restore
128-
dotnet ef migrations add InitialMigration --verbose
129-
dotnet ef database update
130-
cd ../../Tests
131-
# dotnet test -p:InvariantGlobalization=true --logger GitHubActions --filter "${{ env.MULTILINGUAL_DISABLED_TEST_FILTER }}" -- MSTest.Parallelize.Workers=1
132-
133-
- name: Upload Tests Artifact
134-
uses: actions/upload-artifact@v4.4.1
135-
if: ${{ !env.ACT && failure() && steps.multilingual-disabled-test.conclusion == 'failure' }}
136-
with:
137-
name: tests-artifact
138-
path: ./MultilingualDisabled/src/Tests/TestResults
139-
retention-days: 14
140-
141-
- name: Test PostgreSQL, MySql, Other database options
96+
- name: Build PostgreSQL, MySql, Other database options
14297
run: |
14398
dotnet new bit-bp --name TestPostgreSQL --database PostgreSQL --module Sales --signalR
14499
cd TestPostgreSQL/src/Server/TestPostgreSQL.Server.Web/
@@ -156,7 +111,7 @@ jobs:
156111
cd ../../../../
157112
rm -r "TestOther"
158113
159-
- name: Test file storage options
114+
- name: Build file storage options
160115
run: |
161116
dotnet new bit-bp --name TestLocal --filesStorage Local --appInsights
162117
cd TestLocal/src/Server/TestLocal.Server.Web/
@@ -169,7 +124,7 @@ jobs:
169124
cd ../../../../
170125
rm -r "TestAzureBlobStorage"
171126
172-
- name: Test backend setup options
127+
- name: Build backend setup options
173128
run: |
174129
dotnet new bit-bp --name TestStandalone --api Standalone
175130
cd TestStandalone/src/Server/TestStandalone.Server.Api/
@@ -185,13 +140,13 @@ jobs:
185140
cd ../../../../
186141
rm -r "TestIntegrated"
187142
188-
- name: Test sample configuration 1
143+
- name: Build sample configuration 1
189144
run: |
190145
dotnet new bit-bp --name TestProject --database SqlServer --filesStorage AzureBlobStorage --api Integrated --captcha reCaptcha --pipeline Azure --module Admin --offlineDb --appInsights --sentry --signalR --notification --cloudflare --ads --aspire
191146
dotnet build TestProject/TestProject.sln -p:InvariantGlobalization=false -p:Environment=Staging
192147
rm -r "TestProject"
193148
194-
- name: Test sample configuration 2
149+
- name: Build sample configuration 2
195150
run: |
196151
dotnet new bit-bp --name TestProject2 --database Other --filesStorage S3 --api Standalone --captcha None --pipeline None --module None --offlineDb false --appInsights false --sentry false --signalR false --notification false --cloudflare false --ads false --aspire false
197152
dotnet build TestProject2/TestProject2.sln -p:InvariantGlobalization=true -p:Environment=Development

src/Templates/Boilerplate/Bit.Boilerplate/.template.config/ide.host.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@
6363
{
6464
"id": "webAppUrl",
6565
"isVisible": false
66-
},
67-
{
68-
"id": "advancedTests",
69-
"isVisible": false
7066
}
7167
]
7268
}

src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,6 @@
363363
]
364364
},
365365
"replaces": "use-your-web-app-url-here.com"
366-
},
367-
"advancedTests": {
368-
"displayName": "Include advanced automated tests?",
369-
"type": "parameter",
370-
"datatype": "bool",
371-
"defaultValue": "false",
372-
"description": "Includes advanced automated tests."
373366
}
374367
},
375368
"postActions": [
@@ -606,30 +599,6 @@
606599
"src/Server/Boilerplate.Server.AppHost/**"
607600
]
608601
},
609-
{
610-
"condition": "(advancedTests != true)",
611-
"exclude": [
612-
"src/Tests/PageTests/**",
613-
"src/Tests/Services/CulturedStringLocalizer.cs",
614-
"src/Tests/Services/EmailReaderService.cs",
615-
"src/Tests/Services/UserService.cs",
616-
"src/Tests/Services/FakePhoneService.cs",
617-
"src/Tests/Services/FakeGoogleRecaptchaService.cs",
618-
"src/Tests/Extensions/PlaywrightAssetCachingExtensions.cs",
619-
"src/Tests/Extensions/PlaywrightCacheStorageExtensions.cs",
620-
"src/Tests/Extensions/PlaywrightNetworkExtensions.cs",
621-
"src/Tests/Extensions/PlaywrightCacheExtensions.cs",
622-
"src/Tests/Extensions/PlaywrightHydrationExtensions.cs",
623-
"src/Tests/Extensions/BrowserContextExtensions.cs"
624-
]
625-
},
626-
{
627-
"condition": "(advancedTests == true)",
628-
"exclude": [
629-
"src/Tests/IdentityApiTests.cs",
630-
"src/Tests/IdentityPagesTests.cs"
631-
]
632-
},
633602
{
634603
"condition": "(ads != true)",
635604
"exclude": [

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Program.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,6 @@ public static async Task Main(string[] args)
1212
{
1313
var builder = WebAssemblyHostBuilder.CreateDefault(args);
1414

15-
//#if (advancedTests == true)
16-
//Pass configuration to BlazorWebAssembly
17-
//More info: https://stackoverflow.com/questions/60831359/how-are-string-args-passed-to-program-main-in-a-blazor-webassembly-app
18-
try
19-
{
20-
var js = (IJSInProcessRuntime)builder.Services.BuildServiceProvider().GetRequiredService<IJSRuntime>();
21-
var startupParams = js.Invoke<string[]>("startupParams");
22-
var configData = startupParams.Select(p => p.Split('=')).ToDictionary(p => p[0], p => p[1]);
23-
builder.Configuration.AddInMemoryCollection(configData!);
24-
}
25-
catch { }
26-
//#endif
27-
2815
AppEnvironment.Set(builder.HostEnvironment.Environment);
2916

3017
builder.Configuration.AddClientConfigurations(clientEntryAssemblyName: "Boilerplate.Client.Web");

src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
<PackageVersion Condition=" '$(appInsights)' == 'true' OR '$(appInsights)' == '' " Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.23.0" />
9191
<PackageVersion Condition=" '$(pipeline)' == 'GitHub' OR '$(pipeline)' == '' " Include="GitHubActionsTestLogger" Version="2.4.1" />
9292
<PackageVersion Condition=" '$(pipeline)' == 'Azure' " Include="AzurePipelines.TestLogger" Version="1.2.3" />
93-
<PackageVersion Condition=" '$(advancedTests)' == 'true' OR '$(advancedTests)' == '' " Include="MsgReader" Version="6.0.0" />
9493
<!--/-:msbuild-conditional:noEmit -->
9594
<PackageVersion Include="Humanizer" Version="2.14.1" />
9695
<PackageVersion Include="QRCoder" Version="1.6.0" />

src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Data/Migrations/20250702084958_Initial.Designer.cs

Lines changed: 1790 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)