# qa_automation_api

> HBS --host api Test Suite. Used to test endpoint across the enterprise.

Latest version **1.0.0** (published 2023-09-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install qa_automation_api
pnpm add qa_automation_api
yarn add qa_automation_api
bun add qa_automation_api
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-09-26 |
| First published | 2023-09-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 25 |
| Unpacked size | 4.4 MB |
| Known vulnerabilities | 0 (+17 in 3 direct dependencies) |
| Install scripts | no |
| Author | HBS |
| Maintainers | abbashbs |

## Links

- npm: https://www.npmjs.com/package/qa_automation_api
- npm.io page: https://npm.io/package/qa_automation_api

## Dependencies (25)

- [fs](https://npm.io/package/fs.md) 0.0.1-security
- [json](https://npm.io/package/json.md) ^11.0.0
- [yargs](https://npm.io/package/yargs.md) ^17.6.2
- [allure](https://npm.io/package/allure.md) ^0.0.0
- [bcrypt](https://npm.io/package/bcrypt.md) ^5.1.0
- [crypto](https://npm.io/package/crypto.md) ^1.0.1
- [moment](https://npm.io/package/moment.md) ^2.29.4
- [rimraf](https://npm.io/package/rimraf.md) ^4.4.1
- [xml2js](https://npm.io/package/xml2js.md) ^0.6.2
- [express](https://npm.io/package/express.md) ^4.18.2
- [unirest](https://npm.io/package/unirest.md) ^0.6.0
- [winston](https://npm.io/package/winston.md) ^3.8.2
- [basic-ftp](https://npm.io/package/basic-ftp.md) ^5.0.2
- [form-data](https://npm.io/package/form-data.md) ^4.0.0
- [socket.io](https://npm.io/package/socket.io.md) ^4.5.3
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [nodemailer](https://npm.io/package/nodemailer.md) ^6.8.0
- [jest-allure](https://npm.io/package/jest-allure.md) ^0.1.3
- [joi-machine](https://npm.io/package/joi-machine.md) ^3.0.0
- [serve-index](https://npm.io/package/serve-index.md) ^1.9.1
- [fetch-cookie](https://npm.io/package/fetch-cookie.md) ^2.1.0
- [concat-stream](https://npm.io/package/concat-stream.md) ^2.0.0
- [follow-redirects](https://npm.io/package/follow-redirects.md) ^1.15.2
- [allure-commandline](https://npm.io/package/allure-commandline.md) ^2.18.1
- [jest-allure-reporter](https://npm.io/package/jest-allure-reporter.md) ^1.2.3

## Recent versions

- 1.0.0 (latest) — 2023-09-26

## README

# Usage

### Test Suites <br>
***Windows***
```
run_tests.bat
```
***Mac/Linux***
```
./run_tests.sh
```
### Individual App <br>
```
node run_tests <app_name> <environment_file> <user_type>:<email>

node run_tests HBSAlumniGivingService secure_stage_hbsstg student:jslovin@mba1996stg.hbsstg.org
```

### Individual Script <br>
This will traverse subdirectories looking for the specified script.<br>
To configure environment, edit package.json "testWin" or "testMac" script.<br>

```
npm run (testWin or testMac) <script_name>

npm run testWin hacs_getSubmissions_external.spec.js
```

# Setup
## Node.js
Node.js is a prerequisite to using this framework. 
We recommend the latest LTS version (18.12.1 as of this writing)
There are several ways to install node.
### Official Installer 
https://nodejs.org/en/

### Alternatives
https://www.nodejsdesignpatterns.com/blog/5-ways-to-install-node-js/

## Clone Git Repo
```
git clone https://code.harvard.edu/HBS/qa_automation_api.git
```
## Install and Update modules
These commands install the node modules specified in the package.json file.
From the project's root directory, run the following:
```
npm install
npm update
```
## Authentication
Authentication information is stored in ***./credentials.json*** and ***./secrets.json***. <br>
Placeholder versions are included in github.<br>

After initial configuration (below), authentication is handled by the framework.<br>
Users added in tests and in ***package.json*** will use provided credentials or CEE pwds from ***secrets.json***.<br>

### Configure initial credentials and secrets
The framework doesn't update passwords, so they must be initially set manually.
We don't store secrets in git, so you need to add/create them in these files

Update ***utils/credentials.json*** (already has a skeleton in place, just add user's info)
1. Open the file and update the passwords for each type of users. 
2. Save.<br>

Create ***utils/secrets.json***
1. Create a file named secrets.json in the utils folder.
2. Follow this simple JSON format:
```
{
  "staff": "super secret password",
  "mba": "super secret password",
  "exed": "super secret password",
  "alumni": "super secret password",
  "public": "super secret password",
  "crossreg": "super secret password"
}
```

### How to configure/use authentication
During execution the framework uses credentials.json to set a CAS cookie for the specified users.<br>
The test cases then pull the cookie for a specifis user when configuring the request object.<br>

Users are specified 2 ways:<br>
 - Per app -  specified in ***package.json scripts*** ; This method updates credentials.json
  ```
  Configure ./package.json "scripts":
  <script name>: "node <script runner> <app name> <env file> <optional username>",

  "testAccountHealthCheck": "node run_tests AccountHealthCheck secure_stage_hbsstg cweinberg@hbsstg.org",

  Reference cookie in test:
  auth = require('../../../utils/credentials.json')

      it('TC-001 - hacs_changeCaption_external - This API call returns correct response with 200 status code', (done) => {
      
         request.post(data.TC001.endpoint)
                .set("Content-Type", "text/html")
                .set("Cookie",auth.cas_stu.cookie)
                .set("accept", "text/html")
                .end((err, res) => {
                  if (err) done.fail(err);
                  expect(res.status).toBe(200);
                  done()
                });
      });
  ```
 - Per test - specified in test data json file: On the fly and not persisted
```
Gets MOD_AUTH_CAS cookie for specified user (in this case Exed alum)
data.TC001.username = "alumnX@apm163stg.hbsstg.org"

authCookie = await login.getModAuthCASCookie(data.TC001.username, 'alu');
      await request.get(data.TC001.endpoint)
                   .set("Content-Type", "application/json")
                   .set("Cookie", authCookie)
```
For 'per app'...
***CAS.js*** and ***changeUser.js*** files are utilized (by the framework) to update credentials.json with the new user and cookie.<br>
***The new user remains the active user (of that type e.g. Staff, Student, etc...) UNTIL:***<br>
- changed in next app (package.json)
- credentials.json is edited

***Utilizing 'per test' method doesn't update credentials.json*** (so, you can use it for one test and then call credentials.json in the next)  

# Project Structure
## Top Level
```
├── allure-report
├── allure-results
├── allure_features
├── config
├── history
├── logs
├── node_modules
├── projects
├── responses
└── utils
```


# Reporting
[Allure Report](https://github.com/allure-framework/allure2) is our reporting tool.
Allure reports are not static. To view them, you must run the allure server.
Reports are created on a per app basis. 
[Allure Commandline](https://www.npmjs.com/package/allure-commandline) must be installed on the host.
[Allure Commandline Docs](https://docs.qameta.io/allure/#_commandline) 
To view a report:
```
cd <app directory> e.g. /Users/cweinberg/git/qa_automation_api/history/2022-12-05_13-26/AccountHealthCheck
allure open
```

# Usage and Information about some Important folders
./allure_feature : This Folder contain files which provides additional section information in allure report for ex Information about executor, environment properties etc. <br />
./allure-report : This Folder contain data files which are used to create allure report by allure reporting tool files for ex history ,trends etc.<br />
./allure-results : This Folder have xml files which contains test execution's result data for every single testcase<br />
./config : This folder contain json files which have base URLs for multiple sevices inside it <br />
./node_modules : This folder contain all the libraries which are installed and used within HBS automation framework <br />
./projects : This folder contains multiple automated projects which are used in HBS automation framework <br />
./utils : In this folder we have all files that contains global data and that data further used within automation scripts.

# CEE Project Info
---
1. AccountHealthCheck
   * UserType : Staff/Faculty
   * CEE Domain : hbsstg.org
   * Swagger Page URL : https://secure-stage.hbsstg.org/accountHealthCheck/swagger-ui.html
   * Server name : secure-stage.hbsstg.org

2. AccountManagementWS
   * UserType : Staff/Faculty
   * CEE Domain : hbsstg.org
   * Swagger Page URL : http://intsvcs.hbsstg.org/accountManagementWS/swagger-ui.html
   * Server name : intsvcs.hbsstg.org

3. AlumniElasticSearch
   * UserType : Staff/Faculty
   * CEE Domain : hbsstg.org
   * Swagger Page URL : https://secure-stage.hbsstg.org/alumniElasticSearchService/swagger-ui.html
   * Server name : secure-stage.hbsstg.org

4. CalendarEventWebServices
   * UserType : Staff/Faculty
   * CEE Domain : hbsstg.org
   * Swagger Page URL : http://api.hbsstg.org/calendarEventsWS/swagger-ui.html
   * Server name : api.hbsstg.org

5. CanvasCourseArchive
   * UserType : Staff/Faculty
   * CEE Domain : hbsstg.org
   * Swagger Page URL : https://secure-stage.hbsstg.org/canvasCourseArchive/swagger-ui.html
   * Server name : secure-stage.hbsstg.org

6. CheckList
   * UserType : Staff/Faculty
   * CEE Domain : hbsstg.org
   * Swagger Page URL : https://secure-stage.hbsstg.org/checklist/swagger-ui.html
   * Server name : secure-stage.hbsstg.org

7. Classcards
   * UserType : Staff/Faculty
   * CEE Domain : hbsstg.org
   * Swagger Page URL : https://secure-stage.hbsstg.org/classcards/swagger-ui.html
   * Server name : secure-stage.hbsstg.org

8. Cmat
   * UserType : Staff/Faculty
   * CEE Domain : hbsstg.org
   * Swagger Page URL : https://secure-stage.hbsstg.org/calendar-mgmt/swagger-ui.html
   * Server name : secure-stage.hbsstg.org

9. ConfigurationManagementService
   * UserType : Staff/Faculty
   * CEE Domain : hbsstg.org
   * Swagger Page URL : https://secure-stage.hbsstg.org/configurationManagementService/swagger-ui.html
   * Server name : secure-stage.hbsstg.org

10. CPDAlumniProvisioningService
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/cpdAlumniProvisioningService/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

11. EnterpriseWrapperService
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/enterpriseWrapperService/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

12. HBSExEdAccountBuilder
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/eeaccounts/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

13. ExamV3
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/exam_v3/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

14. GroupWS
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/groups/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

15. HBSAlumniGivingService
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/alumniGivingService/swagger-ui.html#/
    * Server name : secure-stage.hbsstg.org

16. HBSAlumniMessagingServices
    * UserType : Staff/Faculty and Alumni Student
    * CEE Domain : hbsstg.org and alumstg.hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/ws/alumniMessaging/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

17. HBSAlumniClassNotesService
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/alumniLifeClassNotesService/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

18. HBSCallTool
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/calltool/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

19. HBSCPDEventsService
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : http://api.hbsstg.org/calendarCPDEvents/swagger-ui.html
    * Server name : api.hbsstg.org

20. HBSEstimatorService
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/estimator/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

21. HBSGeoServices
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/ws/hbsGeoService/swagger-ui.html
    * Server name : secure-stage.hbsstg.org


22. HBSMessagingService
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : http://api.hbsstg.org/ws/hbsMessagingService/swagger-ui.html
    * Server name : api.hbsstg.org


23. HBSPlanningEventsService
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://api.hbsstg.org/calendarPlanningEvents/swagger-ui.html#/
    * Server name : api.hbsstg.org

24. HBSSecuredAccounts
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/securedAccounts/swagger-ui.html#/ 
    * Server name : secure-stage.hbsstg.org

25. HBSSimAuth
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/simauth/swagger-ui.html#/
    * Server name : secure-stage.hbsstg.org

26. IndependentProjects
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL : https://secure-stage.hbsstg.org/ip/swagger-ui.html#/
    * Server name : secure-stage.hbsstg.org

27. NameRecording
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL :https://secure-stage.hbsstg.org/nameRecordingService/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

28. PanoptoWrapperService
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL :https://api.hbsstg.org/panoptoWrapperService/swagger-ui.html#/
    * Server name : api.hbsstg.org

29. PeerFeedbackTool
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL :https://secure-stage.hbsstg.org/peerFeedbackTool/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

30. Poll
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL :	https://secure-stage.hbsstg.org/hbsPoll/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

31. PubReg
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL :	https://secure-stage.hbsstg.org/pub_reg/swagger-ui.html#/
    * Server name : secure-stage.hbsstg.org

32. TMT
    * UserType : Staff/Faculty
    * CEE Domain : hbsstg.org
    * Swagger Page URL :	https://secure-stage.hbsstg.org/tmt/swagger-ui.html
    * Server name : secure-stage.hbsstg.org

---
_Source: https://npm.io/package/qa_automation_api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
