You need to have ant, git and nodeJS (version 10.0.0 or higher) installed.
All instructions are at https://github.com/HistoryAtState/hsg-project/wiki/Setup.
With homebrew installed, run:
brew update && brew upgrade
brew install ant git node@10
And follow homebrew's instructions to ensure that node 10's executables are run:
If you need to have node@10 first in your PATH run:
echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.bash_profile
Then:
source ~/.bash_profile
After node is installed just run
npm install -g gulp bower
-
Clone the repository
git clone https://github.com/HistoryAtState/hsg-shell.git
-
Build the application package
ant
-
Switch to the eXist Dashboard
-
Install the package
build/hsg-shell-x.y.z.xar
with the Package Manager -
Click on the history.state.gov icon on the eXist Dashboard
To create an up-to-date build package to install in eXist-db, this should do
git pull && ant
- Clone bootstrap via
https://github.com/twbs/bootstrap.git
- Install Jekyll to be able to view bootstrap docs locally:
gem install jekyll
- See this tip for working around jekyll installation errors
brew unlink libyaml && brew link libyaml
- In the bootstrap clone directory, run
jekyll serve
, then view bootstrap documentation at http://localhost:9001/
gulp build
builds the resource folder with fonts, optimized images, scripts and compiled styles
gulp deploy
sends the resource folder to a local existDB
gulp watch
will upload the build files whenever a source file changes.
NOTE: For the deploy and watch task you may have to edit the DB credentials in gulpfile.js
.
ant
- Single
xar
file: This will build a XAR file after running npm install bower install and gulp (build).ant
In order to build a xar package of the app with ant
and to run scripts, that will build the app files like ie. minified css, js, you'll need to install node.js
, npm
and gulp
in certain versions, that will be specified in this projects package.json
and npm-shrinkwrap.json
(for dependency locks).
- Update your system to
node v10.0.0
either via using nvm, or directly from the node website. - Check your current node version with
node --version
, it should bev10.0.0
now. - Install (or update to) the latest
npm
version withnpm install -g npm
. - Install bower
npm install -g bower
. - Install gulp
npm install -g gulp
. The project's gulp file depends ongulp 4
(or higher) syntax, so make sure in the next step, that you'll have gulp 4.x running. - Check the paths, where your node, npm and gulp have been installed (depends on OS) by running
which node
,which npm
,which gulp
. - Look for file
example.local.build.properties
, copy it, rename it tolocal.build.properties
and insert the current paths you just got by running the "which" commands. This file is necessary for pointing the ant task runner to the necessary build tools. - Install the node packages (listed in file
package.json
) by runningnpm install
. - If npm errors occur, try fix it either by running
npm update
, or by deleting the entirenode_modules
folder from the project and then runningnpm install
once again. - Last, you may have to edit the credentials in file
local.node-exist.json
which is needed for configure the automated deployment of files from your local HSG-Shell project to your local existdb. The defaults in this file will generally apply here, unless you have modified the credentials elsewhere.
- node:
node -v
=> Should outputv10.0.0
- npm:
npm -v
=> Should output at leastv6.9.0
- gulp:
gulp -v
=> Should output at leastCLI version: 2.2.0, Local version: 4.0.2
Now, with a running eXist-db you're ready to run either ant
or gulp
to test if your update was successful.
If NODE_ENV
environment variable is set to production the XAR is build with
minified and concatenated styles and scripts. This build will then include
google-analytics and DAP tracking.
NODE_ENV=production ant
for a single test
export NODE_ENV
in the login script on a production server
Make sure you have Google Chrome >= 79 and all required node_modules installed (npm install
).
If you have problems with installing or running Chromedriver, have a look at these resources: webdriver.io/docs/wdio-chromedriver-service.html, stackoverflow
- Edit the path to where your local Chrome binary is installed in the web test configuration
wdio.conf.js
at line:process.env.WDIO_CHROME_BINARY = process.env.WDIO_CHROME_BINARY || 'path-to-your-local-binary'
- Optional: Edit which test files or suites you would like to run.
Here is the part where to define the test suites:
suites: { dev: [ './tests/specs/**/dev_*.js' ], prod: [ './tests/specs/**/prod_*.js' ] }
Basic syntax of starting an entire test suite is
node_modules/.bin/wdio wdio.conf.js --suite name-of-the-testsuite
for example (runs all development environment test that have been listed in the wdio configuration in suites: {dev : ...}
):
node_modules/.bin/wdio wdio.conf.js --suite dev
and for a single test it is
node_modules/.bin/wdio wdio.conf.js --spec path-to-the-testspec
for example:
node_modules/.bin/wdio wdio.conf.js --spec tests/specs/error/prod_404.spec.js
In addition, you can define running the test commands in package.json
within the scripts
key, for example:
"test-dev": "./node_modules/.bin/wdio wdio.conf.js --suite dev"
and run this command with
npm run-script test-dev
This test runs in "headless" mode. It means the test will run in the background without opening a browser window.
If you want to observe all actions in the web test in a browser, just comment out the headless
argument in the wdio.conf.js
:
chromeOptions: {
args: [
//'headless',
'disable-gpu',
'--window-size=1280,1024',
'ignore-certificate-errors',
'ignore-urlfetcher-cert-requests'
],
binary: process.env.WDIO_CHROME_BINARY
},
This web test is configured to use the framework Mocha
with Chai
and activated Chai plugin assert
(global.assert = chai.assert;
) for assertions.
Have a look at the documentation:
- General overview about "webdriver.io": webdriver.io/docs/gettingstarted
- Webdriver.io functions: webdriver.io/docs/api
- List of all functions in the Chai Assertion library: chaijs.com/api/assert
- Overview about mocha.js: mochajs.org