Alkemio API tests against the Alkemio GraphQL server endpoint
Initial version of integration api tests is in place. To run them, look at the prerequisites, below:
supertest
Alkemio/Server
endpoint..env
file must contain the following vairable, to run tests with authentication:AUTH_TEST_HARNESS_PASSWORD
password of the user set on the target endpoint (i.e. dev, test, local)ALKEMIO_SERVER=http://localhost:4455/admin/graphql
endpoint used for gathering token based on provided credentialsALKEMIO_SERVER_URL=http://localhost:4455/admin/graphql
endpoint used for graphql requestsnpm run test:[TEST_TYPE]
where TEST_TYPE is it
npm run-script test:[TEST_TYPE] ./test folder>/<test suite file>
(i.e. npm run-script test:it ./test/functional/integration/challenge/create-challenge.it-spec.ts
)Automation test structure
server/
src/
domain/
challenge/
challenge.service.ts
challenge.service.spec.ts
test/
config/
jest.config.it.ts
etc...
functional/
integration/
challenge/
create-challenge.e2e-spec.ts
non-functional/
auth/
anonymous-user.it-spec.ts
performance/
utils/
token.helper.ts
graphql.request.ts
Test types
- functional integration tests: `*.it-spec.ts` API testing of application services against endpoint of any the environments(local, dev, test)(i.e. "https://dev.alkem.io/graphql")
Run tests:
- run all tests: `npm run-script test:nightly`
- run all tests from particular test suite area: `npm run-script test:it ./test/functional-api/integration/challenge/`
- run all tests for a test file: `npm run-script test:it ./test/functional-api/integration/challenge/query-challenge-data.it-spec.ts`
To debug tests in VS Code
Debug Jest IT Tests
configuration for IT testsTo run only one test from a test file
test
or describe
(i.e. test.only('should remove a challenge', async () => {})
)npm run-script test:it ./test/functional/integration/challenge/query-challenge-data.it-spec.ts
In order to be able to update the user secret (used in automation tests) for Travi CI configuration, the following steps, should be perforemed:
ruby
sudo apt update
sudo apt install ruby-full
ruby --version
gem install travis
travis login --pro --github-token [token]
server
repo, remove the existing secret
(secure: ) from .travis.yml
"double quotes"
for the variable, escaping is done with double backslash \\
t3$t@e!st
, escaped: "t3\\\$t\\@e\\!st"
$
should be escaped with 3 backaslashes \\\
travis encrypt --pro AUTH_TEST_HARNESS_PASSWORD="t3\\\$t\\@e\\!st" --add
scure: [encrypted password]
in .travis.yml
file