Adds 56 Playwright tests in web/e2e/ that drive Chromium against a real
ntfy server: subscribing, publishing, notifications, signup/login/logout,
account settings, access tokens, reservations and languages. "make web-e2e"
builds the binary and runs them against a fresh local server; setting
NTFY_E2E_BASE_URL (plus an admin token and tier) runs them against an
existing server instead. docs/develop.md describes both.
The tests found two bugs, fixed here:
- Signup showed "Username is already taken" without the name, since it
read the username from the error instead of the form.
- A poll that overlapped a WebSocket delivery could overwrite the stored
message and drop its unread marker, or log a ConstraintError. Both
write paths in SubscriptionManager now check and write in one
transaction, and the poller skips messages that are already stored.
- Use new notification request/opt-in flow for push
- Implement unsubscribing
- Implement muting
- Implement emojis in title
- Add iOS specific PWA warning
- Don’t use websockets when web push is enabled
- Fix duplicate notifications
- Implement default web push setting
- Implement changing subscription type
- Implement web push subscription refresh
- Implement web push notification click
I’d like to test #751 on my own instance, but installing all the build
dependencies on my server isn’t ideal - having this script in the repo
would make it possible to simply point my compose file to the git repo
and have it build the Linux binary itself.
Note that it uses a somewhat “inefficient” builder step, i.e. not
combining steps together to reduce layers, as it uses a multi-stage
build to have a lean final image. This makes it easier to re-build if
something needs to change, as the cache is used more optimally.
For example, if only some go files change, most of the build is already
cached and only the go step gets re-run.
The more “efficient” builder step would look like this, but would have
to build the docs, web app and go CLI for any change in any file:
```Dockerfile
FROM golang:1.19-bullseye as builder
RUN apt-get update && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash && \
apt-get install -y \
build-essential \
nodejs \
python3-pip
WORKDIR /app
ADD . .
RUN make web docs cli-linux-server
```
With this change, any developer can simply open a development environment in Gitpod. The environment has docs, web, and binary being built on every code change.
Also included the vscode extensions for Go and Docker.
Signed-off-by: Yarden Shoham <hrsi88@gmail.com>