haven-cypress-integration 1.3.3 → 1.4.1
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 +26 -2
- package/package.json +1 -1
- package/templates/Dockerfile +3 -3
- package/templates/cypress.config.js +26 -0
- package/templates/run-filtered.sh +12 -2
package/README.md
CHANGED
|
@@ -26,12 +26,35 @@ it("User registration @TC-AUTO-124, @p1", () => {
|
|
|
26
26
|
});
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
### 3.
|
|
29
|
+
### 3. Cypress Configuration (Optional Simplification)
|
|
30
|
+
The library automatically configures mochawesome reporting. You can use a simplified `cypress.config.js`:
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
const { defineConfig } = require("cypress");
|
|
34
|
+
|
|
35
|
+
module.exports = defineConfig({
|
|
36
|
+
video: false,
|
|
37
|
+
e2e: {
|
|
38
|
+
supportFile: "cypress/support/e2e.js",
|
|
39
|
+
setupNodeEvents(on, config) {
|
|
40
|
+
// Haven-cypress automatically handles:
|
|
41
|
+
// - mochawesome reporter configuration
|
|
42
|
+
// - grep functionality for tag filtering
|
|
43
|
+
// - proper environment variables
|
|
44
|
+
return config;
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Note**: If you prefer to keep your existing cypress.config.js with manual mochawesome configuration, that's fine too! The library will respect your settings.
|
|
51
|
+
|
|
52
|
+
### 4. Build Docker Image
|
|
30
53
|
```bash
|
|
31
54
|
npx haven-cypress build --product=BE
|
|
32
55
|
```
|
|
33
56
|
|
|
34
|
-
###
|
|
57
|
+
### 5. Push to ECR and Deploy to Haven
|
|
35
58
|
```bash
|
|
36
59
|
npx haven-cypress build --product=BE --push
|
|
37
60
|
```
|
|
@@ -113,6 +136,7 @@ BUILD_NUMBER=456 npx haven-cypress build --product=BE --push
|
|
|
113
136
|
|
|
114
137
|
- ✅ **Tag-based test filtering** (`@TC-AUTO-XXXX`)
|
|
115
138
|
- ✅ **Product-based organization** (ECR repository management)
|
|
139
|
+
- ✅ **Automatic mochawesome configuration** (no manual setup required)
|
|
116
140
|
- ✅ **Mochawesome reporting** with screenshots
|
|
117
141
|
- ✅ **S3 artifact upload** (reports, logs, screenshots)
|
|
118
142
|
- ✅ **HAVEN API integration** (result synchronization)
|
package/package.json
CHANGED
package/templates/Dockerfile
CHANGED
|
@@ -16,9 +16,9 @@ RUN apt-get update && \
|
|
|
16
16
|
./aws/install && \
|
|
17
17
|
rm -rf aws awscliv2.zip
|
|
18
18
|
|
|
19
|
-
# ✅ Install Node deps
|
|
20
|
-
RUN npm ci
|
|
21
|
-
RUN npm install --no-save aws-sdk
|
|
19
|
+
# ✅ Install Node deps (including dev dependencies for mochawesome)
|
|
20
|
+
RUN npm ci --include=dev
|
|
21
|
+
RUN npm install --no-save aws-sdk mochawesome mochawesome-merge mochawesome-report-generator
|
|
22
22
|
|
|
23
23
|
# ✅ Ensure script is executable
|
|
24
24
|
COPY run-filtered.sh /app/run-filtered.sh
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const { defineConfig } = require("cypress");
|
|
2
|
+
|
|
3
|
+
module.exports = defineConfig({
|
|
4
|
+
video: false,
|
|
5
|
+
// Mochawesome configuration is handled automatically by haven-cypress
|
|
6
|
+
// No need to configure reporter or reporterOptions manually
|
|
7
|
+
e2e: {
|
|
8
|
+
supportFile: "cypress/support/e2e.js",
|
|
9
|
+
setupNodeEvents(on, config) {
|
|
10
|
+
// Custom task logging (optional)
|
|
11
|
+
on("task", {
|
|
12
|
+
log(message) {
|
|
13
|
+
console.log("[cy.task] " + message);
|
|
14
|
+
return null;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Haven-cypress automatically configures:
|
|
19
|
+
// - mochawesome reporter
|
|
20
|
+
// - grep functionality for tag filtering
|
|
21
|
+
// - proper environment variables
|
|
22
|
+
|
|
23
|
+
return config;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -50,6 +50,9 @@ echo "💡 Final grep arg: $CYPRESS_GREP"
|
|
|
50
50
|
eval "npx cypress run \
|
|
51
51
|
--headless \
|
|
52
52
|
--browser chrome \
|
|
53
|
+
--reporter mochawesome \
|
|
54
|
+
--reporter-options 'reportDir=results/mochawesome,overwrite=false,html=false,json=true,timestamp=mmddyyyy_HHMMss' \
|
|
55
|
+
--env grepFilterSpecs=true,grepUntagged=false,grepEnabled=true \
|
|
53
56
|
$CYPRESS_GREP \
|
|
54
57
|
> results/logs.txt 2>&1"
|
|
55
58
|
|
|
@@ -61,7 +64,11 @@ MERGED_JSON="results/results.json"
|
|
|
61
64
|
REPORT_HTML="${MOCHAWESOME_DIR}/report.html"
|
|
62
65
|
|
|
63
66
|
echo "🛠️ Attempting to merge mochawesome JSON files..."
|
|
64
|
-
|
|
67
|
+
echo "📁 Contents of ${MOCHAWESOME_DIR}:"
|
|
68
|
+
ls -la ${MOCHAWESOME_DIR}/ || echo "❌ Directory not found"
|
|
69
|
+
echo "🔍 JSON files found:"
|
|
70
|
+
ls ${MOCHAWESOME_DIR}/*.json 2>/dev/null || echo "❌ No JSON files found"
|
|
71
|
+
npx mochawesome-merge ${MOCHAWESOME_DIR}/*.json > "${MERGED_JSON}" 2>&1 || echo "❌ Merge failed"
|
|
65
72
|
|
|
66
73
|
if [ -s "${MERGED_JSON}" ]; then
|
|
67
74
|
echo "✅ Merge successful. Generating report from merged JSON."
|
|
@@ -93,7 +100,10 @@ ZIP_PATH="/tmp/${ZIP_NAME}"
|
|
|
93
100
|
|
|
94
101
|
if [ -d "${MOCHAWESOME_DIR}" ]; then
|
|
95
102
|
echo "📦 Zipping mochawesome report and screenshots..."
|
|
96
|
-
|
|
103
|
+
echo "📁 Contents to zip:"
|
|
104
|
+
ls -la "${MOCHAWESOME_DIR}/"
|
|
105
|
+
zip -r "${ZIP_PATH}" "${MOCHAWESOME_DIR}" || echo "❌ ZIP creation failed"
|
|
106
|
+
echo "✅ ZIP created: ${ZIP_PATH} ($(ls -lh ${ZIP_PATH} 2>/dev/null | awk '{print $5}'))"
|
|
97
107
|
else
|
|
98
108
|
echo "❌ Mochawesome report folder not found: ${MOCHAWESOME_DIR}"
|
|
99
109
|
fi
|