-
Notifications
You must be signed in to change notification settings - Fork 9
Configuration and Test Guide
Herd-UI is created, maintained and generated using Angular-CLI. Because of this, most of the build / testing commands that are used are straight from their documentation.
With simple configuration changes one can generically associate Herd-UI to any Herd instance.
The steps assume you have the latest Herd-UI code from GitHub. They also assume you have Node ( 6.9 or higher ) and have run 'npm install' from the project root.
Note: All commands are run from project root.
Instead of using the built in construct for environment variables that [Angular-CLI|https://github.com/angular/angular-cli] puts in place (using environement.ts) we have instead implemented a service that will go get a file called 'configuration.json'. This allows us to, in a pinch, go to the server instance and change the file so that configuration like changes can be immediately updated to the user on their next refresh. Because it is simply a JSON formatted file, any configuration can be added to it. However, there are some base configurations that the app needs to know in order to configure its corresponding Herd endpoints, Google Analytics tracking, Authentication methods and other things.
{
"restBaseUri": "https://my.herd-instance.com/herd-app/rest",
"basicAuthRestBaseUri": "https://my.herd-instance-using-basic-auth.com:8443/herd-app/rest",
"supportEmail": "[email protected]",
"brandHeader": "Herd",
"brandMotto": "Locate and understand data available in Herd!",
"docTitlePrefix": "Herd-UI",
"useBasicAuth": true,
"alertDelayInSeconds": 10,
"trackAnalytics": false,
"ga": {
"key": "PWD for UserName Encryption",
"iv": "IV for UserName Encryption",
"trackingId": "Enter Tacking ID Here"
},
"roles": {
"editDataEntityDescription": {
},
"editDataEntityColumns": {
},
"editDataEntityTags": {
},
"data_objects": {
}
}
}
- restBaseUri - default path to your herd instance
- basicAuthRestBaseUri - path to your herd instance that uses basic auth (defaults to restBaseUri if this is not given and useBasicAuth is true)
- supportEmail - configures the support email button that is in the header
- brandHeader - configures the branding header on the Home page
- brandMotto - configures the branding motto on the Home page
- docTitlePrefix - configures what comes before the title of the page loaded for each document generated for the page.
- useBasicAuth - configures authentication as using Authorization header and the Herd-IUI login page. If this is set to false the app will eagerly assume you have handled authentication before the app module was loaded and try to load data from the Herd instance as if it were authenticated. (e.g. NTLM SSO is used to communicate with herd or APP_INITIALIZER was used to make sure the user with authentic before the app loads.
- alertDelayInSeconds - configures global alert automatic dismiss delay in seconds
- trackAnalytics - configures where Google Analytics should be recorded for the app. (If this is set to true, ga.trackingId must also be set).
- ga - an aggregation object that contains information related to tracking users with Google Analytics.
- key - encryption key used to encode user id's tracked in Google Analytics (only needed if you want specific user id's by decoding them from google analytics)
- iv - encryption iv used to encode user id's track in Google Analytics (only needed if you want specific user id's by decoding them from google analytics)
- trackingId - the associated trackingId Google Analytics uses to track user sessions for a particular property (if this is not set no Google Analytics operations will occur)
- roles - aggregation object that sets roles base don feature currently needed for the app to know if a user hass access to edit or manipulate things. (to be deprecated)
- --feature-name--- : the feature particular roles ar eneeded for
- role: true – the name of the role that is needed
- --feature-name--- : the feature particular roles ar eneeded for
Configuration needed to run End to End (E2E) tests on the particular instances of Herd-UI and Herd. For ease of running tests (and best support) they are only run against chrome for local. If you want to locally run against other browsers you can find configurations for those at https://github.com/angular/protractor or https://github.com/SeleniumHQ/selenium
{
"baseUrl": "https://my.deployed.herd-ui.org",
"herdHost": "https://my.deployed.herd-ui.org/dm-app/rest",
"docTitlePrefix": "Herd-UI",
"loginUser": "FullAuthTestUser",
"loginPwd": "FullAuthTestPW",
"noAccessUser": "NoAuthTestUser",
"noAccessPassword": "NoAuthTestPW",
"authorization": {
"basicKey": "Basic 64BitEncoded-UserName:Password-thatHasAccessToCreateData"
},
}
- baseUrl - url to point to test a remote Herd-UI deployed instance (currently only setup to be able to test against a basic auth herdHost)
- herdHost - the herd host to test against (currently only setup to be able to test against a basic auth herdHost)
- docTitlePrefix - the same prefix that is set in the configuration.json to test against
With Jit compilation (more for development)
- ng build
- copy and deploy everything that was generated in the /dist folder to your dev environment public folder
With AOT compilation (more for production)
- ng build --prod
- copy and deploy everything that was generated in the /dist folder to your production environment public folder
With Jit compilation (more for development)
- ng serve
- open the browser to localhost:4200 to see the app
With AOT compilation (more for production)
- ng serve --aot
- copy and deploy everything that was generated in the /dist folder to your production environment public folder.
Our base tests are run in Jasmine using Karma (based off the Angular-CLI generated project)
- ng test
- Passing -cc adds code coverage that can be shown in /coverage/index.html
- Passing -sr only runs the testing once instead of being a live reload setup
Our E2E tests are run using Protractor (which internally uses jasmine) (based off the Angular-CLI generated project))
Note: Tests assume you have access to your herd instance which means if you need AppGate up then you need to start it before the tests run
- ng e2e
If you would like to test on a specific deployment of Herd-UI you can run:
- ng e2e --serve false
If you do this be sure to change the protractor.conf.js to have a baseUrl set to a deployed instance of Herd-UI that is configured to accept credentials (useBasicAuth: true) in order to test login capabilities.
You can also use e2e/config/conf.e2e.json value to set it and pull that into the protractor.conf.js instead.