diff --git a/.travis.yml b/.travis.yml index 0c5ce43..a992edc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,9 @@ node_js: - 4.2 script: - npm run ci +- chmod 777 ./node_modules/@pearson-components/npm-scripts/shell_scripts/run_selenium_ci_tests.sh +- export TEST_GROUP=desktop-regression +- "./node_modules/@pearson-components/npm-scripts/shell_scripts/run_selenium_ci_tests.sh" deploy: provider: npm email: pearson-design-accelerator@pearson.com @@ -14,3 +17,6 @@ deploy: on: branch: master tags: true +env: + global: + secure: iaonK0LD5C8YfooAUmXf7wL72L4jxR5Z3FztZEEzDfQ2ewUAamOaM6ft3dhmj9B8yXROR4PhgfRArrVtqIv1ECsuq0PvL9o5zb56YUu6iAJiu7sYggnfYPhc5qcO+v9/5tRkjICLfeajdN8KdOIuEW4Z55ZC063JLhQCdXcFQ9aSc5CauQp/mWI7Oo9BuDLUSWh4ZkO/WvHxAadzKQTrVyIrOsQraAHZWAXhWjwdlAsV/d++qaQ9j+yWaheGagt/VQV2aqZodffyfCrQEtfr3k74WxFgQVtu3ZKG5VgeBeestV7eyBWTrXlKvnS5VhgASLR9fh0sNbUNrow/Hf8PxznRFCx/TDIXB12Y+Lb17ZbutM4eqQsTfHYhrp7lAx+t8hTcFWvMQs1HvWjuO5W35E371p9+8hSIADSAtA+SP88gVusJRVBe+Sv0VqwIPEKYii4WFbyfQd/VBtk5CooPi2wtZvOj9lSR0k7KeMBf2IGipINDKm296g+uE7KJc4WTF2nx0fdNmSLEie3MVU6YVh4HubEFOlK3CMSEgxut+D2j83Lfj9QBy51bkfZfd/jz/Z5gCFLI/9PgNkaHJFRNKMaAn7QDNFdH8DmFWSdv70ywNXO7MINNFyHPWgpdIf9Adqo9NRlL3qUa/KsRR0JwNDS4i6UVwblwGBYjEoBld48= diff --git a/LICENSE b/LICENSE index 9f124f5..5dcc0de 100644 --- a/LICENSE +++ b/LICENSE @@ -1,10 +1,16 @@ -Copyright © 2017 Pearson Education, Inc. -All Rights Reserved. - -NOTICE: All information contained herein is, and remains -the property of Pearson Education, Inc. The intellectual and technical concepts contained -herein are proprietary to Pearson Education, Inc. and may be covered by U.S. and Foreign Patents, -patent applications, and are protected by trade secret or copyright law. -Dissemination of this information, reproduction of this material, and copying or distribution of this software -is strictly forbidden unless prior written permission is obtained -from Pearson Education, Inc. +MIT License +Copyright (c) 2017, Pearson Education, Inc. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/package.json b/package.json index d972669..5cd17e5 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "inline-loader": "^0.1.1" }, "devDependencies": { + "@pearson-components/npm-scripts": "^0.5.6", "babel-core": "~6.3.17", "babel-eslint": "~4.1.6", "babel-loader": "~6.2.0", diff --git a/test/shell_scripts/run_tests.sh b/test/shell_scripts/run_tests.sh deleted file mode 100644 index 273078d..0000000 --- a/test/shell_scripts/run_tests.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash - -echo "Trigger the Selenium tests for master branch: ux-test-platform repo...." - -#Step 1: API to trigger the ux-test-platform build with the below config -body="{ -\"request\": { -\"message\": \"feat(component-archetype): Run Demo Tests\", -\"branch\":\"master\", -\"config\": { -\"script\": [ -\"export component=component-archetype\", -\"export feature_branch=$TRAVIS_BRANCH\", -\"chmod 777 ./src/main/shell_scripts/components.sh\", -\"./src/main/shell_scripts/components.sh\", -\"mvn -Dtest_suite_xml=component_archetype.xml test\" -] -} -}}" - -curl -s -X POST \ - -H "Content-Type: application/json" \ - -H "Accept: application/json" \ - -H "Travis-API-Version: 3" \ - -H "Authorization: token $AUTH_TOKEN" \ - -d "$body" \ - https://api.travis-ci.org/repo/Pearson-Higher-Ed%2Fux-test-platform/requests - -echo "" -echo "Waiting for approximately 5s for the Selenium tests to trigger..." -echo "" - -REPO_URI="https://api.travis-ci.org/repos/Pearson-Higher-Ed/ux-test-platform/builds" -i=1 -max=20 -while [ $i -lt $max ] -do - curl -i $REPO_URI > test.json #Push the json response to a temp file 'test.json' - - LATEST_STATE=$(grep -o '"state":.[a-z\"]*' test.json | head -1 ) #Fetch the state of the last build - LATEST_ID=$(grep -o '"id":.[0-9]*' test.json | head -1 | grep ':.[0-9]*') #Fetch the id of the last build - BRANCH=$(grep -o '"branch":.[a-z\"]*' test.json | head -1 ) #Fetch the branch name of the last build - - get_state_value=${BRANCH#*:} - BRANCH="${get_state_value//\"}" - - if [ $BRANCH == "master" ] #If condition to check if the last triggered build is master - sleep 5 - curl -i $REPO_URI > test.json - then LATEST_ID=$(grep -o '"id":.[0-9]*' test.json | head -1 | grep ':.[0-9]*') # - echo "LATEST_ID of master branch.............................. $LATEST_ID" - export LATEST_ID - break - else - true $(( i++ )) - sleep 1 - fi -done - -#Step 2 : Fetch the build status of the 'master' branch -get_buildId_value=${LATEST_ID#*:} -BUILD_ID="${get_buildId_value//\"}" - -REPO_URI_WITH_BUILDID="$REPO_URI/$BUILD_ID" -echo $REPO_URI_WITH_BUILDID - -i=1 -max=900 #Max time for the tests to run. -while [ $i -lt $max ] -do - -curl -i $REPO_URI_WITH_BUILDID > test.json - -STATE=$(grep -o '"state":.[a-z\"]*' test.json | head -1 ) #Fetch the state of master build -#RESULT=$(grep -o '"result":.[0-9]*' test.json | head -1 | grep ':.[0-9]*') #For debug -STATUS=$(grep -o '"status":.[0-9]*' test.json | head -1 | grep ':.[0-9]*') #Fetch the status of master build - -echo "--------------------------------------------" -echo "Polling for the tests run build status..." -echo "ux-test-platform build run in progress: https://travis-ci.org/Pearson-Higher-Ed/ux-test-platform/builds/$BUILD_ID" - -get_state_value=${STATE#*:} -STATE="${get_state_value//\"}" - -get_status_value=${STATUS#*:} -STATUS="${get_status_value//\"}" - -if [ $STATUS == "0" ] #Success condition -then - echo "counter-> $i" - echo "TESTS RUN... PASSED :-) " - break #As soon as the tests run pass, we break and return back to the elements build run -elif [ $STATUS == "1" ] #Failure condition -then - echo "TESTS RUN... FAILED :-(" - exit 1 #As soon as the tests run fail, we stop building elements -elif [[ $STATE == "finished" && $STATUS == "n" ]] #Unexpected failure due to Travis environment issues -then - echo "TESTS RUN... NULL :-(" - exit 1 #For some reason, if the ux-test-platform build breaks or halts -elif [ $i == "900" ] #Maxed out condition - then - echo "ux-test-platform run time has maxed out..." - exit 1 #Selenium tests run for more than the max time. -fi - -true $(( i++ )) -sleep 1 #This 1s is required to poll the build status for every second -echo "counter-> $i" -done \ No newline at end of file