-
-
Notifications
You must be signed in to change notification settings - Fork 132
Local development
- Get a test publishable API key, test secret API key and stripe connect test ID
- Save them in the form at http://localhost/admin/settings
- To connect restaurant page to Stripe, go in the restaurant settings page
To test Stripe webhooks locally, install Stripe CLI & launch it
stripe listen --load-from-webhooks-api --forward-to localhost
It is possible to test remote push notifications locally on Android using the emulator or a physical device.
To achieve this, you need
-
Download a private key (.json file) for the Firebase Admin SDK service account (In Firebase Console choose your Firebase project; go to Project settings -> Service accounts -> Firebase Admin SDK -> Generate new private key)
-
Put the private key (.json file) in a folder accessible from a Docker container, for example:
var/push_notifications
-
Reference this key in the
.env
FIREBASE_CREDENTIALS
, for example:FIREBASE_CREDENTIALS=/var/www/html/var/push_notifications/dev-coopcycle-firebase-adminsdk.json
❗️the current setup (April 2024) require APNs to be configured for any push notifications to be send. If you want to test only android notifications, you can comment out apnsClient
dependency and any usaged of it in RemotePushNotificationManager
file https://github.com/coopcycle/coopcycle-web/blob/master/src/Service/RemotePushNotificationManager.php#L28
Limited testing can be done in a simulator, but it requires preparing the notification payload manually, look for " In Simulator, drag and drop an APNs file onto the target simulator" in https://developer.apple.com/documentation/xcode-release-notes/xcode-11_4-release-notes
Testing push notifications end-to-end require a physical device and Apple Developer Program subscription.
-
Follow instructions on https://developer.apple.com/documentation/usernotifications/establishing-a-token-based-connection-to-apns to generate and download a new private key (.p8 file)
-
Put the private key (.p8 file) in a folder accessible from a Docker container, for example:
var/push_notifications
-
Reference this key and set other required parameters in the
.env
, for example:
APNS_PRIVATE_KEY_FILE=/var/www/html/var/push_notifications/AuthKey_apns.p8
APNS_CERTIFICATE_PASS_PHRASE=
APNS_KEY_ID=PUT_YOUR_KEY_ID
APNS_TEAM_ID=PUT_YOUR_TEAM_ID
APNS_APP_BUNDLE_ID=PUT_YOUR_BUNDLE_ID
APNS_IS_PRODUCTION_ENV=false
- Update with your local IP address and uncomment the following line in
webpack.config.js
(restart docker containers to apply changes):
// .setPublicPath('/build')
// Use this if you want to debug on a real device
.setPublicPath('http://192.168.0.11:8080')
.setManifestKeyPrefix('/build')
-
Use your local IP address from a mobile device to access a local instance.
-
Use browser developer tools to inspect the web page on mobile device. For example: https://developer.chrome.com/docs/devtools/remote-debugging
To test the application with a large amount of data, you can use Fixtures (https://github.com/nelmio/alice) to generate and load a large number of users, orders, etc. into the database.
To do this, you can run the following command on the test environment:
docker compose exec php bin/console coopcycle:fixtures:load -s cypress/fixtures/setup.yml -f cypress/fixtures/high_volume_instance.yml --env test
Or inside php
docker container:
bin/console coopcycle:fixtures:load -s cypress/fixtures/setup.yml -f cypress/fixtures/high_volume_instance.yml --env test
You can run such commands on dev environment as well, but it will override all your data. Another option, when you need to access mock data from the dev environment, is to temporarily switch to a test database:
To do this, temporarily set COOPCYCLE_DB_NAME
to coopcycle_test
in .env
file https://github.com/coopcycle/coopcycle-web/blob/master/.env.dist#L19
A pain that can appear with Docker development is that your filesystem permissions or the permission on folder created by docker are not suitable for the docker's www-data
user which is running the php process (different from your local www-data
) user. If you have issues with restaurant images, riders's avatars or cache folder you may try the following.
docker compose exec php /bin/sh
# in container shell
chown -R www-data:www-data web/
chown -R www-data:www-data var/
docker-compose exec postgres psql -U postgres -d coopcycle
docker-compose exec redis redis-cli -h redis -p 6379
docker-compose exec tile38 tile38-cli
docker-compose run webpack node_modules/.bin/encore production --json > stats.json
Then you can upload the stats.json
file on Webpack Analyse Tool