Skip to content

Commit c9a602e

Browse files
Configure tests to pull Docker images from Docker Hub automatically
Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
1 parent 127732a commit c9a602e

4 files changed

Lines changed: 24 additions & 54 deletions

File tree

EstateManagementUI.PlaywrightTests/Infrastructure/DockerHelper.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using DotNet.Testcontainers.Builders;
22
using DotNet.Testcontainers.Containers;
3+
using DotNet.Testcontainers.Images;
34
using DotNet.Testcontainers.Networks;
45
using System.Runtime.InteropServices;
56

@@ -70,7 +71,8 @@ private async Task StartSecurityServiceContainer()
7071

7172
_securityServiceContainer = new ContainerBuilder()
7273
.WithName(_securityServiceContainerName)
73-
.WithImage("securityservice:latest")
74+
.WithImage("stuartferguson/securityservice:latest")
75+
.WithImagePullPolicy(PullPolicy.Always)
7476
.WithEnvironment(environmentVariables)
7577
.WithNetwork(_network)
7678
.WithPortBinding(5001, true)
@@ -102,7 +104,8 @@ private async Task StartEstateManagementUiContainer()
102104

103105
_estateManagementUiContainer = new ContainerBuilder()
104106
.WithName(_estateManagementUiContainerName)
105-
.WithImage("estatemanagementui:latest")
107+
.WithImage("stuartferguson/estatemanagementui:latest")
108+
.WithImagePullPolicy(PullPolicy.Always)
106109
.WithEnvironment(environmentVariables)
107110
.WithNetwork(_network)
108111
.WithPortBinding(5004, true)

EstateManagementUI.PlaywrightTests/README.md

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ The tests use:
2020

2121
## Required Docker Images
2222

23-
The tests require the following Docker images to be available:
23+
The tests automatically pull the required Docker images from Docker Hub:
2424

25-
1. **securityservice:latest** - The authorization/identity server
26-
2. **estatemanagementui:latest** - The Estate Management UI application
25+
1. **stuartferguson/securityservice:latest** - The authorization/identity server
26+
2. **stuartferguson/estatemanagementui:latest** - The Estate Management UI application
2727

28-
You need to build these images before running the tests. See the main project's integration tests or build scripts for how to create these images.
28+
These images are automatically pulled when you run the tests for the first time. No manual Docker image building is required.
2929

3030
## Setup
3131

@@ -46,21 +46,10 @@ dotnet build
4646
playwright install chromium
4747
```
4848

49-
### 2. Ensure Docker Images are Available
50-
51-
Build or pull the required Docker images:
52-
53-
```bash
54-
# Build Estate Management UI image (from the solution root)
55-
docker build -t estatemanagementui:latest -f EstateManagementUI.BlazorServer/Dockerfile .
56-
57-
# The Security Service image should be available from the existing integration tests
58-
# Check if it exists:
59-
docker images | grep securityservice
60-
```
61-
6249
## Running the Tests
6350

51+
The Docker images will be automatically pulled from Docker Hub on the first test run.
52+
6453
### Run All Tests
6554

6655
```bash

IMPLEMENTATION_SUMMARY.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ The implementation follows the pattern of the existing integration tests but use
131131
### Prerequisites
132132
1. .NET 10.0 SDK installed
133133
2. Docker installed and running
134-
3. Required Docker images built:
135-
- `securityservice:latest`
136-
- `estatemanagementui:latest`
134+
3. Required Docker images (automatically pulled from Docker Hub):
135+
- `stuartferguson/securityservice:latest`
136+
- `stuartferguson/estatemanagementui:latest`
137137

138138
### Quick Start
139139
```bash
@@ -163,10 +163,11 @@ dotnet test
163163
These can be modified in the test class constants if needed.
164164

165165
### Container Configuration
166-
Containers use environment variables to configure:
166+
Containers are automatically pulled from Docker Hub and use environment variables to configure:
167167
- Security Service runs on internal port 5001
168168
- Estate Management UI runs on internal port 5004
169169
- Both get dynamically assigned external ports
170+
- Images: `stuartferguson/securityservice:latest` and `stuartferguson/estatemanagementui:latest`
170171

171172
### Browser Options
172173
- Headless mode in CI (when `CI=true` or `IsCI=true`)
@@ -177,10 +178,9 @@ Containers use environment variables to configure:
177178
## Limitations and Notes
178179

179180
### Current Limitations
180-
1. **Requires Docker images** - Tests need pre-built images
181-
2. **No backend services** - Only tests UI and authentication
182-
3. **Mock data** - Uses in-memory databases, no real data
183-
4. **Limited coverage** - Focuses on login and dashboard only
181+
1. **No backend services** - Only tests UI and authentication
182+
2. **Mock data** - Uses in-memory databases, no real data
183+
3. **Limited coverage** - Focuses on login and dashboard only
184184

185185
### Future Enhancements
186186
As noted in the README, potential improvements include:

setup-playwright-tests.sh

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,11 @@ fi
3333
echo "✓ Docker found and running"
3434
echo ""
3535

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
36+
# Docker images will be pulled automatically from Docker Hub
37+
echo "Note: Docker images will be automatically pulled from Docker Hub when tests run."
38+
echo " - stuartferguson/securityservice:latest"
39+
echo " - stuartferguson/estatemanagementui:latest"
40+
echo ""
6341

6442
# Restore NuGet packages
6543
echo "Restoring NuGet packages..."

0 commit comments

Comments
 (0)