Skip to content
Snippets Groups Projects
Verified Commit 26ff6926 authored by Mark's avatar Mark
Browse files

Rewrite testing instructions

parent c8b42e7b
No related branches found
No related tags found
1 merge request!2Minimal frontend
......@@ -70,19 +70,44 @@ access the api with a browser that automatically includes your cookie in the req
Passing the token as a GET or POST variable is not supported.
### Run the tests
### Testing
Install the development dependencies with
The test folder includes end to end tests that you can run from your workstation to check if
your setup is working properly especially in case you want to make changes to the code.
#### Prerequisites
E2E tests are executed with chromedriver. Make sure that you have a supported version
of chromium installed. To downgrade the chromium version that is used in the tests, change
the version number in `package.json` [accordingly](https://www.npmjs.com/package/chromedriver).
In order to run the tests you also need to install additional node packages.
The development and testing dependencies can be installed with
```
npm install # without --production
```
Configure the application as described above.
After creating two regular users and an admin user by assigning the role `admin` to the admin
user and granting the admin and one of the test users access to the `user-panel` application,
configure the default values in `test/nightwatch_globals.js`. Don't forget to set the usernames
and passwords of the test users you created. After that, run `npm run test`.
The tests will use login credentials of 3 different users.
* Create a user that has the role `admin`and the application `user-panel` assigned to it.
* Create a second user and only assign the application `user-panel`.
* Create a third user and don't assign anything to it.
Note: E2E tests are executed with chromedriver. Make sure that you have a supported version
of chromium installed. To downgrade the chromium version that is used in the tests, change
the version number in `package.json` [accordingly](https://www.npmjs.com/package/chromedriver).
You can use the utility scripts provided in the backend folder of this repo to create the users
applications and roles. To do that execute:
```
bash ../backend/utils/create-application.bash user-panel
bash ../backend/utils/create-role.bash admin
bash ../backend/utils/create-user.bash admin adminadmin admin@example.net
bash ../backend/utils/create-user.bash testuser testtest testuser@example.net
bash ../backend/utils/create-user.bash testuser2 testtest testuser2@example.net
bash ../backend/utils/assign-role.bash admin admin
bash ../backend/utils/grant-access.bash admin user-panel
bash ../backend/utils/grant-access.bash testuser user-panel
```
After that configure the values in `test/nightwatch_globals.js` to match the usernames and
passwords.
#### Run the tests
To run the tests, execute `npm run test`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment