Note: this repository has been archived as a result of re-platforming the application. Please see this repository for future development
The app, added to DVSA mobile devices, allows assessors to check and record all aspects of a vehicle’s safety digitally
This project contains the mobile app that demonstrates a business workflow for CVS Alpha.
VTA uses the following AWS backend microservices:
- Activity/Visit Microservice
- ATF Microservice
- Defects Microservice
- Preparers Microservice
- Technical Records Microservice
- Test Number Microservice
- Test Results Microservice
- Test Types Microservice
Azure is used for identity management and in itegrates with EDH
This project using Ionic, if you don't have ionic follow these steps.
Please install and configure nvm with this node version so it can be used during installation 10.x.
The application currently run on 10.18.1, please run nvm use
once the correct node(s) versions have been downloaded with nvm.
Please install and run the following securiy programs as part of your testing process:
repo-security-scanner and after installing run it with git log -p | scanrepo
.
In order to generate SonarQube reports on local, follow the steps (brew or docker approach is recommended):
- install sonarqube using brew - formula -
- change
sonar.host.url
to point to localhost, by default, sonar runs onhttp://localhost:9000
. - run the sonar server -
sonar start
- then perform your analysis -npm run sonar-scanner
- - report will be available on
http://localhost:9000/dashboard?id=org.sonarqube%3Acvs-app-mobile
.
or alternatively you can manually install sonar server and its scanner:
- Download SonarQube server - sonarqube
- Download SonarQube scanner - scanner
- Add sonar-scanner in environment variables -> In bash_profile add the line
export PATH=<PATH_TO_SONAR_SCANNER>/sonar-scanner-3.3.0.1492-macosx/bin:$PATH
- Add sonar-scanner in environment variables -> In bash_profile add the line"export PATH=<PATH_TO_SONAR_SCANNER>/sonar-scanner-3.3.0.1492-macosx/bin:$PATH"
- Start the SonarQube server ->
cd <PATH_TO_SONARQUBE_SERVER>/bin/macosx-universal-64 ./sonar.sh start
- Start the SonarQube server -cd <PATH_TO_SONARQUBE_SERVER>/bin/macosx-universal-64 ./sonar.sh start
- In the microservice folder run the command ->
npm run sonar-scanner
- In the microservice folder run the command -npm run sonar-scanner
This repo does not contain references to API endpoints, and requires them to be injected at build time using values from .env
file. The scripts/config/create-config.ts
generates a config/application.<appType>.ts
. Please rename your env
file to .env
with the appropriate values/secrets.
It is recommended to use 10.x to run this project (supported versions up to 12) with the relevant node version(s), please refer to the package.json meta-data to find out about the version or .nvmrc
file in the project.
To get a working build running locally follow these steps:
-
Clone the repository.
-
Rename the
env
to.env
. Go to .env section and under the subheading .env copy and paste the content into the.env
file. Source your.env
file by runningsource .env
(Linux users) -
You can use
nvm use
to switch to the supported version of 10.x if you have more than one version of node installed Runnpm install
. -
You can launch the app in the web browser of choice at this stage:
Runnpm run start
ornpm run emulate:web
to start. Gotcha:⚠️ The authentication process requires a new tab to be opened so that the user name and password can be entered. Most browsers block this by default. So you should allow the browser pop up option⚠️ .
The application runs on Xcode 11 which will need to be installed on your machine. Once the platform is successfully installed, you can run the following script:
# use this to cleanup previously generated cordova platorm files and folders. Only needed for clean up to aid native build re-installation
npm run prepare:ios:remove
# use this to install and build the supported cordova-ios version 5 for native execution
npm run prepare:ios
You can then go to platforms/ios/Vehicle Testing.xcodeproj
and open with xcode and run the app using IPhone 8 (our target device).
# use this in development mode to build any file changes for reloading
npm run build:ios
Builds in the XCode may fail due to XCode 11 backward compatability with some outdated cordova-plugins, ionic 3. Even if the cordova build is successful, the XCode build may sometimes fails. Should it happen, remove the platforms (ios) and plugins and reinstall the ios platform.
npm run prepare:ios:remove
npm run prepare:ios
-
Github issues:
- Xcode backward compatibility: Cordova.h and Info.plist missing files.
- cordova-plugin-statusbar: Github
- cordova-plugin-inappbrowser: Github
- cordova-plugin-ionic-webview: Github
You can run the following script - npm run emulate:ios
to run the application in the emulator with the live reload once you retrieve your IPhone emulator id.
You will first need to get your iPhone 8 Plus that you can find under Simulator > Hardware menu > Devices > Manage devices
.
The ID will be shown on the Identifier
key.
You can then copy paste the value in the env
file to the following variable to your .env
(Please see placeholder env
file in project):
export IPHONE8_P_ID=
Run npm run build:ios
script and open your .xcodeproj
file to build the hybrid app.
- Hooks are applied on pre-commit, commit-msg and prepush using husky.
- Code is linted with tslint -
npm run lint
- We format the code using prettier -
npm run prettier
- Typescript is used and we follow the angular coding style with the following clean code principles
Before commiting code, please make sure scanrepo is configured.
We use commitlint when commiting code so make sure you are familiar with conventional commit format.
In order to test, you need to run the following:
npm run test:unit:watch
for unit tests.npm run test:unit:coverage
for code coveragenpm run sonar-scanner
for sonarqube.
Framework: Jasmine with Karma runner.
For the CI/CD and automation please refer to the following pages for further details:
The app would have been fully integrated with Sentry at this stage in the setup process. However if you wish to create a different sentry account you would need to follow these steps:
- Create an account in https://sentry.io/signup/ and create a default project to receive mobile app generated errors
npm install --save-dev @sentry/wizard
to help in configuring the mobile app with Sentry.io for the first time i.e. when the app does not exist in Sentry- Add the relevant Sentry keys to your
.env
file. - Run
npm run config
when used locally or in the pipeline will create:sentry.properties
file provided that.env
file already exist with required key/value pairs This file would have also being generated during @sentry/wizard integration setupSENTRY_DNS
when set to blank in the.env
file will disable sentry integration with the mobile app. Hence no logs will be sent to sentry for analysis.