Skip to content

Commit

Permalink
Fix UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
philippzagar committed Mar 26, 2024
1 parent d37b6d6 commit 4a8a945
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 22 deletions.
7 changes: 5 additions & 2 deletions FogNode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Lastly, start the container services via Docker Compose:
- On Linux, execute `docker compose --platform=linux up` to start the service, use the `-d` flag to run it in the background like: `docker compose --platform=linux up -d`. The service is automatically advertised by Avahi via mDNS from the Docker service.
- On macOS, run `docker compose up` to start the service. In addition, because of technical limitations of Avahi within a Docker container on macOS, one has to manually run the mDNS advertisement via Bonjour: `dns-sd -R "SpeziLLMFog Service" _https._tcp spezillmfog.local 443`. It advertises the service under the `spezillmfog.local` domain name with the `"SpeziLLMFog Service"` user-friendly name.

#### Development
### Development

For development purposes, the `docker-compose.dev.yml` file starts up the fog node without TLS certificates and with the usage of the Firebase Emulator. In that case, one doesn't have to execute the setup script mentioned above (as no certificates are required without a TLS connection) and doesn't have to get the Firebase service account key from the Firebase Console.
For development purposes, the `docker-compose.dev.yml` file starts up the fog node without TLS certificates and with the usage of the Firebase Emulator. In that case, one doesn't have to execute the setup script mentioned above (as no certificates are required without a TLS connection) and doesn't have to get the Firebase service account key from the Firebase Console.
In addition, this development compose file doesn't include an mDNS advertisement service. The developer is responsible for advertising the service. On macOS, which is the primary development environment for SpeziLLMFog, this can be done via Bonjour and the `dns-sd -R "SpeziLLMFog Service" _http._tcp spezillmfog.local 80` command. Note that the service advertises an `http` service with port 80, in contrast to the production setup with HTTPS and port 443 (secure traffic).

Another file for development purposes is the `docker-compose.avahi.yml` file. One container advertises an mDNS service via Avahi, another container discovers this service via an Avahi Sidecar. This setup is incredibly useful to test mDNS announcements on the Linux platform.
31 changes: 31 additions & 0 deletions FogNode/docker-compose.avahi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# This source file is part of the Stanford Spezi open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#

version: '3.8'
services:
# Advertises dummy mDNS service to sidecar container
avahi:
build:
context: avahi
hostname: spezillmfog.local
networks:
- avahi

# Receives advertised dummy mDNS service from avahi container
avahi-sidecar:
build:
context: avahi
dockerfile: Dockerfile-Sidecar
hostname: spezillmfog-sidecar.local
networks:
- avahi

# Enables to bridge mDNS advertise packages between the two avahi containers
networks:
avahi:
driver: bridge
20 changes: 0 additions & 20 deletions FogNode/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,10 @@ services:
networks:
- web

# Advertises dummy mDNS service to sidecar container
# avahi:
# build:
# context: avahi
# hostname: spezillmfog.local
# networks:
# - avahi

# Receives advertised dummy mDNS service from avahi container
# avahi-sidecar:
# build:
# context: avahi
# dockerfile: Dockerfile-Sidecar
# hostname: spezillmfog-sidecar.local
# networks:
# - avahi

# Enables persistence of downloaded LLMs by Ollama
volumes:
ollama_storage:

# Enables to bridge mDNS advertise packages between the two avahi containers
networks:
avahi:
driver: bridge
web:
driver: bridge
4 changes: 4 additions & 0 deletions Tests/UITests/TestAppUITests/TestAppLLMOpenAIUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ class TestAppLLMOpenAIUITests: XCTestCase {
XCTAssert(app.buttons["Next"].waitForExistence(timeout: 2))
app.buttons["Next"].tap()

#if !os(visionOS)
app.pickers["modelPicker"].pickerWheels.element(boundBy: 0).adjust(toPickerWheelValue: "GPT 4 Turbo Preview")
#else
app.pickers["modelPicker"].pickerWheels.element(boundBy: 0).swipeUp()
#endif
XCTAssert(app.pickerWheels["GPT 4 Turbo Preview"].waitForExistence(timeout: 2))
sleep(1)

Expand Down

0 comments on commit 4a8a945

Please sign in to comment.