Skip to content

Commit 4e75b41

Browse files
Add setup script and update main README with Playwright test documentation
Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
1 parent e2e1c97 commit 4e75b41

2 files changed

Lines changed: 136 additions & 1 deletion

File tree

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,40 @@ cd EstateManagementUI.BlazorServer
4040
npm run css:watch
4141
```
4242

43-
This will watch for changes to Tailwind CSS source files and automatically rebuild the CSS.
43+
This will watch for changes to Tailwind CSS source files and automatically rebuild the CSS.
44+
45+
## Testing
46+
47+
This project includes multiple test suites:
48+
49+
### Unit Tests
50+
- **EstateManagementUI.UITests** - Unit tests for UI components
51+
- **EstateManagementUI.BusinessLogic.Tests** - Business logic unit tests
52+
53+
### Integration Tests
54+
- **EstateManagementUI.IntegrationTests** - Full integration tests using Selenium WebDriver and Reqnroll (BDD style)
55+
- **EstateManagementUI.PlaywrightTests** - Playwright-based integration tests for login flow and dashboard
56+
57+
### Running Playwright Integration Tests
58+
59+
The Playwright tests specifically test the login flow and dashboard functionality using Docker containers for the authorization server and application.
60+
61+
#### Quick Setup
62+
```bash
63+
./setup-playwright-tests.sh
64+
```
65+
66+
#### Manual Setup
67+
```bash
68+
cd EstateManagementUI.PlaywrightTests
69+
dotnet build
70+
playwright install chromium
71+
```
72+
73+
#### Run Tests
74+
```bash
75+
cd EstateManagementUI.PlaywrightTests
76+
dotnet test
77+
```
78+
79+
For more details, see [EstateManagementUI.PlaywrightTests/README.md](EstateManagementUI.PlaywrightTests/README.md).

setup-playwright-tests.sh

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/bash
2+
3+
# Setup script for Estate Management UI Playwright Tests
4+
# This script helps set up the test environment
5+
6+
set -e
7+
8+
echo "================================================"
9+
echo "Estate Management UI - Playwright Tests Setup"
10+
echo "================================================"
11+
echo ""
12+
13+
# Check if .NET is installed
14+
if ! command -v dotnet &> /dev/null; then
15+
echo "ERROR: .NET SDK not found. Please install .NET 10.0 SDK or later."
16+
exit 1
17+
fi
18+
19+
echo "✓ .NET SDK found: $(dotnet --version)"
20+
echo ""
21+
22+
# Check if Docker is installed and running
23+
if ! command -v docker &> /dev/null; then
24+
echo "ERROR: Docker not found. Please install Docker."
25+
exit 1
26+
fi
27+
28+
if ! docker ps &> /dev/null; then
29+
echo "ERROR: Docker daemon is not running. Please start Docker."
30+
exit 1
31+
fi
32+
33+
echo "✓ Docker found and running"
34+
echo ""
35+
36+
# Check for required Docker images
37+
echo "Checking for required Docker images..."
38+
39+
if docker images | grep -q "securityservice.*latest"; then
40+
echo "✓ securityservice:latest found"
41+
else
42+
echo "✗ securityservice:latest NOT found"
43+
echo " You need to build this image from the existing integration tests."
44+
MISSING_IMAGES=true
45+
fi
46+
47+
if docker images | grep -q "estatemanagementui.*latest"; then
48+
echo "✓ estatemanagementui:latest found"
49+
else
50+
echo "✗ estatemanagementui:latest NOT found"
51+
echo " You can build this image by running:"
52+
echo " docker build -t estatemanagementui:latest -f EstateManagementUI.BlazorServer/Dockerfile ."
53+
MISSING_IMAGES=true
54+
fi
55+
56+
if [ "$MISSING_IMAGES" = true ]; then
57+
echo ""
58+
echo "WARNING: Some required Docker images are missing."
59+
echo "Tests will fail without these images."
60+
echo "Please build the required images before running tests."
61+
echo ""
62+
fi
63+
64+
# Restore NuGet packages
65+
echo "Restoring NuGet packages..."
66+
dotnet restore EstateManagementUI.PlaywrightTests/EstateManagementUI.PlaywrightTests.csproj
67+
echo ""
68+
69+
# Build the test project
70+
echo "Building test project..."
71+
dotnet build EstateManagementUI.PlaywrightTests/EstateManagementUI.PlaywrightTests.csproj
72+
echo ""
73+
74+
# Install Playwright browsers
75+
echo "Installing Playwright browsers..."
76+
if command -v pwsh &> /dev/null; then
77+
pwsh -c "playwright install chromium"
78+
elif command -v playwright &> /dev/null; then
79+
playwright install chromium
80+
else
81+
echo "ERROR: playwright command not found."
82+
echo "After building, you can install it with:"
83+
echo " dotnet tool install --global Microsoft.Playwright.CLI"
84+
echo " playwright install chromium"
85+
exit 1
86+
fi
87+
echo ""
88+
89+
echo "================================================"
90+
echo "Setup Complete!"
91+
echo "================================================"
92+
echo ""
93+
echo "To run the tests:"
94+
echo " cd EstateManagementUI.PlaywrightTests"
95+
echo " dotnet test"
96+
echo ""
97+
echo "To run tests in verbose mode:"
98+
echo " dotnet test --logger \"console;verbosity=detailed\""
99+
echo ""

0 commit comments

Comments
 (0)