AngularJS client for DeviceHub.
NodeJS >=9.10 (recommended 10.16.1) with npm required.
- Download or clone this project.
git clone https://github.com/eReuse/DeviceHubClient.git- In the folder of the project, execute
npm install. This installs both npm and bower dependencies.
# DeviceHub
cd ../../
rm -rf node_modules && npm install- Update the config file according to your own requirements. Default values are already suited for development. Read the config for more info.
- Build the project (set
DH_ENVenvironment variable to select desired environment to build the package). After a while it generates an inner folder calleddistcontaining the built website.
# DeviceHub
rm -rf dist; export DH_ENV=e4; npm run-script build-prodExecute npm run-script build for auto-building when there
are changes in code, and npm run-script build-prod for building
a compressed version of the website suitable to use in production
environments. build-dev and build generate sourcemaps.
To run the unit tests, execute npm run-script test. This will run the tests once. You can
keep a daemon open which will re-run the tests once it detects a change in the code. For that
execute node ./node_modules/gulp/bin/gulp.js unit-test.
To run the E2E tests you will require access to a DeviceHub, so your DeviceHubClient will need to be configured to connect to a DeviceHub. Moreover, this DeviceHub will need to have populated the database with the dummy values.
- Execute
node ./node_modules/gulp/bin/gulp.js run-selenium. This will install and run Selenium, which is a server specialized in E2E tests. - Run
node ./node_modules/protractor/bin/protractor protractor.conf.jsin another terminal. This will open a Chrome window and run the tests there. I recommend not putting something above the Chrome window or minimizing it, as it can break the tests.
Note that you can ease the execution of the tests using a good IDE, like WebStorm. See how to configure Protractor and Gulp in WebStorm.