Skip to content

Commit 2bd5a36

Browse files
stefanhuberclaudeCopilot
authored
Feat e2e testing (#10)
* feat: add wdio setup * feat: add GitHub Actions CI workflow and e2e test infrastructure Add CI workflow running e2e tests on push/PR, with conditional headless Chrome for CI environments. Include page objects and additional test specs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: use text-based language selection and wait for translations in e2e tests Select languages by visible button text instead of index to avoid order-dependent failures. Wait for i18n translations to load before asserting menu labels. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix tests with timing * chore: suppress noisy ShadowRootManager warnings in e2e test output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update test/specs/player.spec.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update test/specs/selection.spec.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 565fb43 commit 2bd5a36

15 files changed

Lines changed: 9409 additions & 2256 deletions

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: ['**']
5+
pull_request:
6+
branches: [main]
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: 22
15+
cache: npm
16+
- run: npm ci
17+
- run: npm test

CLAUDE.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# CLAUDE.md
2+
3+
## Project Overview
4+
5+
SmartCompanion Audioguide App — a free, open-source PWA for interactive audioguide experiences in museums and cultural institutions. It runs in any modern mobile browser without installation and is fully offline-capable.
6+
7+
This repo is the **shell/wrapper application**. The bulk of functionality lives in workspace packages (`@smartcompanion/ui`, `@smartcompanion/services`, `@smartcompanion/data`, `@smartcompanion/native-audio-player`).
8+
9+
## Tech Stack
10+
11+
- **Stencil.js** v4 — Web Components framework (JSX with `h` factory, Preact-style)
12+
- **Ionic Framework** v8 — UI components and routing
13+
- **TypeScript** — Target ES2022, strict unused locals/params enabled
14+
- **SCSS/SASS** — Styling with CSS custom properties
15+
- **Workbox** v7 — Service worker and offline caching (conditional)
16+
- **npm** — Package manager
17+
18+
## Common Commands
19+
20+
```bash
21+
npm start # Dev server with hot reload (--dev --watch --serve)
22+
npm run build # Production build → www/
23+
npm test # Run spec & e2e tests once
24+
npm run test.watch # Continuous test watching
25+
npm run generate # Generate new Stencil component boilerplate
26+
```
27+
28+
## Project Structure
29+
30+
```
31+
src/
32+
├── components/app-root/ # Single Stencil component (app shell)
33+
│ ├── app-root.tsx # Main component: routing, menu, navigation
34+
│ └── app-root.css
35+
├── global/
36+
│ ├── app.ts # Global initialization hook (empty)
37+
│ └── app.scss # Global styles & CSS custom property (color) variables
38+
├── services/
39+
│ └── index.ts # ServiceFacade initialization & export
40+
├── assets/icon/ # PWA icons (favicon.ico, icon.png 512x512)
41+
├── index.ts # Entry point — imports Ionic & @smartcompanion/ui
42+
├── index.html # HTML shell
43+
├── sw.js # Service worker (Workbox)
44+
└── manifest.json # PWA manifest
45+
stencil.config.ts # Build config & runtime environment variables
46+
www/ # Build output (gitignored)
47+
```
48+
49+
## Architecture
50+
51+
### Component Architecture
52+
- **Single Stencil component** (`app-root`) defined in this repo; all other UI components come from `@smartcompanion/ui`
53+
- Stencil decorators: `@Component`, `@State` (no `@Prop` on app-root)
54+
- Lifecycle: `componentDidLoad()` for initialization; `render()` returns JSX
55+
56+
### Routing
57+
- Ionic Router with hash-based routes
58+
- Routes: `/` (loading), `/language`, `/selection`, `/stations/:stationId`, `/pin`, `/error`
59+
- Route guards via `serviceFacade.canLoadRoute()` in `beforeEnter`
60+
- Route change listener on `/stations/default` to update reactive state
61+
62+
### Service Pattern
63+
- **ServiceFacade** — single facade coordinates all services
64+
- Imported from `src/services/index.ts` as `serviceFacade`
65+
- Key methods: `__()` (i18n), `getRoutingService()`, `getMenuService()`, `canLoadRoute()`, `registerDefaultServices()`, `registerCollectibleAudioPlayerService()`, `registerOfflineLoadService()`, `registerOnlineLoadService()`
66+
67+
### State Management
68+
- Stencil `@State()` for reactive component state
69+
- Translation strings held as `@State` properties, updated on route changes
70+
71+
### Data Loading
72+
- **Online mode**: `registerOnlineLoadService()` — fetches from `Env.DATA_URL`
73+
- **Offline mode**: `registerOfflineLoadService()` — fetch with service worker caching
74+
- Toggle via `OFFLINE_SUPPORT` in `stencil.config.ts`
75+
76+
## Configuration & Customization
77+
78+
All runtime configuration lives in **`stencil.config.ts`** (rebuild required to apply changes):
79+
80+
| Variable | Default | Description |
81+
|---|---|---|
82+
| `Env.TITLE` | `"Animals"` | App title |
83+
| `Env.DATA_URL` | GitHub sample JSON | External data source URL |
84+
| `Env.OFFLINE_SUPPORT` | `"disabled"` | Enable service worker (`"enabled"`) |
85+
86+
**Customization points:**
87+
1. **Colors**: SCSS variables in `src/global/app.scss` (CSS custom properties with `--sc-` prefix)
88+
2. **Title**: `index.html`, `manifest.json`, and `stencil.config.ts`
89+
3. **Data URL**: `stencil.config.ts``DATA_URL`
90+
4. **Offline**: `stencil.config.ts``OFFLINE_SUPPORT: "enabled"`
91+
5. **Icons**: Replace files in `src/assets/icon/`
92+
93+
## Code Conventions
94+
95+
- **Component tags**: kebab-case (`app-root`, `sc-page-*`)
96+
- **Classes**: PascalCase
97+
- **Functions/variables**: camelCase
98+
- **CSS variables**: `--sc-` prefix, kebab-case
99+
- **Imports**: Async/await throughout; no callbacks
100+
- **JSX**: Stencil's `h` factory (not React's `createElement`)
101+
- **Formatting**: Prettier with 180-char print width, single quotes, 2-space indent, LF line endings
102+
- Navigation: always call `serviceFacade.getMenuService().close()` before navigating
103+
- Hash navigation: check current hash before navigating to prevent duplicate routes
104+
105+
## Workspace Dependencies
106+
107+
Internal packages from the SmartCompanion monorepo — do not modify these directly from this repo:
108+
- `@smartcompanion/ui` — UI components
109+
- `@smartcompanion/services` — core services (routing, menu, i18n, data loading)
110+
- `@smartcompanion/data` — data types and structures
111+
- `@smartcompanion/native-audio-player` — audio playback
112+
113+
## Build Output
114+
115+
- Output: `www/` (gitignored)
116+
- Generates ESM bundles + legacy JS
117+
- Service worker generated conditionally based on `OFFLINE_SUPPORT`
118+
- Static assets only — no backend required
119+
- Deployable to GitHub Pages, Netlify, or any static host

