Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,26 @@ In order to efficiently run our integration tests, we rely on automated database
npm run test-seedDB
```

## End to End test

To run the test:

```
npm run test-e2e
```

To run the test locally against the local code/server:

```
npm run test-e2e-locally
```

NOTE running e2e needs to set up some env variables like the Database connection, we can attach the env variables on the CLI command line:

```
> DB_HOST=localhost DB_USERNAME=postgres DB_PORT=23720 DB_PASSWORD=*** DB_NAME=treetracker DB_SCHEMA=public npm run test-e2e-locally
```

## Suggestion about how to run tests when developing

There is a command in the `package.json`:
Expand Down
8 changes: 6 additions & 2 deletions __tests__/e2e/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require("dotenv").config();

const request = require("supertest")(`https://${process.env.ENVIRONMENT}-k8s.treetracker.org/wallet`);
const server = process.env.RUN_E2E_LOCALLY ?
require("../../server/app")
:
`https://${process.env.ENVIRONMENT}-k8s.treetracker.org/wallet`;
const request = require("supertest")(server);
const expect = require("chai").expect;
const responseStatus = require("http-status-codes");
const assert = require("./libs/assertionLibrary.js");
Expand All @@ -27,4 +31,4 @@ module.exports = {
responseStatus,
assert,
seed
};
};
3 changes: 2 additions & 1 deletion __tests__/e2e/database/knex.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const knexConfig = {
port: process.env.DB_PORT,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
ssl: true,
// eslint-disable-next-line
ssl: process.env.DB_SSL === "false" ? false : true,
},
debug: false,
searchPath: [process.env.DB_SCHEMA],
Expand Down
Loading