@@ -69,8 +69,8 @@ private static void Execute(
69
69
Environment . Exit ( 1 ) ;
70
70
}
71
71
72
- // If no specific SCS is provided, run tests for all available systems
73
- var systemsToTest = selfContainedSystem != null ? [ selfContainedSystem ] : availableSystems ;
72
+ // If no specific self-contained system is provided, run tests for all available self-contained systems
73
+ var selfContainedSystemsToTest = selfContainedSystem != null ? [ selfContainedSystem ] : availableSystems ;
74
74
75
75
// Validate self-contained system if provided
76
76
if ( selfContainedSystem is not null && ! availableSystems . Contains ( selfContainedSystem ) )
@@ -91,16 +91,18 @@ private static void Execute(
91
91
92
92
var stopwatch = Stopwatch . StartNew ( ) ;
93
93
var overallSuccess = true ;
94
+ var failedSelfContainedSystems = new List < string > ( ) ;
94
95
95
- foreach ( var system in systemsToTest )
96
+ foreach ( var currentSelfContainedSystem in selfContainedSystemsToTest )
96
97
{
97
- var systemSuccess = RunTestsForSystem ( system , testPatterns , browser , debug , grep , headed , includeSlow ,
98
- lastFailed , onlyChanged , quiet , repeatEach , retries , showReport , slowMotion , smoke , stopOnFirstFailure , ui
98
+ var selfContainedSystemSuccess = RunTestsForSystem ( currentSelfContainedSystem , testPatterns , browser , debug , grep , headed , includeSlow , lastFailed ,
99
+ onlyChanged , quiet , repeatEach , retries , showReport , slowMotion , smoke , stopOnFirstFailure , ui
99
100
) ;
100
101
101
- if ( ! systemSuccess )
102
+ if ( ! selfContainedSystemSuccess )
102
103
{
103
104
overallSuccess = false ;
105
+ failedSelfContainedSystems . Add ( currentSelfContainedSystem ) ;
104
106
}
105
107
}
106
108
@@ -111,11 +113,29 @@ private static void Execute(
111
113
: $ "[red]Some tests failed in { stopwatch . Elapsed . TotalSeconds : F1} seconds[/]"
112
114
) ;
113
115
116
+ if ( ! quiet )
117
+ {
118
+ if ( showReport )
119
+ {
120
+ foreach ( var currentSelfContainedSystem in selfContainedSystemsToTest )
121
+ {
122
+ OpenHtmlReport ( currentSelfContainedSystem ) ;
123
+ }
124
+ }
125
+ else if ( ! overallSuccess )
126
+ {
127
+ foreach ( var currentSelfContainedSystem in failedSelfContainedSystems )
128
+ {
129
+ OpenHtmlReport ( currentSelfContainedSystem ) ;
130
+ }
131
+ }
132
+ }
133
+
114
134
if ( ! overallSuccess ) Environment . Exit ( 1 ) ;
115
135
}
116
136
117
137
private static bool RunTestsForSystem (
118
- string system ,
138
+ string selfContainedSystem ,
119
139
string [ ] testPatterns ,
120
140
string browser ,
121
141
bool debug ,
@@ -133,25 +153,25 @@ private static bool RunTestsForSystem(
133
153
bool stopOnFirstFailure ,
134
154
bool ui )
135
155
{
136
- var systemPath = Path . Combine ( Configuration . ApplicationFolder , system , "WebApp" ) ;
156
+ var systemPath = Path . Combine ( Configuration . ApplicationFolder , selfContainedSystem , "WebApp" ) ;
137
157
var e2eTestsPath = Path . Combine ( systemPath , "e2e-tests" ) ;
138
158
139
159
if ( ! Directory . Exists ( e2eTestsPath ) )
140
160
{
141
- AnsiConsole . MarkupLine ( $ "[yellow]No e2e tests found for { system } , skipping ...[/]") ;
161
+ AnsiConsole . MarkupLine ( $ "[yellow]No e2e tests found for { selfContainedSystem } . Skipping ...[/]") ;
142
162
return true ;
143
163
}
144
164
145
- AnsiConsole . MarkupLine ( $ "[blue]Running tests for { system } ...[/]") ;
165
+ AnsiConsole . MarkupLine ( $ "[blue]Running tests for { selfContainedSystem } ...[/]") ;
146
166
147
167
// Clean up report directory if we're going to show it
148
168
if ( showReport )
149
169
{
150
- var reportPath = Path . Combine ( e2eTestsPath , "playwright-report" ) ;
151
- if ( Directory . Exists ( reportPath ) )
170
+ var reportDirectory = Path . Combine ( e2eTestsPath , "playwright-report" ) ;
171
+ if ( Directory . Exists ( reportDirectory ) )
152
172
{
153
173
AnsiConsole . MarkupLine ( "[blue]Cleaning up previous test report...[/]" ) ;
154
- Directory . Delete ( reportPath , true ) ;
174
+ Directory . Delete ( reportDirectory , true ) ;
155
175
}
156
176
}
157
177
@@ -172,7 +192,7 @@ private static bool RunTestsForSystem(
172
192
UseShellExecute = false
173
193
} ;
174
194
175
- AnsiConsole . MarkupLine ( $ "[cyan]Running command in { system } : npx playwright test --config=./e2e-tests/playwright.config.ts { playwrightArgs } [/]") ;
195
+ AnsiConsole . MarkupLine ( $ "[cyan]Running command in { selfContainedSystem } : npx playwright test --config=./e2e-tests/playwright.config.ts { playwrightArgs } [/]") ;
176
196
177
197
processStartInfo . EnvironmentVariables [ "PUBLIC_URL" ] = BaseUrl ;
178
198
@@ -187,17 +207,14 @@ private static bool RunTestsForSystem(
187
207
try
188
208
{
189
209
ProcessHelper . StartProcess ( processStartInfo , throwOnError : true ) ;
190
- AnsiConsole . MarkupLine ( $ "[green]Tests for { system } completed successfully[/]") ;
210
+ AnsiConsole . MarkupLine ( testsFailed
211
+ ? $ "[red]Tests for { selfContainedSystem } failed[/]"
212
+ : $ "[green]Tests for { selfContainedSystem } completed successfully[/]") ;
191
213
}
192
214
catch ( Exception )
193
215
{
194
216
testsFailed = true ;
195
- AnsiConsole . MarkupLine ( $ "[red]Tests for { system } failed[/]") ;
196
- }
197
-
198
- if ( ! quiet && ( showReport || testsFailed ) )
199
- {
200
- OpenHtmlReport ( e2eTestsPath , system ) ;
217
+ AnsiConsole . MarkupLine ( $ "[red]Tests for { selfContainedSystem } failed[/]") ;
201
218
}
202
219
203
220
return ! testsFailed ;
@@ -230,28 +247,28 @@ private static void CheckWebsiteAccessibility()
230
247
231
248
private static string [ ] GetAvailableSelfContainedSystems ( )
232
249
{
233
- var applicationPath = Configuration . ApplicationFolder ;
234
- var systems = new List < string > ( ) ;
250
+ var selfContainedSystems = new List < string > ( ) ;
235
251
236
252
// Look for directories that contain WebApp/e2e-tests
237
- foreach ( var directory in Directory . GetDirectories ( applicationPath ) )
253
+ foreach ( var directory in Directory . GetDirectories ( Configuration . ApplicationFolder ) )
238
254
{
239
- var dirName = Path . GetFileName ( directory ) ;
255
+ var directoryName = Path . GetFileName ( directory ) ;
240
256
241
- // Skip known non-SCS directories
242
- if ( dirName is "AppHost" or "AppGateway" or "shared-kernel" or "shared-webapp" )
257
+ // Skip directories that are not self-contained systems
258
+ if ( directoryName . StartsWith ( '.' ) || directoryName == "AppGateway" || directoryName == "AppHost" ||
259
+ directoryName == "shared-kernel" || directoryName == "shared-webapp" )
243
260
{
244
261
continue ;
245
262
}
246
263
247
264
var e2eTestsPath = Path . Combine ( directory , "WebApp" , "e2e-tests" ) ;
248
265
if ( Directory . Exists ( e2eTestsPath ) )
249
266
{
250
- systems . Add ( dirName ) ;
267
+ selfContainedSystems . Add ( directoryName ) ;
251
268
}
252
269
}
253
270
254
- return systems . ToArray ( ) ;
271
+ return selfContainedSystems . ToArray ( ) ;
255
272
}
256
273
257
274
private static string BuildPlaywrightArgs (
@@ -312,17 +329,18 @@ private static string BuildPlaywrightArgs(
312
329
return string . Join ( " " , args ) ;
313
330
}
314
331
315
- private static void OpenHtmlReport ( string e2eTestsPath , string system )
332
+ private static void OpenHtmlReport ( string selfContainedSystem )
316
333
{
317
- var reportPath = Path . Combine ( e2eTestsPath , "playwright-report" , "index.html" ) ;
334
+ var reportPath = Path . Combine ( Configuration . ApplicationFolder , selfContainedSystem , "WebApp" , "playwright-report" , "index.html" ) ;
335
+
318
336
if ( File . Exists ( reportPath ) )
319
337
{
320
- AnsiConsole . MarkupLine ( $ "[green]Opening test report for { system } ...[/]") ;
338
+ AnsiConsole . MarkupLine ( $ "[green]Opening test report for ' { selfContainedSystem } ' ...[/]") ;
321
339
ProcessHelper . OpenBrowser ( reportPath ) ;
322
340
}
323
341
else
324
342
{
325
- AnsiConsole . MarkupLine ( $ "[yellow]No test report found for { system } at playwright-report/index.html [/]") ;
343
+ AnsiConsole . MarkupLine ( $ "[yellow]No test report found for ' { selfContainedSystem } ' at ' { reportPath } ' [/]") ;
326
344
}
327
345
}
328
346
}
0 commit comments