You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
4
4
5
5
## Setup
6
6
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).
8
8
9
9
To configure the login credential variables in your database, first you need to create a super admin user in your database:
10
10
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).
14
14
15
-
### Creating users with the UI (Recommended)
15
+
####Creating users with the UI (Recommended):
16
16
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.
20
20
21
-
### Creating users with a script
21
+
####Creating users with a script:
22
22
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.
26
26
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`.
34
34
35
-
### Adding data to the env
35
+
### Finish Cypress Variable Configuration
36
36
37
37
- You will have created all the accounts needed to run cypress tests.
38
38
- 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:
40
40
41
41
```
42
42
"bumble_partner_admin_email": "",
@@ -51,15 +51,15 @@ To configure the login credential variables in your database, first you need to
51
51
52
52
- The environment is now ready to run the tests.
53
53
54
-
**Running the tests locally**
54
+
## Run the Tests Locally
55
55
56
56
To run the tests, follow the instructions below:
57
57
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).
63
63
6. Click on the test you'd like to run. This will open another Chrome window and the chosen test will now run.
64
64
65
65
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.
Copy file name to clipboardExpand all lines: README.md
+12-8Lines changed: 12 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -65,28 +65,32 @@ You will need to run this in the background for the frontend to be functional.
65
65
66
66
-**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.
67
67
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.
0 commit comments