Skip to content

Commit 0c9c100

Browse files
authored
Add end-to-end test command to developer CLI with comprehensive Playwright integration (#776)
### Summary & Motivation This change adds a new `e2e` command to the developer CLI that provides a streamlined way to run Playwright end-to-end tests which will be introduce in the next change. The command offers comprehensive test execution capabilities with smart defaults and extensive configuration options. Key features: - Automatic server availability checking before running tests - Support for running tests across multiple self-contained systems - Flexible test filtering by search terms, tags (@smoke, @comprehensive), or file patterns - Browser selection (chromium, firefox, webkit, safari, all) - Interactive debugging with Playwright Inspector - Performance analysis with timing output - Test artifacts management (videos, traces, reports) - Smart test retry logic for flaky tests - Parallel test execution with configurable workers Additional improvements: - Enhanced SQLite configuration in test base classes to better match SQL Server behavior - Updated AI rules to enforce using the developer CLI for all test commands - Added preprocessing for command-line arguments to handle @ symbols in search terms ### Checklist - [x] I have added tests, or done manual regression tests - [x] I have updated the documentation, if necessary
2 parents 28f11bb + 26ccf3d commit 0c9c100

File tree

9 files changed

+727
-4
lines changed

9 files changed

+727
-4
lines changed

.cursor/rules/tools.mdc

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ alwaysApply: true
99
* BrowserMCP: Use this to troubleshoot frontend issues. The base URL is https://localhost:9000. The website is already running, so never start it manually.
1010
* `[PRODUCT_MANAGEMENT_TOOL]`: Use this MCP tool to create and manage product backlog items.
1111

12+
If an MCP Server is not responding, instruct the user to activate it rather than using workarounds like calling `curl` when the browser MCP is unavailable.
13+
1214
# Product Management Tools
1315

1416
> **Update this value in ONE place:**
@@ -25,7 +27,7 @@ Use the `[CLI_ALIAS]` Developer CLI to build, test, and format backend and front
2527

2628
Always use the Developer CLI to build, test, and format code correctly over using direct commands like `npm run format` or `dotnet test`.
2729

28-
**IMPORTANT:** Never fall back to using direct commands like `npm run format` or `dotnet test`. Always use the Developer CLI with the appropriate alias.
30+
**IMPORTANT:** Never fall back to using direct commands like `npm run format`, `dotnet test`, `npx playwright test`, `npm test`, etc. Always use the Developer CLI with the appropriate alias.
2931

3032
## CLI Alias Configuration
3133

@@ -67,6 +69,29 @@ After you have completed a backend task and want to ensure that it works as expe
6769
[CLI_ALIAS] test --solution-name <solution-name>
6870
```
6971

72+
## End-to-End Test Commands
73+
74+
```bash
75+
# Run all end-to-end tests except slow tests
76+
[CLI_ALIAS] e2e
77+
78+
# Run end-to-end tests for specific so lution
79+
[CLI_ALIAS] e2e --self-contained-system <self-contained-system-name>
80+
81+
# Run end-to-end tests for specific browser
82+
[CLI_ALIAS] e2e --browser <browser-name>
83+
84+
# Run end-to-end tests for specific search term
85+
[CLI_ALIAS] e2e <search-term>
86+
87+
# Run end-to-end tests for specific test tags
88+
[CLI_ALIAS] e2e "@smoke"
89+
[CLI_ALIAS] e2e "smoke"
90+
[CLI_ALIAS] e2e "@comprehensive"
91+
```
92+
93+
Any combination of the above parameters is possible. There are other parameters available, but you should only use the ones mentioned above.
94+
7095
## Format Commands
7196

7297
Run these commands before you commit your changes.

.windsurf/rules/tools.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ description: You have access to several tools and MCP servers
99
* BrowserMCP: Use this to troubleshoot frontend issues. The base URL is https://localhost:9000. The website is already running, so never start it manually.
1010
* `[PRODUCT_MANAGEMENT_TOOL]`: Use this MCP tool to create and manage product backlog items.
1111

12+
If an MCP Server is not responding, instruct the user to activate it rather than using workarounds like calling `curl` when the browser MCP is unavailable.
13+
1214
# Product Management Tools
1315

1416
> **Update this value in ONE place:**
@@ -25,7 +27,7 @@ Use the `[CLI_ALIAS]` Developer CLI to build, test, and format backend and front
2527
2628
Always use the Developer CLI to build, test, and format code correctly over using direct commands like `npm run format` or `dotnet test`.
2729
28-
**IMPORTANT:** Never fall back to using direct commands like `npm run format` or `dotnet test`. Always use the Developer CLI with the appropriate alias.
30+
**IMPORTANT:** Never fall back to using direct commands like `npm run format`, `dotnet test`, `npx playwright test`, `npm test`, etc. Always use the Developer CLI with the appropriate alias.
2931
3032
## CLI Alias Configuration
3133
@@ -67,6 +69,29 @@ After you have completed a backend task and want to ensure that it works as expe
6769
[CLI_ALIAS] test --solution-name <solution-name>
6870
```
6971

72+
## End-to-End Test Commands
73+
74+
```bash
75+
# Run all end-to-end tests except slow tests
76+
[CLI_ALIAS] e2e
77+
78+
# Run end-to-end tests for specific so lution
79+
[CLI_ALIAS] e2e --self-contained-system <self-contained-system-name>
80+
81+
# Run end-to-end tests for specific browser
82+
[CLI_ALIAS] e2e --browser <browser-name>
83+
84+
# Run end-to-end tests for specific search term
85+
[CLI_ALIAS] e2e <search-term>
86+
87+
# Run end-to-end tests for specific test tags
88+
[CLI_ALIAS] e2e "@smoke"
89+
[CLI_ALIAS] e2e "smoke"
90+
[CLI_ALIAS] e2e "@comprehensive"
91+
```
92+
93+
Any combination of the above parameters is possible. There are other parameters available, but you should only use the ones mentioned above.
94+
7095
## Format Commands
7196

7297
Run these commands before you commit your changes.

application/account-management/Tests/EndpointBaseTest.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,27 @@ protected EndpointBaseTest()
4949
// Create connection and add DbContext to the service collection
5050
Connection = new SqliteConnection("DataSource=:memory:");
5151
Connection.Open();
52+
53+
// Configure SQLite to behave more like SQL Server
54+
using (var command = Connection.CreateCommand())
55+
{
56+
// Enable foreign key constraints (SQL Server has this by default)
57+
command.CommandText = "PRAGMA foreign_keys = ON;";
58+
command.ExecuteNonQuery();
59+
60+
// Enable recursive triggers (SQL Server supports nested triggers)
61+
command.CommandText = "PRAGMA recursive_triggers = ON;";
62+
command.ExecuteNonQuery();
63+
64+
// Enforce CHECK constraints (SQL Server enforces these by default)
65+
command.CommandText = "PRAGMA ignore_check_constraints = OFF;";
66+
command.ExecuteNonQuery();
67+
68+
// Use more strict query parsing
69+
command.CommandText = "PRAGMA trusted_schema = OFF;";
70+
command.ExecuteNonQuery();
71+
}
72+
5273
Services.AddDbContext<TContext>(options => { options.UseSqlite(Connection); });
5374

5475
Services.AddAccountManagementServices();

application/back-office/Tests/EndpointBaseTest.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,27 @@ protected EndpointBaseTest()
4949
// Create connection and add DbContext to the service collection
5050
Connection = new SqliteConnection("DataSource=:memory:");
5151
Connection.Open();
52+
53+
// Configure SQLite to behave more like SQL Server
54+
using (var command = Connection.CreateCommand())
55+
{
56+
// Enable foreign key constraints (SQL Server has this by default)
57+
command.CommandText = "PRAGMA foreign_keys = ON;";
58+
command.ExecuteNonQuery();
59+
60+
// Enable recursive triggers (SQL Server supports nested triggers)
61+
command.CommandText = "PRAGMA recursive_triggers = ON;";
62+
command.ExecuteNonQuery();
63+
64+
// Enforce CHECK constraints (SQL Server enforces these by default)
65+
command.CommandText = "PRAGMA ignore_check_constraints = OFF;";
66+
command.ExecuteNonQuery();
67+
68+
// Use more strict query parsing
69+
command.CommandText = "PRAGMA trusted_schema = OFF;";
70+
command.ExecuteNonQuery();
71+
}
72+
5273
Services.AddDbContext<TContext>(options => { options.UseSqlite(Connection); });
5374

5475
Services.AddBackOfficeServices();

0 commit comments

Comments
 (0)