Skip to content

test(cli): e2e for init apns against a mock of Apple - #2027

Merged
ArnabChatterjee20k merged 2 commits into
messaging-provider-cli-init-apns-e2efrom
messaging-provider-cli-init-apns-apple-e2e
Oct 14, 2026
Merged

ArnabChatterjee20k merged 2 commits into
messaging-provider-cli-init-apns-e2efrom
messaging-provider-cli-init-apns-apple-e2e

Conversation

@ArnabChatterjee20k

@ArnabChatterjee20k ArnabChatterjee20k commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Stacked on #2026.

#2026 tests appwrite init apns against the mock Appwrite API only, and the Apple steps are skipped there. This PR covers them end to end with a mock of Apple.

CLI

  • A hidden APPWRITE_APPLE_HOST variable points Apple's sign-in, App Store Connect and Developer portal at one base URL. When it's unset, the CLI uses Apple's servers.

Mock API (/apple/..., state kept per Apple ID)

  • Sign-in: widget key, SRP init and complete, and the session. Any password is accepted and there's no two-factor step.
  • Teams: a single team, E2ETEAM123.
  • Keys: list, create (at most two per team) and a one-time download of a generated .p8.
  • App IDs: list, register, and turn on Push Notifications. An App ID ending in .nopush already exists with Push Notifications off.

Harness (CLI_INIT_APNS_APPLE:passed)

  1. Signs in with APPWRITE_APPLE_ID and APPWRITE_APPLE_PASSWORD, creates the key (saved into the project folder), creates both providers and registers the App ID with Push Notifications.
  2. A rerun reuses the saved sign-in and confirms the App ID is registered.
  3. --register-app-id turns on Push Notifications for an existing App ID.
  4. Creating keys until the team is full fails with the "no free slot" message.

Expo and fastlane run Apple's own tools, so they aren't covered here.

…PLE_HOST

The e2e tests run init apns against a mock of Apple, so the sign-in,
App Store Connect and Developer portal hosts can all be set to one base
URL. Unset, they stay Apple's servers.
The mock API gains Apple's sign-in, session, team, key and App ID
endpoints under /apple, kept per Apple ID. The harness signs in with an
Apple ID and password, creates the key and registers the App ID, then
reuses the saved sign-in to check the App ID on a rerun, turn on Push
Notifications for an existing App ID, and create keys until the team has
no free slot.
@hansi-codes

hansi-codes Bot commented Oct 14, 2026

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

Adds an Apple-service mock to the mock API and an end-to-end CLI scenario that exercises Apple sign-in, APNs key creation, App ID registration, saved sessions, and the key limit. The CLI can direct its Apple endpoints to a single alternate base URL through APPWRITE_APPLE_HOST, while unset behavior continues to use Apple's servers.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 4
File Change
mock-server/app/http.php Adds file-backed per-account Apple mock state and endpoints for sign-in, teams, keys, and App IDs.
templates/cli/internal/cmd/initpush.go Adds APPWRITE_APPLE_HOST support for the Appwrite APNs adapter.
tests/e2e/CLIGo126Test.php Includes the Apple APNs scenario in the CLI e2e expected output.
tests/e2e/languages/cli/main.go Refactors APNs test setup and adds end-to-end checks against the Apple mock.

Reviewed ec32541 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@hansi-codes hansi-codes Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@ArnabChatterjee20k
ArnabChatterjee20k merged commit 27615cd into messaging-provider-cli-init-apns-e2e Oct 14, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant