Skip to content

Commit 5f971f1

Browse files
authored
Fix: Configure New Relic Variable (chaynHQ#1018)
Configures New Relic variables for contributors, GitHub Actions, and updates docs.
1 parent 4cdb416 commit 5f971f1

File tree

3 files changed

+42
-37
lines changed

3 files changed

+42
-37
lines changed

.github/workflows/build-and-test-prs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Use NodeJs
2626
uses: actions/setup-node@v3
2727
with:
28-
node-version: '20.x'
28+
node-version: "20.x"
2929

3030
- name: Install dependencies
3131
run: yarn install --frozen-lockfile --non-interactive
@@ -43,5 +43,6 @@ jobs:
4343
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
4444
NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN: ${{ secrets.NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN }}
4545
NEXT_PUBLIC_STORYBLOK_TOKEN: ${{ secrets.NEXT_PUBLIC_STORYBLOK_TOKEN }}
46+
NEW_RELIC_APP_NAME: ${{ secrets.NEW_RELIC_APP_NAME }}
4647
- name: Test app
4748
run: yarn test

CYPRESS.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
# Cypress
1+
# Cypress Testing Guide
22

33
Currently, integration tests are set up to be run locally with Chrome. When cypress runs in github actions in the CI flow, it runs against staging backend.
44

55
## Setup
66

7-
First, create a local `cypress.env.json` file (this file is in .gitignore and will be ignore by git). Example variables are in `cypress.env.example.json`. Some of these variables can be configured by following directions in our [Chayn Tech Wiki Guide](https://www.notion.so/chayn/Chayn-Tech-Contributor-Wiki-5356c7118c134863a2e092e9df6cbc34?pvs=4#1e51da106e1a484baf1429a04be71388). The other variables are login credentials for users that must exist in your local database with certain permissions.
7+
First, create a local `cypress.env.json` file (this file is in `.gitignore` and will be ignore by git) and populate it with environment variables listed in the `cypress.env.example.json` file. Next, configure these variables using in our [Chayn Tech Wiki Guide](https://www.notion.so/chayn/Chayn-Tech-Contributor-Wiki-5356c7118c134863a2e092e9df6cbc34?pvs=4#1e51da106e1a484baf1429a04be71388).
88

99
To configure the login credential variables in your database, first you need to create a super admin user in your database:
1010

11-
- Create a public user through the UI.
12-
- In the database in `bloom-backend` you will need to set "isSuperAdmin" column to true for the user you created. See [BLOOM_USERS.md](/BLOOM_USERS.md) for steps on how to set up different users.
13-
- There are 2 ways of data seeding with users. 1 is via a script in the bloom-scripts repo. Or 2 creating users through the UI (recommended).
11+
1. Create a public user through the UI.
12+
2. In the database in `bloom-backend` you will need to set "isSuperAdmin" column to true for the user you created. See [BLOOM_USERS.md](/BLOOM_USERS.md) for steps on how to set up different users.
13+
3. There are 2 ways of data seeding with users. 1 is via a script in the bloom-scripts repo. Or 2 creating users through the UI (recommended).
1414

15-
### Creating users with the UI (Recommended)
15+
#### Creating users with the UI (Recommended):
1616

17-
- ensure your `bloom-backend` is running.
18-
- create a public user through the UI by navigating to the '/' home page and following instructions to create a user.
19-
- To create partner admin users, log in as the super admin you created. Go to /admin/dashboard and create 1 bumble user and 1 badoo user. Make sure the emails are aliases of your own email. For example, if my email was 'test@chayn.co', I need to make accounts with emails `test+bumblepartneradmin@chayn.co`, `test+badoopartneradmin@chayn.co`. You will need to reset the password through the UI for both of these as firebase provides a random password for you.
17+
- ensure your `bloom-backend` is running.
18+
- create a public user through the UI by navigating to the '/' home page and following instructions to create a user.
19+
- To create partner admin users, log in as the super admin you created. Go to /admin/dashboard and create 1 bumble user and 1 badoo user. Make sure the emails are aliases of your own email. For example, if my email was 'test@chayn.co', I need to make accounts with emails `test+bumblepartneradmin@chayn.co`, `test+badoopartneradmin@chayn.co`. You will need to reset the password through the UI for both of these as firebase provides a random password for you.
2020

21-
### Creating users with a script
21+
#### Creating users with a script:
2222

23-
- You will need to pull the [bloom-scripts repo](https://github.com/chaynHQ/bloom-scripts). This repo contains scripts for data seeding public and partner admin users. Note that you can also perform
24-
- You will need the `bloom-backend/cypress-setup.ts` in the the bloom scripts repo.
25-
- There are a few environment variables that you will need to get.
23+
- You will need to pull the [bloom-scripts repo](https://github.com/chaynHQ/bloom-scripts). This repo contains scripts for data seeding public and partner admin users. Note that you can also perform
24+
- You will need the `bloom-backend/cypress-setup.ts` in the the bloom scripts repo.
25+
- There are a few environment variables that you will need to get.
2626

27-
- URL - this is the url of your bloom-backend service so will likely be `http://localhost:35001/api`
28-
- TOKEN - this needs to be a token with super admin authentication. The way you get this token is to log in as the super admin user in the UI. Go to the Network tab in the developer tools (this is for chrome users). Look for authenticated requests to the backend. A good one to use is the user/me endpoint. In the network tab it usually comes up as `me`. Click on the request and look at the request headers. In particular, look for the authorisation header. This should look like `bearer 123dsdfljkdbfksndfg;ksndg`. Copy everything that is after the `bearer ` into your .env TOKEN variable.
29-
- BUMBLE_PARTNER_ID - you should be able to get this ID from your database in the `partner` table
30-
- BADOO_PARTNER_ID - you should be able to get this ID from your database in the `partner` table
31-
- CYPRESS_TEMPLATE_EMAIL - this needs to be your email because you will need to reset passwords in the UI. To be able to reset passwords, you need the reset email to go into your inbox. The script will generate alias email addresses for all the Cypress template users. For example - my email is `test@chayn.co`. The accounts that will be created will be under `test+publicuser@chayn.co`, `test+bumblepartneradmin@chayn.co`, `test+badoopartneradmin@chayn.co`.
32-
- CYPRESS_TEMPLATE_PASSWORD - this will be the password for all test accounts created.
33-
- run the script with `npm run setup-cypress`.
27+
- URL - this is the url of your bloom-backend service so will likely be `http://localhost:35001/api`
28+
- TOKEN - this needs to be a token with super admin authentication. The way you get this token is to log in as the super admin user in the UI. Go to the Network tab in the developer tools (this is for chrome users). Look for authenticated requests to the backend. A good one to use is the user/me endpoint. In the network tab it usually comes up as `me`. Click on the request and look at the request headers. In particular, look for the authorisation header. This should look like `bearer 123dsdfljkdbfksndfg;ksndg`. Copy everything that is after the `bearer ` into your .env TOKEN variable.
29+
- BUMBLE_PARTNER_ID - you should be able to get this ID from your database in the `partner` table
30+
- BADOO_PARTNER_ID - you should be able to get this ID from your database in the `partner` table
31+
- CYPRESS_TEMPLATE_EMAIL - this needs to be your email because you will need to reset passwords in the UI. To be able to reset passwords, you need the reset email to go into your inbox. The script will generate alias email addresses for all the Cypress template users. For example - my email is `test@chayn.co`. The accounts that will be created will be under `test+publicuser@chayn.co`, `test+bumblepartneradmin@chayn.co`, `test+badoopartneradmin@chayn.co`.
32+
- CYPRESS_TEMPLATE_PASSWORD - this will be the password for all test accounts created.
33+
- run the script with `npm run setup-cypress`.
3434

35-
### Adding data to the env
35+
### Finish Cypress Variable Configuration
3636

3737
- You will have created all the accounts needed to run cypress tests.
3838
- You will need to reset the passwords for both partner admin accounts. Navigate to `localhost:3000/auth/login` in the frontend UI. Click on the password reset button and reset both passwords by following the instructions.
39-
- You now will need to populate the cypress.env.json with the information below
39+
- You now will need to populate the cypress.env.json with the information below:
4040

4141
```
4242
"bumble_partner_admin_email": "",
@@ -51,15 +51,15 @@ To configure the login credential variables in your database, first you need to
5151

5252
- The environment is now ready to run the tests.
5353

54-
**Running the tests locally**
54+
## Run the Tests Locally
5555

5656
To run the tests, follow the instructions below:
5757

58-
1. Ensure both local bloom backend and local bloom front-end are up and running
59-
2. Ensure the local database contains users with emails matching those in the `cypress.env.json` file
60-
3. Ensure Chrome is available on your local machine
61-
4. Run the command `yarn cypress` on your terminal
62-
5. Cypress will now open a new screen displaying the available test (this may take upto a minute the first the command runs)
58+
1. Ensure both bloom backend and bloom front-end are running locally.
59+
2. Ensure the local database contains users with emails matching those in the `cypress.env.json` file.
60+
3. Ensure Chrome is available on your local machine.
61+
4. Run the command `yarn cypress` on your terminal.
62+
5. Cypress will now open a new screen displaying the available test (this may take upto a minute the first the command runs).
6363
6. Click on the test you'd like to run. This will open another Chrome window and the chosen test will now run.
6464

6565
The above option will run the tests against a visible browser. To run a head-less version of the tests (i.e. no visible browser), use the command `yarn cypress:headless`. The headless cypress runs will be faster as the browser elements are not visible.

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,32 @@ You will need to run this in the background for the frontend to be functional.
6565

6666
- **For Chayn staff:** You can import all environment variables from Vercel. Please get in touch with the team for environment variables and access to Vercel. If you already have access, you may proceed to the [Vercel Environment Variable Import](#vercel-environment-variable-import) directions.
6767

68-
- **For open-source contributors:** create a `env.local` file and populate it with the variables below. To configure the Firebase variables, [create a Firebase project in the Firebase console](https://firebase.google.com/) (Google account required). Next, obtain the Storyblok token by visiting our [Chayn Tech Wiki Guide](https://www.notion.so/chayn/Chayn-Tech-Contributor-Wiki-5356c7118c134863a2e092e9df6cbc34?pvs=4#bf62b5dcdb43496ea16231ff1815298b). Note: environment variables provided by Chayn are subject to change at any time, check for updates if you are experiencing problems.
68+
- **For open-source contributors:** create a `env.local` file and populate it with **required** variables below. Required variables are needed to run the app, optional variables are for specific features. To configure the Firebase variables, [create a Firebase project in the Firebase console](https://firebase.google.com/) (Google account required). Next, obtain the Storyblok token by visiting our [Chayn Tech Wiki Guide](https://www.notion.so/chayn/Chayn-Tech-Contributor-Wiki-5356c7118c134863a2e092e9df6cbc34?pvs=4#bf62b5dcdb43496ea16231ff1815298b). Note: environment variables provided by Chayn are subject to change at any time, check for updates if you are experiencing problems.
6969

7070
```
71+
# --- REQUIRED ---
7172
NEXT_PUBLIC_ENV=local
7273
NEXT_PUBLIC_API_URL=http://localhost:35001/api/v1/
7374
NEXT_PUBLIC_BASE_URL=http://localhost:3000
75+
NEW_RELIC_APP_NAME=bloom-frontend
76+
NEW_RELIC_LICENSE_KEY=eu01xx6fc63a14eea79c367dfe82e702FFFFNRAL
7477
7578
NEXT_PUBLIC_FIREBASE_API_KEY=
7679
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
7780
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
7881
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
7982
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
8083
NEXT_PUBLIC_FIREBASE_APP_ID=
81-
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID= # must enable Google Anayltics in Firebase project
84+
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID= # enables Google Anayltics in Firebase project
8285
83-
NEXT_PUBLIC_STORYBLOK_TOKEN= # links content to the frontend
86+
NEXT_PUBLIC_STORYBLOK_TOKEN= # content token, provided in Chayn Tech Wiki Guide.
8487
85-
NEXT_PUBLIC_CRISP_WEBSITE_ID= # OPTIONAL for user messaging
86-
NEXT_PUBLIC_SIMPLYBOOK_WIDGET_URL= # OPTIONAL for booking session forms
87-
NEXT_PUBLIC_HOTJAR_ID= # OPTIONAL for UX analytics
88-
NEXT_PUBLIC_ZAPIER_WEBHOOK_DEMO_FORM= # OPTIONAL for user data form webhooks
89-
NEXT_PUBLIC_ZAPIER_WEBHOOK_SETA_FORM= # OPTIONAL for user data form webhooks
88+
# --- OPTIONAL ---
89+
NEXT_PUBLIC_CRISP_WEBSITE_ID= # user messaging
90+
NEXT_PUBLIC_SIMPLYBOOK_WIDGET_URL= # booking session forms
91+
NEXT_PUBLIC_HOTJAR_ID= # UX analytics
92+
NEXT_PUBLIC_ZAPIER_WEBHOOK_DEMO_FORM= # user data form webhooks
93+
NEXT_PUBLIC_ZAPIER_WEBHOOK_SETA_FORM= # user data form webhooks
9094
```
9195

9296
#### Vercel Environment Variable Import:

0 commit comments

Comments
 (0)