haven-cypress-integration 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -10
- package/package.json +1 -1
- package/templates/syncCypressResults.js +16 -4
package/README.md
CHANGED
|
@@ -28,24 +28,30 @@ it("User registration @TC-AUTO-124, @p1", () => {
|
|
|
28
28
|
|
|
29
29
|
### 3. Build Docker Image
|
|
30
30
|
```bash
|
|
31
|
-
npx haven-cypress build
|
|
31
|
+
npx haven-cypress build --product=BE
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
### 4. Deploy to Haven
|
|
35
|
-
|
|
34
|
+
### 4. Push to ECR and Deploy to Haven
|
|
35
|
+
```bash
|
|
36
|
+
npx haven-cypress build --product=BE --push
|
|
37
|
+
```
|
|
38
|
+
Your Docker image is now pushed to ECR and ready to be deployed and run by HAVEN!
|
|
36
39
|
|
|
37
40
|
## Commands
|
|
38
41
|
|
|
39
42
|
### Build Image
|
|
40
43
|
```bash
|
|
41
|
-
# Basic build
|
|
42
|
-
npx haven-cypress build
|
|
44
|
+
# Basic build with product organization
|
|
45
|
+
npx haven-cypress build --product=BE
|
|
43
46
|
|
|
44
|
-
# Custom tag
|
|
45
|
-
npx haven-cypress build --tag=
|
|
47
|
+
# Custom tag with product
|
|
48
|
+
npx haven-cypress build --product=BE --tag=v1.0
|
|
46
49
|
|
|
47
|
-
# Build and push to
|
|
48
|
-
npx haven-cypress build --
|
|
50
|
+
# Build and push to ECR haven-test-images repository
|
|
51
|
+
npx haven-cypress build --product=BE --push
|
|
52
|
+
|
|
53
|
+
# Build and push with custom tag
|
|
54
|
+
npx haven-cypress build --product=BE --tag=v1.0 --push
|
|
49
55
|
```
|
|
50
56
|
|
|
51
57
|
### Run Tests
|
|
@@ -57,12 +63,29 @@ npx haven-cypress run
|
|
|
57
63
|
npx haven-cypress run --automationIds=TC-AUTO-123,TC-AUTO-124
|
|
58
64
|
```
|
|
59
65
|
|
|
66
|
+
### ECR Image Organization
|
|
67
|
+
Images are organized in the `haven-test-images` ECR repository with product-based tagging:
|
|
68
|
+
```
|
|
69
|
+
Repository: haven-test-images
|
|
70
|
+
├── BE-latest-2025-09-10T10-52-44
|
|
71
|
+
├── BE-v1.0-2025-09-10T14-30-15
|
|
72
|
+
├── billexplainer-latest-2025-09-10T11-15-30
|
|
73
|
+
└── payments-latest-2025-09-10T12-00-45
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Tag Format**: `{PRODUCT}-{VERSION}-{TIMESTAMP}`
|
|
77
|
+
- **Product**: Organizes images by product/team
|
|
78
|
+
- **Version**: `latest` (default) or custom tag (e.g., `v1.0`)
|
|
79
|
+
- **Timestamp**: Ensures unique tags and prevents overwrites
|
|
80
|
+
|
|
60
81
|
## What's Included
|
|
61
82
|
|
|
62
83
|
- ✅ **Tag-based test filtering** (`@TC-AUTO-XXXX`)
|
|
84
|
+
- ✅ **Product-based organization** (ECR repository management)
|
|
63
85
|
- ✅ **Mochawesome reporting** with screenshots
|
|
64
86
|
- ✅ **S3 artifact upload** (reports, logs, screenshots)
|
|
65
87
|
- ✅ **HAVEN API integration** (result synchronization)
|
|
88
|
+
- ✅ **ECR integration** (automatic push to haven-test-images repository)
|
|
66
89
|
- ✅ **Docker containerization** ready for HAVEN deployment
|
|
67
90
|
|
|
68
91
|
## How It Works
|
|
@@ -76,8 +99,9 @@ npx haven-cypress run --automationIds=TC-AUTO-123,TC-AUTO-124
|
|
|
76
99
|
## Requirements
|
|
77
100
|
|
|
78
101
|
- Node.js 14+
|
|
79
|
-
- Docker
|
|
102
|
+
- Docker or Podman
|
|
80
103
|
- Existing Cypress project
|
|
104
|
+
- AWS credentials configured (for ECR push)
|
|
81
105
|
- HAVEN access credentials (provided by Haven when container runs)
|
|
82
106
|
|
|
83
107
|
## Support
|
package/package.json
CHANGED
|
@@ -13,8 +13,19 @@ const bucketName = process.env.S3_BUCKET || "your-bucket-name";
|
|
|
13
13
|
// Paths
|
|
14
14
|
const automationCasesPath = "/shared/automation-cases.json";
|
|
15
15
|
const postBaseUrlPath = "/shared/result-post-url.txt";
|
|
16
|
+
const triggeredByPath = "/shared/triggered-by.txt";
|
|
16
17
|
const baseUrl = fs.readFileSync(postBaseUrlPath, "utf-8").trim();
|
|
17
18
|
|
|
19
|
+
// Read triggered_by value
|
|
20
|
+
let triggeredBy = null;
|
|
21
|
+
try {
|
|
22
|
+
if (fs.existsSync(triggeredByPath)) {
|
|
23
|
+
triggeredBy = fs.readFileSync(triggeredByPath, "utf-8").trim();
|
|
24
|
+
}
|
|
25
|
+
} catch (err) {
|
|
26
|
+
console.warn("⚠️ Could not read triggered-by.txt:", err.message);
|
|
27
|
+
}
|
|
28
|
+
|
|
18
29
|
(async () => {
|
|
19
30
|
let automationIds = null;
|
|
20
31
|
const formatted = [];
|
|
@@ -69,8 +80,8 @@ const baseUrl = fs.readFileSync(postBaseUrlPath, "utf-8").trim();
|
|
|
69
80
|
typeof test.fullTitle === "string"
|
|
70
81
|
? test.fullTitle
|
|
71
82
|
: Array.isArray(test.title)
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
? test.title.join(" ")
|
|
84
|
+
: test.title;
|
|
74
85
|
|
|
75
86
|
const allTags = [...(titleCombined.match(/@[\w-]+/g) || [])];
|
|
76
87
|
|
|
@@ -78,8 +89,8 @@ const baseUrl = fs.readFileSync(postBaseUrlPath, "utf-8").trim();
|
|
|
78
89
|
test.state === "passed" || test.pass === true
|
|
79
90
|
? "pass"
|
|
80
91
|
: test.pending === true
|
|
81
|
-
|
|
82
|
-
|
|
92
|
+
? "skipped"
|
|
93
|
+
: "fail";
|
|
83
94
|
|
|
84
95
|
if (!automationIds) {
|
|
85
96
|
allTags
|
|
@@ -125,6 +136,7 @@ async function postResults(formattedResults, notFoundList, planId, runId) {
|
|
|
125
136
|
runId,
|
|
126
137
|
results: formattedResults,
|
|
127
138
|
not_found: notFoundList,
|
|
139
|
+
triggered_by: triggeredBy,
|
|
128
140
|
};
|
|
129
141
|
|
|
130
142
|
console.log(
|