haven-cypress-integration 1.6.2 → 2.0.0
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 +224 -120
- package/bin/haven-cypress.js +46 -59
- package/index.js +87 -215
- package/package.json +4 -3
- package/templates/Dockerfile +32 -22
- package/templates/run-filtered.sh +178 -91
- package/templates/syncCypressResults.js +128 -148
package/README.md
CHANGED
|
@@ -1,164 +1,268 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Seamless integration
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
# haven-cypress-integration
|
|
2
|
+
|
|
3
|
+
Seamless Cypress integration with HAVEN test case management. Advanced test execution with real-time monitoring and flexible configuration options.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
- **Automatic report generation** (Mochawesome HTML + JSON)
|
|
7
|
+
- **Tag-based filtering** using `@TC-AUTO-XXXX` and custom tags via `@cypress/grep`
|
|
8
|
+
- **Environment support** - Test against QA/DEV/CTE/PROD environments
|
|
9
|
+
- **Custom tags support** - Filter by `@smoke`, `@regression`, `@p1`, etc.
|
|
10
|
+
- **Real-time log streaming** to S3 during test execution
|
|
11
|
+
- **Flexible test execution** via custom `E2E_COMMAND` environment variable
|
|
12
|
+
- **Enhanced automation ID detection** (supports dots, dashes)
|
|
13
|
+
- **S3 artifact upload** to `artifacts/{PRODUCT}/{PLAN_ID}/automation/{RUN_ID}`
|
|
14
|
+
- **HAVEN API integration** with environment information
|
|
15
|
+
- **ECR push** with product+version tagging (version from consumer `package.json`)
|
|
16
|
+
- **Podman compatible** - Works with both Docker and Podman
|
|
17
|
+
|
|
18
|
+
## Install
|
|
8
19
|
```bash
|
|
9
|
-
npm install haven-cypress-integration
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
### 2. Add Tags to Tests
|
|
13
|
-
Add `@TC-AUTO-XXXX` tags to your test descriptions:
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
it("Login test @TC-AUTO-123, @p2", () => {
|
|
17
|
-
cy.visit('/login');
|
|
18
|
-
cy.get('[data-cy=username]').type('user');
|
|
19
|
-
cy.get('[data-cy=password]').type('pass');
|
|
20
|
-
cy.get('[data-cy=submit]').click();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("User registration @TC-AUTO-124, @p1", () => {
|
|
24
|
-
cy.visit('/register');
|
|
25
|
-
// your test code
|
|
26
|
-
});
|
|
20
|
+
npm install haven-cypress-integration cypress
|
|
27
21
|
```
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
The library automatically configures mochawesome reporting. You can use a simplified `cypress.config.js`:
|
|
23
|
+
## Usage
|
|
31
24
|
|
|
32
|
-
|
|
33
|
-
const { defineConfig } = require("cypress");
|
|
25
|
+
### Build Types
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
```
|
|
27
|
+
#### Thin Image (Default)
|
|
28
|
+
Lightweight image that clones your code at runtime from Azure DevOps. Best for CI/CD pipelines:
|
|
29
|
+
```bash
|
|
30
|
+
# Build thin image (default)
|
|
31
|
+
npx haven-cypress build --product=BE --push
|
|
49
32
|
|
|
50
|
-
|
|
33
|
+
# Explicit thin image build
|
|
34
|
+
npx haven-cypress build --product=BE --type=thin --push
|
|
51
35
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
npx haven-cypress build --product=BE
|
|
36
|
+
# With custom tag
|
|
37
|
+
npx haven-cypress build --product=BE --type=thin --tag=thin-1.0.0 --push
|
|
55
38
|
```
|
|
56
39
|
|
|
57
|
-
|
|
40
|
+
#### Full Image
|
|
41
|
+
Includes your app code baked into the image. Best for simple deployments:
|
|
58
42
|
```bash
|
|
59
|
-
|
|
43
|
+
# Build full image
|
|
44
|
+
npx haven-cypress build --product=BE --type=full --push
|
|
60
45
|
```
|
|
61
|
-
Your Docker image is now pushed to ECR and ready to be deployed and run by HAVEN!
|
|
62
46
|
|
|
63
|
-
|
|
47
|
+
**Thin Image Runtime Requirements:**
|
|
48
|
+
- `ADO_REPO` - Full ADO repo path (e.g., `dev.azure.com/org/project/_git/repo`)
|
|
49
|
+
- `ADO_PAT` - Personal Access Token for authentication
|
|
50
|
+
- `ADO_BRANCH` - Branch to clone (optional, default: `main`)
|
|
64
51
|
|
|
65
|
-
### Build
|
|
52
|
+
### Build and Deploy Examples
|
|
66
53
|
```bash
|
|
67
|
-
#
|
|
54
|
+
# Build locally (thin image - default)
|
|
68
55
|
npx haven-cypress build --product=BE
|
|
69
56
|
|
|
70
|
-
#
|
|
71
|
-
npx haven-cypress build --product=BE --tag=v1.0
|
|
72
|
-
|
|
73
|
-
# Build and push to ECR haven-test-images repository
|
|
57
|
+
# Build and push thin image to ECR (default)
|
|
74
58
|
npx haven-cypress build --product=BE --push
|
|
75
59
|
|
|
76
|
-
# Build and push
|
|
77
|
-
npx haven-cypress build --product=BE --
|
|
60
|
+
# Build and push full image to ECR
|
|
61
|
+
npx haven-cypress build --product=BE --type=full --push
|
|
62
|
+
|
|
63
|
+
# Build with custom version (thin by default)
|
|
64
|
+
npx haven-cypress build --product=BE --tag=v2.1.0 --push
|
|
78
65
|
```
|
|
79
66
|
|
|
80
|
-
###
|
|
67
|
+
### Running Tests
|
|
81
68
|
```bash
|
|
82
|
-
# Run
|
|
83
|
-
npx haven-cypress run
|
|
84
|
-
|
|
85
|
-
# Run specific test cases
|
|
69
|
+
# Run specific automation IDs
|
|
86
70
|
npx haven-cypress run --automationIds=TC-AUTO-123,TC-AUTO-124
|
|
87
|
-
```
|
|
88
71
|
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
# Run tests with custom tags
|
|
73
|
+
npx haven-cypress run --customTags=smoke,p1
|
|
74
|
+
|
|
75
|
+
# Combine automation IDs and custom tags
|
|
76
|
+
npx haven-cypress run --automationIds=TC-AUTO-123 --customTags=smoke
|
|
91
77
|
```
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
78
|
+
|
|
79
|
+
### HAVEN Deployment
|
|
80
|
+
HAVEN will run your containerized tests with environment variables:
|
|
81
|
+
```bash
|
|
82
|
+
docker run \
|
|
83
|
+
-e TEST_ENVIRONMENT=PROD \
|
|
84
|
+
-e PLAN_ID=123 \
|
|
85
|
+
-e RUN_ID=456 \
|
|
86
|
+
-e E2E_COMMAND="npm run test:e2e" \
|
|
87
|
+
066726995253.dkr.ecr.us-east-1.amazonaws.com/haven-test-images:BE-1.1.0 \
|
|
88
|
+
--customTags=smoke,p1
|
|
97
89
|
```
|
|
98
90
|
|
|
99
|
-
|
|
100
|
-
- **Product**: Organizes images by product/team
|
|
101
|
-
- **Version**: Semantic versioning (e.g., `2.1.0`) or build numbers (e.g., `1.0.123456`)
|
|
91
|
+
## Test Tagging Examples
|
|
102
92
|
|
|
103
|
-
###
|
|
93
|
+
### Basic Test Tagging
|
|
94
|
+
```javascript
|
|
95
|
+
describe('Login Tests', () => {
|
|
96
|
+
it('should login successfully @TC-AUTO-123 @smoke @p0', () => {
|
|
97
|
+
const env = Cypress.env('TEST_ENVIRONMENT'); // QA, DEV, CTE, PROD
|
|
98
|
+
cy.visit(`https://${env.toLowerCase()}.myapp.com/login`);
|
|
99
|
+
// your test code
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should register new user @TC-AUTO-456 @regression @p1', () => {
|
|
103
|
+
// your test code
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
```
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
### Environment-Specific Testing
|
|
109
|
+
```javascript
|
|
110
|
+
it('environment-specific test @TC-AUTO-789', () => {
|
|
111
|
+
const env = Cypress.env('TEST_ENVIRONMENT');
|
|
112
|
+
|
|
113
|
+
switch(env) {
|
|
114
|
+
case 'PROD':
|
|
115
|
+
cy.visit('https://app.mycompany.com');
|
|
116
|
+
break;
|
|
117
|
+
case 'CTE':
|
|
118
|
+
cy.visit('https://cte.mycompany.com');
|
|
119
|
+
break;
|
|
120
|
+
default:
|
|
121
|
+
cy.visit(`https://${env.toLowerCase()}.mycompany.com`);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
111
124
|
```
|
|
125
|
+
|
|
126
|
+
### Using Custom E2E Commands
|
|
127
|
+
For projects with custom test runners, set the `E2E_COMMAND` environment variable:
|
|
112
128
|
```bash
|
|
113
|
-
#
|
|
114
|
-
|
|
115
|
-
→ ECR tag: BE-2.1.0
|
|
129
|
+
# In your Dockerfile or container environment
|
|
130
|
+
ENV E2E_COMMAND="npm run test:e2e:prod"
|
|
116
131
|
```
|
|
117
132
|
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
→ ECR tag: BE-3.0.0
|
|
133
|
+
The integration will export `HAVEN_GREP_INCLUDE` and `HAVEN_GREP_EXCLUDE` for use in your `cypress.config.js`:
|
|
134
|
+
```javascript
|
|
135
|
+
// cypress.config.js
|
|
136
|
+
const { defineConfig } = require('cypress');
|
|
123
137
|
|
|
124
|
-
|
|
125
|
-
|
|
138
|
+
module.exports = defineConfig({
|
|
139
|
+
e2e: {
|
|
140
|
+
setupNodeEvents(on, config) {
|
|
141
|
+
// Use HAVEN's grep patterns if available
|
|
142
|
+
if (process.env.HAVEN_GREP_INCLUDE) {
|
|
143
|
+
config.env.grepTags = process.env.HAVEN_GREP_INCLUDE;
|
|
144
|
+
}
|
|
145
|
+
if (process.env.HAVEN_GREP_EXCLUDE) {
|
|
146
|
+
config.env.grepInvert = process.env.HAVEN_GREP_EXCLUDE;
|
|
147
|
+
}
|
|
148
|
+
return config;
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
});
|
|
126
152
|
```
|
|
127
153
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
154
|
+
## Artifacts and Monitoring
|
|
155
|
+
|
|
156
|
+
### S3 Artifacts
|
|
157
|
+
- **Live Output**: `s3://{BUCKET}/artifacts/{PRODUCT}/{PLAN_ID}/automation/{RUN_ID}/live-output.log` (updated every 30s)
|
|
158
|
+
- **Final Output**: `s3://{BUCKET}/artifacts/{PRODUCT}/{PLAN_ID}/automation/{RUN_ID}/test-output.log`
|
|
159
|
+
- **Report ZIP**: `s3://{BUCKET}/artifacts/{PRODUCT}/{PLAN_ID}/automation/{RUN_ID}/{PRODUCT}_{TIMESTAMP}.zip`
|
|
160
|
+
|
|
161
|
+
### Shared Volume (for HAVEN)
|
|
162
|
+
- ZIP: `/shared/test-logs/{PRODUCT}_{TIMESTAMP}.zip`
|
|
163
|
+
- HTML: `/shared/test-logs/report.html`
|
|
164
|
+
|
|
165
|
+
## Environment Variables
|
|
166
|
+
|
|
167
|
+
### Required (provided by HAVEN)
|
|
168
|
+
- `PLAN_ID` - Test plan identifier
|
|
169
|
+
- `RUN_ID` - Test run identifier
|
|
170
|
+
- `PRODUCT_NAME` - Product name for artifact organization
|
|
171
|
+
- `BUCKET_NAME` - S3 bucket for artifact uploads
|
|
172
|
+
|
|
173
|
+
### Optional
|
|
174
|
+
- `TEST_ENVIRONMENT` - Target environment (QA/DEV/CTE/PROD, default: QA)
|
|
175
|
+
- `E2E_COMMAND` - Custom test execution command (default: `npx cypress run ...`)
|
|
176
|
+
- `HAVEN_GREP_PATTERN` - Grep pattern from Haven (parsed into include/exclude)
|
|
177
|
+
|
|
178
|
+
### Available to Tests
|
|
179
|
+
- `TEST_ENVIRONMENT` - Accessible in your test code via `Cypress.env('TEST_ENVIRONMENT')`
|
|
180
|
+
- `HAVEN_GREP_INCLUDE` - Exported grep pattern for custom configs
|
|
181
|
+
- `HAVEN_GREP_EXCLUDE` - Exported grep pattern for excluding tests (NOT: prefix)
|
|
182
|
+
|
|
183
|
+
## ECR Image Management
|
|
184
|
+
|
|
185
|
+
Images are automatically tagged and organized by product and build type:
|
|
186
|
+
|
|
187
|
+
### Tag Format
|
|
188
|
+
- **Full Image**: `{PRODUCT}-{VERSION}` (e.g., `BE-1.1.0`)
|
|
189
|
+
- **Thin Image**: `{PRODUCT}-thin-{VERSION}` (e.g., `BE-thin-1.1.0`)
|
|
190
|
+
|
|
191
|
+
### Repository
|
|
192
|
+
- **Repository**: `haven-test-images`
|
|
193
|
+
- **Examples**:
|
|
194
|
+
- `BE-1.1.0` (full image from package.json version)
|
|
195
|
+
- `BE-thin-1.1.0` (thin image for ADO cloning)
|
|
196
|
+
- `payments-2.1.0` (custom full image)
|
|
197
|
+
- `payments-thin-2.1.0` (custom thin image)
|
|
198
|
+
|
|
199
|
+
### Usage in HAVEN
|
|
200
|
+
```yaml
|
|
201
|
+
# Use full image (app code included)
|
|
202
|
+
image: haven-test-images:BE-1.1.0
|
|
203
|
+
|
|
204
|
+
# Use thin image (requires ADO_REPO, ADO_PAT env vars)
|
|
205
|
+
image: haven-test-images:BE-thin-1.1.0
|
|
206
|
+
environment:
|
|
207
|
+
ADO_REPO: "dev.azure.com/myorg/myproject/_git/myrepo"
|
|
208
|
+
ADO_PAT: "${ADO_PAT_SECRET}"
|
|
209
|
+
ADO_BRANCH: "main"
|
|
133
210
|
```
|
|
134
211
|
|
|
135
|
-
##
|
|
212
|
+
## Requirements
|
|
136
213
|
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
- ✅ **HAVEN API integration** (result synchronization)
|
|
143
|
-
- ✅ **ECR integration** (automatic push to haven-test-images repository)
|
|
144
|
-
- ✅ **Docker containerization** ready for HAVEN deployment
|
|
214
|
+
- Node.js 16+
|
|
215
|
+
- Podman or Docker
|
|
216
|
+
- AWS CLI configured (for ECR push)
|
|
217
|
+
- HAVEN access credentials (provided when container runs)
|
|
218
|
+
- `@cypress/grep` plugin configured in your Cypress project
|
|
145
219
|
|
|
146
|
-
##
|
|
220
|
+
## Cypress Project Setup
|
|
147
221
|
|
|
148
|
-
|
|
149
|
-
2. **Your tests run** with tag filtering based on automation IDs
|
|
150
|
-
3. **Results are generated** using Mochawesome reporting
|
|
151
|
-
4. **Artifacts are uploaded** to S3 for review
|
|
152
|
-
5. **Results sync back** to HAVEN via API integration
|
|
222
|
+
Ensure your Cypress project has the `@cypress/grep` plugin configured:
|
|
153
223
|
|
|
154
|
-
|
|
224
|
+
```bash
|
|
225
|
+
npm install @cypress/grep --save-dev
|
|
226
|
+
```
|
|
155
227
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
228
|
+
```javascript
|
|
229
|
+
// cypress/support/e2e.js
|
|
230
|
+
import registerCypressGrep from '@cypress/grep';
|
|
231
|
+
registerCypressGrep();
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
```javascript
|
|
235
|
+
// cypress.config.js
|
|
236
|
+
const { defineConfig } = require('cypress');
|
|
161
237
|
|
|
162
|
-
|
|
238
|
+
module.exports = defineConfig({
|
|
239
|
+
e2e: {
|
|
240
|
+
setupNodeEvents(on, config) {
|
|
241
|
+
require('@cypress/grep/src/plugin')(config);
|
|
242
|
+
return config;
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
```
|
|
163
247
|
|
|
164
|
-
|
|
248
|
+
## Latest Updates
|
|
249
|
+
|
|
250
|
+
### v2.0.0
|
|
251
|
+
- Added thin/full image support (matching Playwright integration)
|
|
252
|
+
- Added ADO clone mode for thin images
|
|
253
|
+
- Added `HAVEN_GREP_PATTERN` support with include/exclude patterns
|
|
254
|
+
- Added `NOT:` prefix support for excluding tests
|
|
255
|
+
- Added real-time log streaming to S3
|
|
256
|
+
- Added custom E2E command support via `E2E_COMMAND`
|
|
257
|
+
- Added `--platform linux/amd64` for ARM/M1 compatibility
|
|
258
|
+
- Added `--force-compression` for ECR push reliability
|
|
259
|
+
- Added stale ECR credential clearing
|
|
260
|
+
- Removed all emojis from console output
|
|
261
|
+
- Removed axios/glob dependencies (using native Node.js modules)
|
|
262
|
+
- Haven scripts now in `/haven/` directory (isolated from app code)
|
|
263
|
+
|
|
264
|
+
## Notes
|
|
265
|
+
- Works with existing HAVEN runner; no changes required
|
|
266
|
+
- Container base image: `cypress/included:14.3.1`
|
|
267
|
+
- Supports both default Cypress execution and custom E2E commands
|
|
268
|
+
- Real-time monitoring via S3 log streaming during test execution
|
package/bin/haven-cypress.js
CHANGED
|
@@ -1,77 +1,64 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const { spawnSync } = require('child_process');
|
|
5
|
+
const lib = require('..');
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
+
function parseArgs() {
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
const cmd = args[0] || 'build';
|
|
10
|
+
const opts = { tag: 'haven-cypress-tests:latest', push: false, product: null, automationIds: '', customTags: '', type: 'thin' };
|
|
11
|
+
for (const a of args.slice(1)) {
|
|
12
|
+
if (a.startsWith('--tag=')) opts.tag = a.split('=')[1];
|
|
13
|
+
if (a === '--push') opts.push = true;
|
|
14
|
+
if (a.startsWith('--product=')) opts.product = a.split('=')[1];
|
|
15
|
+
if (a.startsWith('--automationIds=')) opts.automationIds = a.split('=')[1];
|
|
16
|
+
if (a.startsWith('--customTags=')) opts.customTags = a.split('=')[1];
|
|
17
|
+
if (a.startsWith('--type=')) opts.type = a.split('=')[1];
|
|
18
|
+
}
|
|
19
|
+
return { cmd, opts };
|
|
20
|
+
}
|
|
7
21
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Haven-Cypress Integration
|
|
22
|
+
function printHelp() {
|
|
23
|
+
console.log(`HAVEN Cypress Integration
|
|
11
24
|
|
|
12
|
-
Usage:
|
|
25
|
+
Usage:
|
|
26
|
+
npx haven-cypress build [--product=BE] [--tag=1.2.3] [--type=full|thin] [--push]
|
|
27
|
+
npx haven-cypress run --automationIds=TC-AUTO-1,TC-AUTO-2
|
|
28
|
+
npx haven-cypress run --customTags=smoke,p1
|
|
13
29
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
30
|
+
Build Types:
|
|
31
|
+
--type=thin Thin image for runtime ADO cloning (default)
|
|
32
|
+
--type=full Full image with app code baked in
|
|
17
33
|
|
|
18
34
|
Options:
|
|
19
|
-
--tag=name:version
|
|
20
|
-
--product=name Product name for ECR
|
|
21
|
-
--push Push image to ECR
|
|
35
|
+
--tag=name:version or just version Docker image tag (default: haven-cypress-tests:latest)
|
|
36
|
+
--product=name Product name for ECR tagging (recommended)
|
|
37
|
+
--push Push image to ECR after building
|
|
22
38
|
--automationIds=ID1,ID2 Run specific test cases by automation ID
|
|
23
39
|
--customTags=tag1,tag2 Run tests with custom tags (smoke, regression, p1, etc.)
|
|
24
40
|
|
|
25
41
|
Examples:
|
|
26
|
-
|
|
42
|
+
# Build thin image (default - for ADO runtime cloning)
|
|
27
43
|
npx haven-cypress build --product=BE --push
|
|
28
|
-
npx haven-cypress build --product=BE --tag=v2.1.0 --push
|
|
29
|
-
npx haven-cypress run --automationIds=TC-AUTO-123,TC-AUTO-124
|
|
30
|
-
npx haven-cypress run --customTags=smoke,p1
|
|
31
|
-
npx haven-cypress run --automationIds=TC-AUTO-123 --customTags=smoke
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
--tag=v2.1.0 → ECR tag: BE-2.1.0
|
|
36
|
-
--tag=2.1.0 → ECR tag: BE-2.1.0
|
|
37
|
-
|
|
38
|
-
Version Priority:
|
|
39
|
-
1. Custom --tag (if provided)
|
|
40
|
-
2. package.json version (for --tag=latest)
|
|
41
|
-
3. BUILD_NUMBER fallback (if package.json not found)
|
|
45
|
+
# Build full image (app code included)
|
|
46
|
+
npx haven-cypress build --product=BE --type=full --push
|
|
42
47
|
`);
|
|
43
|
-
process.exit(1);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
(async () => {
|
|
51
|
+
const { cmd, opts } = parseArgs();
|
|
52
|
+
if (!['build', 'run', 'help', '-h', '--help'].includes(cmd)) return printHelp();
|
|
53
|
+
if (cmd === 'help' || cmd === '-h' || cmd === '--help') return printHelp();
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const [key, value] = arg.substring(2).split('=');
|
|
53
|
-
options[key] = value || true;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
55
|
+
if (cmd === 'build') {
|
|
56
|
+
await lib.buildImage(opts.tag, { product: opts.product, push: opts.push, type: opts.type });
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
break;
|
|
63
|
-
|
|
64
|
-
case 'run':
|
|
65
|
-
const automationIds = options.automationIds || '';
|
|
66
|
-
const customTags = options.customTags || '';
|
|
67
|
-
integration.runTests(automationIds, customTags);
|
|
68
|
-
break;
|
|
69
|
-
|
|
70
|
-
default:
|
|
71
|
-
console.error(`❌ Unknown command: ${command}`);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error(`❌ Error: ${error.message}`);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
60
|
+
if (cmd === 'run') {
|
|
61
|
+
await lib.runTests(opts.automationIds, opts.customTags);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
})();
|