101 lines
4.1 KiB
Markdown
101 lines
4.1 KiB
Markdown
# Matrix Cosec Automation for Velankani Group
|
|
|
|
Backend maintained by Bhushan C Thakkar (TCAOFF), automation scripted by Khushal P Soonderji (TCAOFF), and integrated to the frontend by Yatmesh L Redkar (TCAOFF).
|
|
|
|
---
|
|
|
|
## Credentials Management
|
|
|
|
These scripts need 2 kinds of credentials:
|
|
1. Cosec's credentials for automating browser behaviour for report fetching,
|
|
2. The CA Office's credentials for sync'ing data between Cosec and TCAOFF
|
|
|
|
Credentials are not sync'ed through Git or any other versioning system for security purposes. You must manually create the credential files (JSON format).
|
|
|
|
Here are templates for both (**⚠️ ONLY MODIFY WHAT HAS BEEN INDICATED**):
|
|
|
|
### 👉 Cosec Credentials
|
|
|
|
These have to be stored in `<proj-dir>/creds/cosec.json`
|
|
|
|
```json
|
|
{
|
|
"creds": {
|
|
"url": "http://x.x.x.x/COSEC/", // ... put the IP address here
|
|
"username": "<usr>", // .............. put your value here
|
|
"password": "<pwd>" // ............... put your value here
|
|
},
|
|
"generalConfig": {
|
|
"pollInterval": 3600,
|
|
"timezone": "Asia/Kolkata",
|
|
"timedelta": {
|
|
"days": 0,
|
|
"hours": 36,
|
|
"minutes": 0,
|
|
"seconds": 0
|
|
}
|
|
},
|
|
"musterRollConfig": {
|
|
"groupIds": ["2", "3", "4"] // ... whichever orgs you need to monitor
|
|
},
|
|
"inOutConfig": {
|
|
"groupIds": ["2", "3", "4"] // ... whichever orgs you need to monitor
|
|
}
|
|
}
|
|
```
|
|
|
|
### 👉 The CA Office (TCAOFF) Credentials
|
|
|
|
These have to be stored in `<proj-dir>/creds/tcaoff.json`
|
|
|
|
```json
|
|
{
|
|
"creds": {
|
|
"username": "<usr>", // ... put your value here
|
|
"password": "<pwd>", // ... put your value here
|
|
"sessionToken": null,
|
|
"user": null
|
|
},
|
|
"urls": {
|
|
"login": "https://api.thecaoffice.com/ca/login",
|
|
"logout": "https://api.thecaoffice.com/user/logout",
|
|
"branchList": "https://api.thecaoffice.com/commons/branch/list",
|
|
"branchAdd": "https://api.thecaoffice.com/commons/branch/add",
|
|
"deptList": "https://api.thecaoffice.com/commons/departments/list",
|
|
"deptAdd": "https://api.thecaoffice.com/commons/departments/add",
|
|
"teamList": "https://api.thecaoffice.com/team/list",
|
|
"teamAdd": "https://api.thecaoffice.com/team/add",
|
|
"teamUpdate": "https://api.thecaoffice.com/team/update",
|
|
"attendanceList": "https://api.thecaoffice.com/user/attendance/register",
|
|
"attendanceMark": "https://api.thecaoffice.com/user/attendance/mark"
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Selenium Web Driver Management
|
|
|
|
### Where To Get The Latest Drivers From
|
|
|
|
You can download the latest Chrome drivers from [this page](https://googlechromelabs.github.io/chrome-for-testing/).
|
|
|
|
Alternately, you can receive a well-structured JSON dump of the known good versions with their respective download links from [this URL](https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json).
|
|
|
|

|
|
|
|
### 👉 Where To Place The Drivers
|
|
|
|
Matrix refused to give APIs for accessing data from their Cosec system. Selenium is being used for web browser automation as a solution. We chose Chrome as the web browser for this since it is very widely available and most supported by a huge margin.
|
|
|
|
Browser automation needs corresponding drivers and drivers need be maintained based on 2 factors:
|
|
1. OS/platform that they will be running on,
|
|
2. the version that your browser is running on.
|
|
|
|
When you update the browser on your device, you will end up with a mismatch between the actual browser's version and the driver's version. It is possible that you will need to manually download the latest driver and put it in the appropriate path. Here are the paths:
|
|
* Windows Driver: `<proj-dir>/drivers/chrome/win64/chromedriver.exe`
|
|
* Linux Driver: `<proj-dir>/drivers/chrome/linux64/chromedriver`
|
|
|
|
You can check the version of Chrome on your device by going to `Settings` 👉 `About Chrome`. You will be able to see your browser's version and it will be something like `Version 143.0.7499.193 (Official Build) (64-bit)`.
|
|
|
|
 |