Skip to content

Commit a7d28c7

Browse files
SudharakaPgitbook-bot
authored andcommitted
GitBook: [v2] 151 pages modified
1 parent a9cd36f commit a7d28c7

File tree

2 files changed

+2
-71
lines changed

2 files changed

+2
-71
lines changed

SUMMARY.md

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@
122122
* [Architecture](contributing/development/architecture.md)
123123
* [API](contributing/development/api/README.md)
124124
* [Members](contributing/development/api/members.md)
125-
* [Users / Emails](contributing/development/api/users-emails.md)
126125
* [Collectives](contributing/development/api/collectives.md)
127126
* [Events](contributing/development/api/events.md)
128127
* [README Integration](contributing/development/readme-integration.md)

internal/testing.md

+2-70
Original file line numberDiff line numberDiff line change
@@ -2,79 +2,11 @@
22

33
Tests are intended to be run either on development machines \(`NODE_ENV=development`\) or on a test server such as circleci \(`NODE_ENV=circleci`\). This documentation concentrates on the development testing experience.
44

5-
## Setup
5+
## Setup and Running Tests
66

77
We use [Mocha](https://mochajs.org/) for unit-testing and [Cypress](https://www.cypress.io/) for end-to-end \(e2e\) testing. More details on setting up your local machine for tests can be found at, [https://github.com/opencollective/opencollective-frontend/blob/main/docs/e2e.md](https://github.com/opencollective/opencollective-frontend/blob/main/docs/e2e.md).
88

9-
### Database
10-
11-
Create an `opencollective_test` database accessible to user `opencollective`.
12-
13-
```text
14-
$> createdb opencollective_test
15-
$> psql opencollective_test -c "GRANT ALL PRIVILEGES ON DATABASE opencollective_test to opencollective"
16-
```
17-
18-
### Code
19-
20-
Check out `api`, `website` and `app` Git repositories, preserving their original directory names.
21-
22-
```text
23-
$> git clone https://github.com/OpenCollective/api.git
24-
$> git clone https://github.com/OpenCollective/website.git
25-
$> git clone https://github.com/OpenCollective/app.git
26-
```
27-
28-
### Environment
29-
30-
Create `.env` files in your `api`, `website` and `app` checkouts:
31-
32-
**`api/.env` file**
33-
34-
```text
35-
NODE_ENV=development
36-
WEBSITE_DIR=/path/to/your/opencollective/website
37-
APP_DIR=/path/to/your/opencollective/app
38-
```
39-
40-
**`website/.env` and `app/.env` files**
41-
42-
```text
43-
NODE_ENV=development
44-
API_DIR=/path/to/your/opencollective/api
45-
GITHUB_CLIENT_ID=xxxx [replace with your Github app id]
46-
GITHUB_CLIENT_SECRET=xxx [replace with your Github app client secret]
47-
```
48-
49-
## Test
50-
51-
* run unit- and e2e-tests: `npm test`
52-
* run unit-tests: `npm run test:unit`
53-
* run e2e-tests: `npm run test:e2e`
54-
* run single unit-test: instrument test `describe` or `it` with `.only` flag
55-
* run single e2e-test file: `npm run test:e2e path/to/e2e/test.js`, e.g from API directory: `npm run test:e2e ../website/test/e2e/public_donation_page.js`. The script will detect whether it is a `website` or `api` test file and launch the client and its nightwatch test accordingly.
56-
57-
### How to debug an e2e test that failed?
58-
59-
* Run the API:
60-
61-
`$opencollective-api> PG_DATABASE=opencollective_test npm run dev`
62-
63-
* Reset the database:
64-
65-
`$> curl http://localhost:3060/database/reset`
66-
67-
* Run the website
68-
69-
`$opencollective-website> npm run dev`
70-
71-
* Open your browser at the URL of the test that is failing, e.g.
72-
73-
`open http://localhost:3000/testcollective`
74-
75-
If you want to rerun a particular e2e test file, you can run `npm run nightwatch $file` \(e.g. `npm run nightwatch test/e2e/expenses_page.js`\)
76-
77-
### How to debug when GitHub is challenging the oAuth process?
9+
## How to debug when GitHub is challenging the oAuth process?
7810

7911
* Run the api with the `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` env variables \(you can find them [here](https://github.com/organizations/OpenCollective/settings/applications/346712)\).
8012
* Run the website, go to [http://localhost:3000/opensource/apply](http://localhost:3000/opensource/apply) and go through the flow. Use the login `opencollectivetest` and the password that is stored in 1Password.

0 commit comments

Comments
 (0)