Skip to content

Pearson-Higher-Ed/ux-test-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Platform for UX Design Build Status

How to run your tests in local:

  1. Clone this project: git clone https://github.com/Pearson-Higher-Ed/ux-test-platform.git

    ✋ Pre-requisite to run tests on local: Have node and maven installed on your machine.
    👉 elementsSDK: Choose a different working directory, Install elementsSDK on your local machine. Follow the below steps:
         git clone https://github.com/Pearson-Higher-Ed/elements-sdk.git
         cd elements-sdk
         git checkout branch-name
         npm install
         npm run build
         cp build/dist.elements-sdk.js /ux-test-platform/src/main/java/elementsSDK/functional/jsfiles/
         cp build/eventInstantiator.elements-sdk.js /ux-test-platform/src/main/java/elementsSDK/functional/jsfiles/
         cp build/css/elements.css /ux-test-platform/src/main/java/elementsSDK/css/
    👉 standAlone: Choose a different working directory, Install a stand alone component(eg. app-header) on your local machine. Follow the below steps:
         git clone https://github.com/Pearson-Higher-Ed/app-header.git
         cd app-header
         git checkout branch-name
         npm install
         npm run build
         cp build/dist.app-header.js /ux-test-platform/src/main/java/standAlone/jsfiles/appHeader/
         cp node_modules/elementsSDK/build/css/elements.css /ux-test-platform/src/main/java/standAlone/css/appHeader/
  2. Go to ux-test-platform directory

    cd ux-test-platform
    git checkout rebrand
    npm install
    npm run copy-assets
    python -m SimpleHTTPServer
  1. In test_suites/<<component>>.xml set the below values, and leave the rest to default:

    For CI tests:
     <include name="desktop-ci"/>
    For Regression tests:
     <include name="desktop-regression"/>
  2. Run mode configuration:

    • Run it as a maven test from your Terminal/Cmd prompt(for eg. elements_sdk.xml):
      cd /workspace/ux-test-platform
      mvn -Dtest_suite_xml=elements_sdk.xml
    • Run it as a testng suite. Right click on test_suites/<component.xml> and run as a testng suite.

NOTE: Mobile tests runs can also be run Sauce via your local machine. Follow this DOCS

How to run your tests in sauce via Travis CI:

  1. Go to .travis.yml and set the below settins:

    🏃To run elementsSDK:
     export component=elementsSDK
     export feature_branch=v1
     chmod 777 ./src/main/shell_scripts/components.sh
     ./src/main/shell_scripts/components.sh
     mvn -Dtest_suite_xml=elements_sdk.xml test
    🏃To run stand alone(eg. app-header):
     export component=app-header
     export feature_branch=master
     chmod 777 ./src/main/shell_scripts/components.sh
     ./src/main/shell_scripts/components.sh
     mvn -Dtest_suite_xml=app_header.xml test
  2. Go to test_suites/<component.xml> and set below settings:

    🏃To run desktop tests:
    <include name="desktop-regression"/>
    🏃To run mobile tests:
    <include name="mobie-regression"/>
  3. Make a codechange/commit to this repo

  4. In Travis CI, ux-test-platform build is triggered automatically

  5. Monitor the status of the build by looking into the Travis CI logs

How to set browser config properties:

  • Go to src/main/resources/environment.properties
  • Replace the default values to new values. Make sure the config properites are case-sensitive as accepted by Sauce. Refer How to set the correct platform config section.

Shell_Scripts for npm install:

  • If there is a component that you would want to npm install on this ux-test-platform
    • Go to src/main/shell_scripts/components.sh file.
    • Write a function with the component_name. for ex. install_component()
    • Add the npm install scripts and parametrize the function to checkout appropriate feature_branch name. Follow one of the existing functions.
    Set .travis.yml:
    script:
              export component=component_name
              export feature_branch=feature_branch_name
              mvn -Dtest_suite_xml=component_name.xml test

When you fork the repo

Tests would not run as the Sauce Connect secured encrypted user name and auth_key wouldn't work.The problem is due to encrypted environment variables SAUCE_USERNAME and SAUCE_ACCESS_KEY. Each repository needs its own encrypted variables, and they are not passed from the original repository to the fork. Regenerate encrypted environment variables SAUCE_USERNAME and SAUCE_ACCESS_KEY for the forked repo.

Encrypt sauce variables:
cd ux-test-platform
travis encrypt SAUCE_USERNAME=p_PDAauto   //This generates a new encrypted value. Simply replace the first 'secure' value in .travis.yml to this newly generated value
travis encrypt SAUCE_ACCESS_KEY=xxx-xxx-xxx //This generates a new encrypted value. Simply replace the second 'secure' value in .travis.yml to this newly generated value

  • Now commit this and push to your forked repo. It will work as expected.

How to set the correct platform config

Go this link: https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/

  • The Copy Code section is the right config platform. The same config should be used as Desired Capabilities in Test Code. Anything else would throw an error on Sauce and tests wouldn't run. Refer Base Class where desired Capabilities are set.

How to view the test results:

Go to Travis CI https://travis-ci.org/Pearson-Higher-Ed/ux-test-platform/builds/<last_build_run_id>

Look for TESTS section.

How to contribute to this repo:

Look into this DOCS

About

Test platform for Pearson Origami

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages