Adding a new verification job for testapi UI. 07/57107/16
authorSakala Venkata Krishna Rohit <rohitsakala@gmail.com>
Mon, 7 May 2018 11:11:38 +0000 (16:41 +0530)
committerSakala Venkata Krishna Rohit <rohitsakala@gmail.com>
Wed, 23 May 2018 12:15:15 +0000 (12:15 +0000)
TestAPI web portal is being developed as part of an intern
project. Angular JS framework is being used to develop UI
functionalities. Also, corresponding unit tests have been
written. Grunt JS is javascript task runner which is used
to run tasks such as unit tests, coverage report etc. grunt e2e is
the name of the task to run unit tests. Tasks are defiend in
Gruntfile.js.

To run the unit tests, google chrome is required. Here, the unit tests are
ran using headless google chrome. Finally cobertura coverage report is
generated.

JIRA: RELENG-382

Change-Id: Ib12f8dd851276ab0e4116beb122518e9431d5b61
Signed-off-by: Sakala Venkata Krishna Rohit <rohitsakala@gmail.com>
jjb/releng/testresults-verify.yaml

index 958833c..c4f4c0f 100644 (file)
@@ -12,6 +12,7 @@
     jobs:
       - '{module}-verify-{stream}'
       - '{module}-client-verify-{stream}'
+      - '{module}-ui-verify-{stream}'
 
     project: 'releng-testresults'
 
@@ -30,7 +31,7 @@
     triggers:
       - gerrit-trigger-patchset-created:
           server: 'gerrit.opnfv.org'
-          project: '**'
+          project: '{project}'
           branch: '{branch}'
           files: '{module}/**'
 
@@ -61,7 +62,7 @@
     triggers:
       - gerrit-trigger-patchset-created:
           server: 'gerrit.opnfv.org'
-          project: '**'
+          project: '{project}'
           branch: '{branch}'
           files: '{module}/{module}-client/**'
 
     publishers:
       - publish-coverage
       - email-jenkins-admins-on-failure
+
+- job-template:
+    name: '{module}-ui-verify-{stream}'
+
+    parameters:
+      - project-parameter:
+          project: '{project}'
+          branch: '{branch}'
+      - 'opnfv-build-ubuntu-defaults'
+
+    scm:
+      - git-scm-gerrit
+
+    wrappers:
+      - nodejs-installator:
+          name: "testapi node"
+
+    triggers:
+      - gerrit-trigger-patchset-created:
+          server: 'gerrit.opnfv.org'
+          project: '{project}'
+          branch: '{branch}'
+          files: '{module}/opnfv_testapi/ui/**'
+
+    builders:
+      - shell: |
+          set -e
+
+          if ! which google-chrome > /dev/null; then
+              #Install Google Chrome
+              wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
+              echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee \
+                  /etc/apt/sources.list.d/google-chrome.list
+              sudo apt-get update
+              sudo apt-get install -y google-chrome-stable
+          fi
+
+          npm -v
+          node -v
+          cd ./{module}/opnfv_testapi/ui/
+          npm install -g grunt-cli
+          npm install
+          grunt e2e
+          mv ../tests/UI/coverage/cobertura-coverage.xml ../../../coverage.xml # Moving coverage \
+             # xml to workspace as required by publish-coverage publisher.
+
+    publishers:
+      - text-finder-failures
+      - publish-coverage
+      - email-jenkins-admins-on-failure
+
+- publisher:
+    name: 'text-finder-failures'
+    publishers:
+      - text-finder:
+          regexp: " 0 failures"
+          also-check-console-output: true
+          succeed-if-found: true