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
Copy file name to clipboardExpand all lines: README.md
+67-4Lines changed: 67 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,28 @@ Some key features include:
10
10
11
11
## Development
12
12
13
+
Quickstart:
14
+
13
15
- Install npm, docker and docker compose
14
16
- Clone the repository
15
17
- Copy `.env.template` as `.env` file and fill in the required values
16
18
- Run `npm i` and `npm start` to setup and start the development environment
17
19
18
-
## Azure setup
20
+
## Environment setup
21
+
22
+
See `compose.yaml` for local development. In short, in addition to the CC server, you need
23
+
24
+
- PostgreSQL (docker)
25
+
- Redis (docker)
26
+
- Ollama (docker)
27
+
- Azure
28
+
- S3
29
+
30
+
### Azure
19
31
20
-
Create an AI foundry resource (or something) and create deployment for the models you want to use (gpt4.1 for example).
32
+
Azure is used for OpenAI LLMs.
33
+
34
+
Create an AI foundry resource (or something) and create deployment for the models you want to use (gpt4.1 for example).
21
35
22
36
Then populate .env with the following:
23
37
```
@@ -26,6 +40,18 @@ AZURE_API_KEY=<asd>
26
40
GPT_41=<name-of-the-deployment-you-created>
27
41
```
28
42
43
+
### S3
44
+
45
+
S3 is used for storing user-uploaded files and their processed versions.
46
+
47
+
Create an S3 bucket and populate .env with the following:
48
+
```
49
+
S3_HOST=<host-url>
50
+
S3_BUCKET=<name-of-the-bucket-you-created>
51
+
S3_ACCESS_KEY=<access-key>
52
+
S3_SECRET_KEY=<secret-key>
53
+
```
54
+
29
55
## Developers: things to know
30
56
31
57
### Debugging in production
@@ -35,7 +61,7 @@ In browser console, run
35
61
toggleDevtools()
36
62
```
37
63
38
-
### Troubleshooting
64
+
### Common issues
39
65
40
66
Getting `Error: Cannot find module @rollup/rollup-linux-arm64-musl` on MacOS?
41
67
This is likely because you ran `npm i` locally.
@@ -46,6 +72,43 @@ docker compose build
46
72
47
73
If then you're getting `concurrently not found`, prepend the `npm run dev` script with `npm i` and run once with that.
48
74
49
-
### Trivia
75
+
## E2E Testing
76
+
77
+
Playwright e2e tests are located in `e2e`. `playwright.config.ts` is also important.
78
+
79
+
Run the tests with
80
+
```bash
81
+
npm run e2e
82
+
```
83
+
84
+
To run just one test, mark it with `.only`:
85
+
86
+
```ts
87
+
test.only('test name', async ({ page }) => {
88
+
// test code
89
+
});
90
+
```
91
+
92
+
When writing new spec file, make sure to import the test function from the fixtures file, like this:
93
+
```ts
94
+
import { teacherTestastest } from'./fixtures'
95
+
```
96
+
97
+
So that the global foreach function runs for your tests. For different user roles (`studentTest`, `teacherTest`, `adminTest`), import the corresponding test function:
98
+
```ts
99
+
import { studentTestastest } from'./fixtures'
100
+
```
101
+
102
+
### Test setup and data
103
+
104
+
Test user headers are defined in `src/shared/testData.ts`. TEST_COURSES are also defined there.
105
+
106
+
Before each test, the test data of a test user is reset by calling the `/test/reset-test-data` endpoint. It is found at `src/server/routes/testUtils.ts`.
107
+
108
+
When running the tests, the headers `x-test-user-idx` and `x-test-user-role` are set, defining the test user's id and iam-based role. They are read at `src/server/middleware/user.ts`.
109
+
110
+
The tests are isolated so that each (should at least) modifies their own data discriminated by the user's id. This allows parallel execution.
111
+
112
+
## Trivia
50
113
51
114
The terms `course` and `chatInstance` refer to the same thing in the codebase. However, only `chatInstance` is correct, always prefer it.
0 commit comments