Skip to content

Commit f4190ad

Browse files
author
Ayooluwa
committed
chore: remove secrets from source, add cypress.env.json to gitignore
1 parent f728725 commit f4190ad

26 files changed

Lines changed: 1847 additions & 218 deletions

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: RegWatch Regression Suite
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
regression-tests:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
cache: 'npm'
22+
23+
- name: Install Dependencies
24+
run: npm ci
25+
26+
- name: Cypress Run & AI Enrichment
27+
run: npm run cypress:run:full
28+
env:
29+
CYPRESS_email: ${{ secrets.REGWATCH_EMAIL }}
30+
CYPRESS_password: ${{ secrets.REGWATCH_PASSWORD }}
31+
HUGGINGFACE_API_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
32+
33+
- name: Generate Combined HTML Report
34+
if: always()
35+
run: npm run generate:html
36+
37+
- name: Upload Test Artifacts
38+
if: always()
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: regwatch-test-reports
42+
path: |
43+
cypress/reports/html
44+
cypress/screenshots
45+
cypress/videos
46+
retention-days: 7

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,6 @@ cypress/reports/
136136
# OS files
137137
.DS_Store
138138
Thumbs.db
139+
140+
# Secrets
141+
cypress.env.json

Automation_Test_Flows/BDD_Bug_Report_Summary.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ EVIDENCE: notification_settings_modified_1773707175432.png
6262
STATUS: PASS (Persistence works, UI fails)
6363

6464
================================================================================
65-
Generated by @QA-Detective AI Framework
65+
by Ayooluwa (ai-powered QA)
6666
================================================================================

Automation_Test_Flows/SECRETS.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# RegWatch Secrets Management
2+
3+
This document outlines the protocol for handling sensitive credentials (passwords, API tokens) within the automated testing framework.
4+
5+
---
6+
7+
## 1. Local Development (`cypress.env.json`)
8+
9+
To run tests locally with your personal or automation credentials, create a `cypress.env.json` file in the project root:
10+
11+
```json
12+
{
13+
"email": "your-email@tester.co.uk",
14+
"password": "your-password-here"
15+
}
16+
```
17+
18+
> [!CAUTION]
19+
> This file is listed in `.gitignore` and must never be committed to version control.
20+
21+
---
22+
23+
## 2. CI/CD Integration (GitHub Secrets)
24+
25+
The regression pipeline pulls credentials from **GitHub Repository Secrets**. Ensure the following secrets are configured in the repository settings (`Settings > Secrets and variables > Actions`):
26+
27+
| Secret Name | Description |
28+
| :--- | :--- |
29+
| `REGWATCH_EMAIL` | The automation account email (e.g. `automation123@tester.co.uk`) |
30+
| `REGWATCH_PASSWORD` | The corresponding account password |
31+
| `HUGGINGFACE_API_TOKEN` | Required by the `testaignite-reporter` for AI failure analysis |
32+
33+
---
34+
35+
## 3. Implementation in Tests
36+
37+
Credentials are never hardcoded in `.cy.js` files. They are accessed via the `Cypress.env()` API.
38+
39+
**In `commands.js`**:
40+
```javascript
41+
const userEmail = email || Cypress.env('email') || 'fallback@email.com';
42+
const userPassword = password || Cypress.env('password') || 'fallback_pw';
43+
```
44+
45+
**In spec files**:
46+
```javascript
47+
beforeEach(() => {
48+
cy.loginByApi(); // Dynamically resolves credentials from environment
49+
});
50+
```
51+
52+
---
53+
54+
## 4. Environment Priority
55+
56+
Cypress resolves environment variables in the following order of priority:
57+
1. Arguments passed to `cy.loginByApi(manually_passed_email, manually_passed_pw)`
58+
2. `CYPRESS_` prefixed environment variables (CI pipeline)
59+
3. `cypress.env.json` (Local development)
60+
4. Default constant fallbacks (Hardcoded in `commands.js` for zero-config local runs)

0 commit comments

Comments
 (0)