|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +orbs: |
| 4 | + |
| 5 | + browser-tools: circleci/[email protected] |
| 6 | + webex-orb: cxepi/[email protected] |
| 7 | + |
| 8 | +jobs: |
| 9 | + run_tests: |
| 10 | + circleci_ip_ranges: true |
| 11 | + docker: |
| 12 | + - image: cimg/node:16.16.0-browsers |
| 13 | + environment: |
| 14 | + TERM: xterm |
| 15 | + parameters: |
| 16 | + specPath: |
| 17 | + type: string |
| 18 | + userType: |
| 19 | + type: string |
| 20 | + environment: |
| 21 | + type: string |
| 22 | + default: "Test" |
| 23 | + browser: |
| 24 | + type: string |
| 25 | + base_url: |
| 26 | + type: string |
| 27 | + default: ${BASE_URL_TEST} |
| 28 | + working_directory: ~/repo |
| 29 | + steps: |
| 30 | + - checkout |
| 31 | + - browser-tools/install-chrome |
| 32 | + - browser-tools/install-chromedriver |
| 33 | + - browser-tools/install-firefox |
| 34 | + - browser-tools/install-geckodriver |
| 35 | + - allure/install |
| 36 | + - restore_cache: |
| 37 | + name: Restore `package.json` cache |
| 38 | + keys: |
| 39 | + - deps-{{ .Branch }}-{{ checksum "package.json" }} |
| 40 | + - deps-{{ .Branch }} |
| 41 | + - deps |
| 42 | + - run: |
| 43 | + name: Install Dependencies |
| 44 | + command: | |
| 45 | + npm ci |
| 46 | + - save_cache: |
| 47 | + name: Save Cache - NPM and Cypress! |
| 48 | + key: v3-deps-{{ .Branch }}-{{ checksum "package.json" }} |
| 49 | + paths: |
| 50 | + - ~/.npm |
| 51 | + - ~/.cache/Cypress |
| 52 | + - run: |
| 53 | + name: Install Edge Browser |
| 54 | + command: | |
| 55 | + curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg |
| 56 | + sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ |
| 57 | + sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list' |
| 58 | + sudo rm microsoft.gpg |
| 59 | + sudo apt update |
| 60 | + sudo apt install microsoft-edge-dev |
| 61 | + wget https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/104.0.1271.2/edgedriver_linux64.zip -P ~/ |
| 62 | + unzip ~/edgedriver_linux64.zip -d ~/ |
| 63 | + rm ~/edgedriver_linux64.zip |
| 64 | + sudo mv -f ~/msedgedriver /usr/local/share/ |
| 65 | + sudo chmod 777 /usr/local/share/msedgedriver |
| 66 | + sudo ln -s /usr/local/share/msedgedriver /usr/local/bin/msedgedriver |
| 67 | + - run: |
| 68 | + name: Run Cypress Tests on << parameters.browser >> |
| 69 | + command: | |
| 70 | + export CYPRESS_BASE_URL=<< parameters.base_url >> |
| 71 | + export CYPRESS_PA_ST_ONLY_USER=${PA_ST_ONLY_USER} |
| 72 | + export CYPRESS_PA_ST_HCAAS_USER=${PA_ST_HCAAS_USER} |
| 73 | + export CYPRESS_PA_HCAAS_ONLY_USER=${PA_HCAAS_ONLY_USER} |
| 74 | + export CYPRESS_PA_LCA_USER=${PA_LCA_USER} |
| 75 | + export CYPRESS_PORTAL_PASSWORD=${PORTAL_PASSWORD} |
| 76 | + npm run cy:exec -- -b "<< parameters.browser >>" -s "<< parameters.specPath >>" |
| 77 | + - store_test_results: |
| 78 | + name: Store Test Results |
| 79 | + path: results/junit |
| 80 | + - run: |
| 81 | + name: Generate Allure Report |
| 82 | + when: always |
| 83 | + command: npm run report:generate |
| 84 | + - store_artifacts: |
| 85 | + name: Store Allure Report |
| 86 | + path: results/allure-report |
| 87 | + - webex-orb/notify: |
| 88 | + message: >- |
| 89 | + Hi Team, Below is the Cypress UI Automation Report on << parameters.environment >> Environment for << parameters.userType >> in "<< parameters.browser >>" browser. Circle CI Build URL - ${CIRCLE_BUILD_URL} Allure Report - https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/results/allure-report/index.html |
| 90 | +
|
| 91 | +workflows: |
| 92 | + run_tests_all_roles: |
| 93 | + jobs: |
| 94 | + - run_tests: |
| 95 | + name: "Admin (ST Only) - chrome" |
| 96 | + userType: "Admin - ST Only User" |
| 97 | + specPath: "cypress/e2e/admin_st_only/**/*.feature" |
| 98 | + browser: chrome |
| 99 | + filters: |
| 100 | + branches: |
| 101 | + only: |
| 102 | + - main |
| 103 | + - run_tests: |
| 104 | + name: "Admin (HCAAS Only) - chrome" |
| 105 | + userType: "Admin - HCAAS Only User" |
| 106 | + specPath: "cypress/e2e/admin_hcaas_only/**/*.feature" |
| 107 | + browser: chrome |
| 108 | + filters: |
| 109 | + branches: |
| 110 | + only: |
| 111 | + - main |
| 112 | + - run_tests: |
| 113 | + name: "Admin (HCAAS + ST) - chrome" |
| 114 | + userType: "Admin - HCAAS + ST User" |
| 115 | + specPath: "cypress/e2e/admin_hcaas_st/**/*.feature" |
| 116 | + browser: chrome |
| 117 | + filters: |
| 118 | + branches: |
| 119 | + only: |
| 120 | + - main |
| 121 | + - run_tests: |
| 122 | + name: "Admin (LCA) - chrome" |
| 123 | + userType: "Admin - LCA User" |
| 124 | + specPath: "cypress/e2e/admin_lca/**/*.feature" |
| 125 | + browser: chrome |
| 126 | + filters: |
| 127 | + branches: |
| 128 | + only: |
| 129 | + - main |
0 commit comments