README.md

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,84 @@
66

77
The SmartCompanion Audioguide App is a free and open-source Progressive Web App (PWA) that delivers interactive audioguide experiences for museums and cultural institutions. It runs seamlessly in any modern mobile browser — no installation required.
88

9-
The app is fully customizable, allowing you to adapt content, colors, text, and images to fit your institution’s needs. It also includes offline functionality powered by a service worker, ensuring smooth use even without an internet connection.
9+
The app is fully customizable, allowing you to adapt content, colors, text, and images to fit your institution's needs. It also includes offline functionality powered by a service worker, ensuring smooth use even without an internet connection.
10+
11+
## Features
12+
13+
- 🎧 **Interactive Audioguide** — station-based audio playback for museum tours
14+
- 📱 **Progressive Web App** — works in any modern browser, no app store needed
15+
- 🌐 **Multilingual** — built-in i18n support for multiple languages
16+
- 📶 **Offline Support** — optional service worker caching for use without internet
17+
- 🎨 **Fully Customizable** — adapt colors, content, images, and branding
18+
-**Lightweight** — built with Stencil.js and Ionic for fast performance
19+
- 🆓 **Open Source** — BSD 2-Clause license
1020

1121
## Examples
1222

1323
| [Castle Tratzberg](https://www.smartcompanion.app/projects/mobile-apps/schloss-tratzberg/) | [Museum Landeck](https://www.smartcompanion.app/projects/mobile-apps/schloss-landeck/) | [Example App](https://smartcompanion-audioguide-app.netlify.app) |
14-
|---|---|---|
24+
|---|---|---|
1525
| ![Castle Tratzberg App](docs/tratzberg-app.png) | ![Museum Landeck App](docs/landeck-app.png) | ![Animals Example App](docs/animals-app.png) |
1626

1727
## Installation
1828

19-
- Fork and clone the repo
20-
- Install all dependencies with `npm install`
21-
- Either build the project with `npm build` or open a live preview within the browser with `npm start`
29+
- Fork and clone the repo
30+
- Install all dependencies with `npm install`
31+
- Either build the project with `npm run build` or open a live preview within the browser with `npm start`
32+
33+
## Development
34+
35+
```bash
36+
npm start # Dev server with hot reload
37+
npm run build # Production build → www/
38+
npm test # Run spec & e2e tests
39+
npm run test:dev # Continuous test watching
40+
```
2241

2342
## Deployment Options
2443

2544
| Service | Description |
2645
|---|---|
27-
| [Netlify](https://www.netlify.com/) | The [Example App](https://smartcompanion-audioguide-app.netlify.app) is hosted on Netlify. Netlify offers a free option and supports custom domain. |
28-
| [Github Pages](https://docs.github.com/en/pages/quickstart) | Github Pages offers a free option for open source repositories and supports custom domains. |
29-
| [SmartCompanion](https://www.smartcompanion.app/) | We offer a hosting service including a content management system, continous updates and security fixes, custom domains and support. |
46+
| [Netlify](https://www.netlify.com/) | The [Example App](https://smartcompanion-audioguide-app.netlify.app) is hosted on Netlify. Netlify offers a free option and supports custom domains. |
47+
| [GitHub Pages](https://docs.github.com/en/pages/quickstart) | GitHub Pages offers a free option for open source repositories and supports custom domains. |
48+
| [SmartCompanion](https://www.smartcompanion.app/) | We offer a hosting service including a content management system, continuous updates and security fixes, custom domains, and support. |
3049

3150
## Customization
3251

3352
### App Content
3453

35-
The content is loaded from a `data.json` file, which contains all texts and references to assets like images and audio files. Inside the `stencil.config.ts` the `DATA_URL` should point to your `data.json` file. The sample data, which is used for the demo of the app can be found [here](https://github.com/smartcompanion-app/sample-data/tree/main/animals). Custom data needs to be structured according to the example.
54+
The content is loaded from a `data.json` file, which contains all texts and references to assets like images and audio files. Inside the `stencil.config.ts` the `DATA_URL` should point to your `data.json` file. The sample data, which is used for the demo of the app, can be found [here](https://github.com/smartcompanion-app/sample-data/tree/main/animals). Custom data needs to be structured according to the example.
3655

3756
### App Appearance
3857

3958
#### App Colors
4059

41-
- scss color variables in `src/global/app.scss`
42-
- background_color and theme_color in `manifest.json`
43-
- theme_color in `index.html`
60+
- SCSS color variables in `src/global/app.scss` (CSS custom properties with `--sc-` prefix)
61+
- `background_color` and `theme_color` in `manifest.json`
62+
- `theme_color` in `index.html`
4463

4564
#### Text
4665

47-
- title and description in `index.html`
48-
- title in `stencil.config.ts`
66+
- Title and description in `index.html`
67+
- Title in `stencil.config.ts` (`Env.TITLE`)
4968

5069
#### Images
5170

52-
- `logo.png` in `assets` folder
53-
- `favicon.ico` and `icon.png` in `assets/icon` folder
71+
- `logo.png` in `assets` folder
72+
- `favicon.ico` and `icon.png` in `assets/icon` folder
5473

5574
### Offline Support
5675

57-
The PWA can be used with offline support with a service worker. When using a service work the initial startup of the app takes a bit longer, since all relevant files need to be downloaded and cached. Inside the `stencil.config.ts` file `OFFLINE_SUPPORT` can be set to `true` or `false`.
76+
The PWA can be used with offline support via a service worker. When using a service worker, the initial startup of the app takes a bit longer since all relevant files need to be downloaded and cached. Inside the `stencil.config.ts` file, set `OFFLINE_SUPPORT` to `"enabled"` or `"disabled"`.
77+
78+
## Contributing
79+
80+
Contributions are welcome! Feel free to open issues or submit pull requests.
5881

5982
## License
6083

61-
The SmartCompanion Audioguide App is licensed under the terms of the BSD 2-Clause license. Check the [LICENSE](LICENSE) text for further details.
84+
The SmartCompanion Audioguide App is licensed under the terms of the BSD 2-Clause license. Check the [LICENSE](LICENSE) file for further details.
6285

6386
## Links
6487

65-
- [Web site](https://www.smartcompanion.app)
66-
- [Native Audio Capacitor Plugin](https://github.com/smartcompanion-app/native-audio-player)
88+
- [Website](https://www.smartcompanion.app)
89+
- [Native Audio Capacitor Plugin](https://github.com/smartcompanion-app/native-audio-player)

0 commit comments

Comments
 (0)