Skip to content

Commit eb56675

Browse files
committed
Initial commit
0 parents  commit eb56675

File tree

218 files changed

+67242
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+67242
-0
lines changed

.circleci/config.yml

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
version: 2.1
2+
3+
orbs:
4+
allure: ayte/[email protected]
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

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.git
2+
.gitignore
3+
Dockerfile
4+
node_modules

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = tab
7+
indent_size = 4
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**/*.js
2+
CODEOWNERS
3+
node_modules
4+
.circleci
5+
.husky
6+
.vscode
7+
package-lock.json
8+
cypress/support/stepDefinitions/hooks.ts

.eslintrc.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"extends": [
3+
"plugin:cypress/recommended",
4+
"plugin:@typescript-eslint/eslint-recommended",
5+
"plugin:@typescript-eslint/recommended"
6+
],
7+
"parser": "@typescript-eslint/parser",
8+
"plugins": ["@typescript-eslint"],
9+
"ignorePatterns": ["!**/*"],
10+
"overrides": [
11+
{
12+
"files": ["*.ts", "*.tsx"],
13+
"parserOptions": {
14+
"project": "tsconfig.json"
15+
},
16+
"extends": ["plugin:diff/diff"],
17+
"rules": {
18+
"@typescript-eslint/no-var-requires": "warn",
19+
"cypress/no-assigning-return-values": "error",
20+
"cypress/no-unnecessary-waiting": "error",
21+
"cypress/assertion-before-screenshot": "warn",
22+
"cypress/no-force": "warn",
23+
"cypress/no-async-tests": "error",
24+
"cypress/no-pause": "error"
25+
}
26+
}
27+
]
28+
}

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
# System Files
3+
.DS_Store
4+
Thumbs.db
5+
6+
# Node Modules & Results
7+
node_modules/
8+
results/

.husky/.gitignore

Whitespace-only changes.

.husky/pre-commit

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx pretty-quick --staged
5+
npx eslint .

.prettierignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**/*.js
2+
CODEOWNERS
3+
node_modules
4+
.circleci
5+
.husky
6+
.vscode
7+
package-lock.json
8+
*.md
9+
Dockerfile
10+
.dockerignore
11+
**/*.yml

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"proseWrap": "always",
4+
"trailingComma": "all"
5+
}

.vscode/extensions.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"alexkrechik.cucumberautocomplete",
6+
"eamodio.gitlens",
7+
"ritwickdey.LiveServer",
8+
"PKief.material-icon-theme"
9+
]
10+
}

.vscode/settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"cucumberautocomplete.steps": [
3+
"cypress/support/stepDefinitions/**/*.ts"
4+
],
5+
"cucumberautocomplete.strictGherkinCompletion": true,
6+
"git.ignoreLimitWarning": true
7+
}

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to
7+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8+
9+
## [Unreleased]
10+
11+
- Current development changes [ to be moved to release ]
12+
13+
## [1.0.0] - YYYY-MM-DD
14+
15+
### Added
16+
17+
- Initial Release
18+
19+
### Changed
20+
21+
- Initial Release
22+
23+
### Removed
24+
25+
- Initial Release
26+
27+
[1.0.0]: GITHUB TAG URL

CODEOWNERS

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Each line is a file pattern followed by one or more owners.
2+
3+
# These owners will be the default owners for everything in
4+
# the repo. Unless a later match takes precedence,
5+
# @global-owner1 and @global-owner2 will be requested for
6+
# review when someone opens a pull request.
7+
*.* @CXEPI/px-cloud-qa-approvers
8+
9+
# Order is important; the last matching pattern takes the most
10+
# precedence. When someone opens a pull request that only
11+
# modifies JS files, only @js-owner and not the global
12+
# owner(s) will be requested for a review.
13+
# *.js @js-owner
14+
15+
# You can also use email addresses if you prefer. They'll be
16+
# used to look up users just like we do for commit author
17+
# emails.
18+
19+
20+
# In this example, @doctocat owns any files in the build/logs
21+
# directory at the root of the repository and any of its
22+
# subdirectories.
23+
# /build/logs/ @doctocat
24+
25+
# The `docs/*` pattern will match files like
26+
# `docs/getting-started.md` but not further nested files like
27+
# `docs/build-app/troubleshooting.md`.
28+
29+
30+
# In this example, @octocat owns any file in an apps directory
31+
# anywhere in your repository.
32+
# apps/ @octocat
33+
34+
# In this example, @doctocat owns any file in the `/docs`
35+
# directory in the root of your repository and any of its
36+
# subdirectories.
37+
# /docs/ @doctocat

Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM cypress/included:9.6.0
2+
RUN mkdir /cypress-docker
3+
WORKDIR /cypress-docker
4+
COPY ./package.json .
5+
COPY ./package-lock.json .
6+
COPY ./cypress.json .
7+
COPY ./cypress ./cypress
8+
RUN npm install
9+
ENTRYPOINT ["npm", "run", "cy:exec"]

