Fix browser UI tests: Enable anonymous access for mosquitto 2 (#994)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com>
This commit is contained in:
Copilot
2025-12-24 12:05:02 +01:00
committed by GitHub
parent 70e75061b2
commit 1ec10bb007
4 changed files with 18 additions and 21 deletions

View File

@@ -19,8 +19,11 @@
- `yarn test:demo-video` - UI recording (requires Xvfb, mosquitto, tmux, ffmpeg) - `yarn test:demo-video` - UI recording (requires Xvfb, mosquitto, tmux, ffmpeg)
- `yarn test:mcp` - Model Context Protocol tests - `yarn test:mcp` - Model Context Protocol tests
- `yarn test:all` - All tests (unit + demo-video) - `yarn test:all` - All tests (unit + demo-video)
- `./scripts/runBrowserTests.sh` - Browser mode UI tests (requires mosquitto service)
**CI jobs:** `test`, `ui-tests`, `demo-video`, `test-browser` **CI jobs:** `test`, `ui-tests`, `demo-video`, `test-browser`, `browser-ui-tests`
**Important:** Browser UI tests require MQTT broker. In CI, GitHub Actions health checks ensure the mosquitto service is ready before tests run.
## Browser Mode ## Browser Mode

View File

@@ -45,6 +45,8 @@ jobs:
--health-interval 10s --health-interval 10s
--health-timeout 5s --health-timeout 5s
--health-retries 5 --health-retries 5
--entrypoint sh
cmd: -c "mkdir -p /mosquitto/config && echo 'listener 1883' > /mosquitto/config/mosquitto.conf && echo 'allow_anonymous true' >> /mosquitto/config/mosquitto.conf && exec mosquitto -c /mosquitto/config/mosquitto.conf"
steps: steps:
- name: Checkout repository - name: Checkout repository

View File

@@ -31,20 +31,12 @@ jobs:
env: env:
TESTS_MQTT_BROKER_HOST: localhost TESTS_MQTT_BROKER_HOST: localhost
TESTS_MQTT_BROKER_PORT: 1883 TESTS_MQTT_BROKER_PORT: 1883
services:
mosquitto:
image: eclipse-mosquitto:2
ports:
- 1883:1883
options: >-
--health-cmd "mosquitto_sub -t '$SYS/#' -C 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Start mosquitto
run: mosquitto -c /etc/mosquitto/conf.d/default.conf -d
- name: Install Packages - name: Install Packages
run: yarn install --frozen-lockfile run: yarn install --frozen-lockfile
- name: Build Browser Mode - name: Build Browser Mode
@@ -71,20 +63,12 @@ jobs:
env: env:
TESTS_MQTT_BROKER_HOST: localhost TESTS_MQTT_BROKER_HOST: localhost
TESTS_MQTT_BROKER_PORT: 1883 TESTS_MQTT_BROKER_PORT: 1883
services:
mosquitto:
image: eclipse-mosquitto:2
ports:
- 1883:1883
options: >-
--health-cmd "mosquitto_sub -t '$SYS/#' -C 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Start mosquitto
run: mosquitto -c /etc/mosquitto/conf.d/default.conf -d
- name: Install Packages - name: Install Packages
run: yarn install --frozen-lockfile run: yarn install --frozen-lockfile
- name: Build - name: Build
@@ -200,6 +184,8 @@ jobs:
--health-interval 10s --health-interval 10s
--health-timeout 5s --health-timeout 5s
--health-retries 5 --health-retries 5
--entrypoint sh
cmd: -c "mkdir -p /mosquitto/config && echo 'listener 1883' > /mosquitto/config/mosquitto.conf && echo 'allow_anonymous true' >> /mosquitto/config/mosquitto.conf && exec mosquitto -c /mosquitto/config/mosquitto.conf"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:

View File

@@ -10,6 +10,12 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8 ENV LC_ALL en_US.UTF-8
# Configure mosquitto for anonymous access (required for tests)
RUN mkdir -p /etc/mosquitto/conf.d && \
echo "listener 1883" > /etc/mosquitto/conf.d/default.conf && \
echo "allow_anonymous true" >> /etc/mosquitto/conf.d/default.conf && \
echo "persistence false" >> /etc/mosquitto/conf.d/default.conf
# Install Playwright and browsers # Install Playwright and browsers
# This ensures Playwright browsers are pre-installed in the container # This ensures Playwright browsers are pre-installed in the container
RUN npm install -g playwright@1.57.0 && \ RUN npm install -g playwright@1.57.0 && \