Skip to content

Integrate with the automated API testing framework #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
newman/

# Runtime data
pids
Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,37 @@ The following parameters can be set in config files or in env variables:
- App will be running at `http://localhost:3000`
- Application can be run in development mode using the command `npm run dev`

## Running tests

### Configuration

Test configuration is at `config/test.js`. You don't need to change them.

The following test parameters can be set in config file or in env variables:

- AUTH_V2_URL: The auth v2 url
- AUTH_V2_CLIENT_ID: The auth v2 client id
- AUTH_V3_URL: The auth v3 url
- ADMIN_CREDENTIALS_USERNAME: The user's username with admin role
- ADMIN_CREDENTIALS_PASSWORD: The user's password with admin role
- USER_CREDENTIALS_USERNAME: The user's username with user role
- USER_CREDENTIALS_PASSWORD: The user's password with user role

### Prepare

- Start Local Neo4j.
- Various config parameters should be properly set.

### Running E2E tests with Postman

`Start` the app server before running e2e tests. You may need to set the env variables by calling `source env.sh` before calling `NODE_ENV=test npm start`.

To run postman e2e tests run:

```bash
npm run test:newman
```

## Heroku deployment
- git init
- git add .
Expand Down
8 changes: 5 additions & 3 deletions config/default.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* The configuration file.
*/

require('dotenv').config()
module.exports = {
LOG_LEVEL: process.env.LOG_LEVEL || 'debug',
PORT: process.env.PORT || 3000,
// it is configured to be empty at present, but may add prefix like '/api/v5'
API_PREFIX: process.env.API_PREFIX || '',
GRAPH_DB_URI: process.env.GRAPH_DB_URI || process.env.GRAPHENEDB_BOLT_URL || 'bolt://localhost:7687',
GRAPH_DB_USER: process.env.GRAPH_DB_USER || process.env.GRAPHENEDB_BOLT_USER || 'neo4j',
GRAPH_DB_PASSWORD: process.env.GRAPH_DB_PASSWORD || process.env.GRAPHENEDB_BOLT_PASSWORD || '123456',
GRAPH_DB_PASSWORD: process.env.GRAPH_DB_PASSWORD || process.env.GRAPHENEDB_BOLT_PASSWORD || 'password',
AUTH_SECRET: process.env.AUTH_SECRET || 'mysecret',
VALID_ISSUERS: process.env.VALID_ISSUERS
? process.env.VALID_ISSUERS.replace(/\\"/g, '')
Expand Down Expand Up @@ -52,5 +52,7 @@ module.exports = {
MEMBERSHIP_TYPES: {
Group: 'group',
User: 'user'
}
},

AUTOMATED_TESTING_NAME_PREFIX: process.env.AUTOMATED_TESTING_NAME_PREFIX || 'POSTMANE2E-'
}
17 changes: 17 additions & 0 deletions config/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* The configuration file.
*/

module.exports = {
WAIT_TIME: 10,
AUTH_V2_URL: process.env.AUTH_V2_URL || 'https://topcoder-dev.auth0.com/oauth/ro',
AUTH_V2_CLIENT_ID: process.env.AUTH_V2_CLIENT_ID || '',
AUTH_V3_URL: process.env.AUTH_V3_URL || 'https://api.topcoder-dev.com/v3/authorizations',
ADMIN_CREDENTIALS_USERNAME: process.env.ADMIN_CREDENTIALS_USERNAME || '',
ADMIN_CREDENTIALS_PASSWORD: process.env.ADMIN_CREDENTIALS_PASSWORD || '',
USER_CREDENTIALS_USERNAME: process.env.USER_CREDENTIALS_USERNAME || '',
USER_CREDENTIALS_PASSWORD: process.env.USER_CREDENTIALS_PASSWORD || '',
COPILOT_CREDENTIALS_USERNAME: process.env.COPILOT_CREDENTIALS_USERNAME || '',
COPILOT_CREDENTIALS_PASSWORD: process.env.COPILOT_CREDENTIALS_PASSWORD || '',
AUTOMATED_TESTING_REPORTERS_FORMAT: process.env.AUTOMATED_TESTING_REPORTERS_FORMAT || ['cli', 'html']
}
21 changes: 21 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

export AUTH0_CLIENT_ID=

export AUTH0_CLIENT_SECRET=

export AUTH0_AUDIENCE=

export AUTH_V2_URL=

export AUTH_V2_CLIENT_ID=

export AUTH_V3_URL=

export ADMIN_CREDENTIALS_USERNAME=

export ADMIN_CREDENTIALS_PASSWORD=

export USER_CREDENTIALS_USERNAME=

export USER_CREDENTIALS_PASSWORD=
Loading