README.md

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# cxpp-ui-automation
2+
3+
## Prerequisite
4+
5+
1. Install Node.js Latest LTS Version from https://nodejs.org/en/download/
6+
2. Install VS Code from https://code.visualstudio.com/download
7+
3. Follow the installation steps in https://github.com/MihanEntalpo/allure-single-html-file#installation to merge allure report to single file
8+
9+
## First Time Setup
10+
11+
Run `npm ci` command to install all dependencies
12+
13+
## Formatting files with Prettier
14+
15+
- To auto-format the files <br /> `npx prettier --write .`
16+
- To check the file format <br /> `npx prettier --check .`
17+
18+
## Running the tests
19+
20+
- Set the environment by setting CYPRESS_BASE_URL environment variable
21+
- Update user details at <br /> `fixtures/login/users.json` for non admin roles
22+
- For admin roles, set below environment variables
23+
| Variable | Sample Value |
24+
| -------------------------- | ------------------------------------ |
25+
| CYPRESS_BASE_URL | https://pxcloud-dev.cisco.com |
26+
| CYPRESS_PA_ST_HCAAS_USER | [email protected] |
27+
| CYPRESS_PA_ST_ONLY_USER | [email protected] |
28+
| CYPRESS_PA_HCAAS_ONLY_USER | [email protected] |
29+
| CYPRESS_PA_LCA_USER | [email protected] |
30+
| CYPRESS_PORTAL_PASSWORD | P@ssw0rd |
31+
- Run below command to open Cypress window <br /> `npm run cy:open`
32+
- Run below command to run the tests in CI mode
33+
34+
- Headless Mode <br /> `npm run cy:exec`
35+
- In Chrome Browser <br /> `npm run cy:exec -- --headed --browser chrome`
36+
- To run a specific feature file <br />
37+
`npm run cy:exec -- --spec "cypress/e2e/customers/NOTES.feature"`
38+
- To run a specific feature file in Edge browser <br />
39+
`npm run cy:exec -- --spec "cypress/e2e/customers/NOTES.feature" --headed --browser edge`
40+
- To run all features for a specific role
41+
`npm run cy:exec -- --spec "cypress/e2e/admin_st_only/Admin_ST_ONLY.features" --browser chrome`
42+
- Run below command to filter the tests by tags
43+
- To the the scenarios which has @GIMLET tag <br />
44+
`npm run cy:tags -- TAGS=@GIMLET`
45+
- To the the scenarios which has @GIMLET tag in Chrome browser <br />
46+
`npm run cy:tags -- TAGS=@GIMLET --headed --browser chrome`
47+
- To the the scenarios which has both @GIMLET & @sanity tags in Firefox
48+
browser <br />
49+
`npm run cy:tags -- TAGS='@GIMLET and @sanity' --headed --browser firefox`
50+
- To the the scenarios which has @regression tag but not the @ignore tag
51+
in Edge browser <br />
52+
`npm run cy:tags -- TAGS='@regression and not @ignore' --headed --browser edge`
53+
54+
## Allure Reports
55+
56+
- Clear Report <br /> `npm run report:clear`
57+
- Generate Report <br /> `npm run report:generate`
58+
- Open Report <br /> `npm run report:open`
59+
60+
## Further help
61+
62+
See
63+
[Setting Up GitHub for Development](https://confluence-eng-sjc1.cisco.com/conf/display/CXFEE/Setting+up+GitHub+for+development#SettingupGitHubfordevelopment-7.SettingupauthorizationtoaccessnewNPMregistry).
64+
65+
Visit the [TypeScript style guide](https://ts.dev/style) to go in-depth on our
66+
TS best practices.

0 commit comments

Comments
 (0)