@torus-engineering/tas-kit 1.9.0 → 1.11.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/.claude/commands/ado-create.md +17 -17
- package/.claude/commands/ado-delete.md +11 -11
- package/.claude/commands/ado-get.md +12 -12
- package/.claude/commands/ado-status.md +12 -12
- package/.claude/commands/ado-update.md +15 -15
- package/.claude/commands/tas-adr.md +33 -33
- package/.claude/commands/tas-apitest-plan.md +173 -173
- package/.claude/commands/tas-apitest.md +143 -143
- package/.claude/commands/tas-brainstorm.md +14 -14
- package/.claude/commands/tas-bug.md +113 -113
- package/.claude/commands/tas-design.md +37 -37
- package/.claude/commands/tas-dev.md +128 -128
- package/.claude/commands/tas-e2e-mobile.md +155 -155
- package/.claude/commands/tas-e2e-web.md +163 -163
- package/.claude/commands/tas-e2e.md +102 -102
- package/.claude/commands/tas-epic.md +35 -35
- package/.claude/commands/tas-feature.md +47 -47
- package/.claude/commands/tas-fix.md +51 -51
- package/.claude/commands/tas-functest-mobile.md +144 -144
- package/.claude/commands/tas-functest-web.md +192 -192
- package/.claude/commands/tas-functest.md +76 -76
- package/.claude/commands/tas-init.md +14 -14
- package/.claude/commands/tas-plan.md +198 -200
- package/.claude/commands/tas-prd.md +37 -37
- package/.claude/commands/tas-review.md +111 -111
- package/.claude/commands/tas-sad.md +43 -43
- package/.claude/commands/tas-security.md +87 -81
- package/.claude/commands/tas-spec.md +20 -20
- package/.claude/commands/tas-status.md +13 -13
- package/.claude/commands/tas-story.md +91 -91
- package/.claude/commands/tas-verify.md +51 -51
- package/.claude/rules/common/post-review-agent.md +49 -49
- package/.claude/rules/common/project-status.md +14 -14
- package/.claude/rules/common/stack-detection.md +6 -6
- package/.claude/rules/common/token-logging.md +27 -27
- package/.claude/rules/csharp/api-testing.md +171 -171
- package/.claude/skills/ado-integration/SKILL.md +36 -36
- package/.claude/skills/tas-conventions/SKILL.md +32 -32
- package/.claude/skills/tas-implementation-complete/SKILL.md +100 -99
- package/.claude/skills/tas-tdd/SKILL.md +123 -123
- package/.claude/skills/token-logger/SKILL.md +19 -19
- package/.tas/README.md +266 -1520
- package/.tas/checklists/code-review.md +13 -13
- package/.tas/checklists/security.md +3 -3
- package/.tas/checklists/story-done.md +11 -11
- package/.tas/hooks/README.md +138 -0
- package/.tas/hooks/pre-commit +26 -0
- package/.tas/hooks/security-scan.js +599 -0
- package/.tas/project-status-example.yaml +3 -3
- package/.tas/tas-example.yaml +25 -8
- package/.tas/templates/ADR.md +16 -16
- package/.tas/templates/API-Test-Spec.md +3 -3
- package/.tas/templates/Bug.md +12 -12
- package/.tas/templates/Design-Spec.md +8 -8
- package/.tas/templates/E2E-Execution-Report.md +1 -1
- package/.tas/templates/Epic.md +1 -1
- package/.tas/templates/Feature.md +10 -10
- package/.tas/templates/Func-Test-Spec.md +3 -3
- package/.tas/templates/SAD.md +106 -106
- package/.tas/templates/Security-Report.md +3 -3
- package/.tas/templates/Story.md +9 -9
- package/.tas/tools/tas-ado-readme.md +169 -169
- package/.tas/tools/tas-ado.py +1 -1
- package/CLAUDE-Example.md +37 -58
- package/README.md +294 -42
- package/bin/cli.js +24 -7
- package/lib/install.js +161 -47
- package/package.json +1 -1
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
# /tas-dev $ARGUMENTS
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Implement
|
|
5
|
-
|
|
6
|
-
## Always / Ask / Never
|
|
7
|
-
|
|
8
|
-
| |
|
|
9
|
-
|---|---|
|
|
10
|
-
| **Always** |
|
|
11
|
-
| **Always** | Follow tasks
|
|
12
|
-
| **Always** | Launch review agent
|
|
13
|
-
| **Ask** |
|
|
14
|
-
| **Ask** |
|
|
15
|
-
| **Never** | Implement
|
|
16
|
-
| **Never** | Skip
|
|
17
|
-
|
|
18
|
-
##
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
## Stack Detection
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
##
|
|
28
|
-
|
|
29
|
-
###
|
|
30
|
-
|
|
31
|
-
`$ARGUMENTS`
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
###
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
**
|
|
40
|
-
|
|
41
|
-
- `require_plan: true` (
|
|
42
|
-
> "Story
|
|
43
|
-
- `require_plan: false` →
|
|
44
|
-
> "⚠️ Quick mode: Story
|
|
45
|
-
|
|
46
|
-
**
|
|
47
|
-
|
|
48
|
-
###
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
- Files to Change / Files to Create
|
|
53
|
-
- Database Changes, Config Changes
|
|
54
|
-
- Tasks list (checklist
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
###
|
|
59
|
-
|
|
60
|
-
**
|
|
61
|
-
repository pattern, service layer, N+1 prevention, caching, error handling
|
|
62
|
-
|
|
63
|
-
####
|
|
64
|
-
a. **Red phase** —
|
|
65
|
-
|
|
66
|
-
Platform-specific (
|
|
67
|
-
- **Mobile (React Native)**: Jest + React Testing Library — Components (`render`, `fireEvent`, `screen`), Hooks (`renderHook`), Services/API (Jest mocks + MSW), Utils, Zustand stores. File: `src/**/*.test.ts(x)`
|
|
68
|
-
- **Web (React + Node)**: Vitest/Jest + React Testing Library — Components, Hooks, Services (MSW/Nock), Backend services (Jest). File: `src/**/*.test.ts(x)`
|
|
69
|
-
- **Backend (.NET)**: xUnit — Unit (services, repositories), Integration (TestServer), API (WebApplicationFactory). File: `tests/Unit/`, `tests/Integration/`, `tests/Api/`
|
|
70
|
-
|
|
71
|
-
b. **Green phase** —
|
|
72
|
-
c. **Refactor** — Clean up,
|
|
73
|
-
|
|
74
|
-
####
|
|
75
|
-
a. Implement code
|
|
76
|
-
b.
|
|
77
|
-
c.
|
|
78
|
-
→
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
###
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
###
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
- `- [x] Technical plan completed` —
|
|
93
|
-
- `- [x] Code implemented` —
|
|
94
|
-
- `- [x] Unit tests pass` —
|
|
95
|
-
- `- [x] No regression` —
|
|
96
|
-
- `- [x] Documentation updated (if needed)` —
|
|
97
|
-
- `- [x] Code review passed` —
|
|
98
|
-
- `- [ ] Acceptance criteria verified` —
|
|
99
|
-
|
|
100
|
-
**Optional —
|
|
101
|
-
Launch `doc-updater` agent:
|
|
102
|
-
> Scope: [
|
|
103
|
-
>
|
|
104
|
-
|
|
105
|
-
###
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
##
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
- Review
|
|
121
|
-
- **
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
|
|
126
|
-
##
|
|
127
|
-
|
|
128
|
-
Invoke skill `token-logger`:
|
|
1
|
+
# /tas-dev $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Role: SE - Software Engineer
|
|
4
|
+
Implement a User Story per approved Technical Plan.
|
|
5
|
+
|
|
6
|
+
## Always / Ask / Never
|
|
7
|
+
|
|
8
|
+
| | Action |
|
|
9
|
+
|---|---|
|
|
10
|
+
| **Always** | Check `plan_status` before implementing |
|
|
11
|
+
| **Always** | Follow tasks in Story's `## Technical Plan` |
|
|
12
|
+
| **Always** | Launch independent review agent after implement — no review in same session |
|
|
13
|
+
| **Ask** | When discover plan needs significant changes during coding |
|
|
14
|
+
| **Ask** | When need to read files outside plan scope |
|
|
15
|
+
| **Never** | Implement outside Story scope |
|
|
16
|
+
| **Never** | Skip review step after implement |
|
|
17
|
+
|
|
18
|
+
## IMPORTANT - File Reading Rules
|
|
19
|
+
- ONLY read Story file — Technical Plan has enough technical context.
|
|
20
|
+
- Don't auto-read PRD, SAD, ADR, Design-Spec unless user confirms.
|
|
21
|
+
- Don't list directories, don't scan project structure.
|
|
22
|
+
- Don't read `.tas/checklists/story-done.md` at first step (only at final step).
|
|
23
|
+
|
|
24
|
+
## Stack Detection
|
|
25
|
+
Read `.claude/rules/common/stack-detection.md`.
|
|
26
|
+
|
|
27
|
+
## Actions
|
|
28
|
+
|
|
29
|
+
### Step 1 — Identify Story
|
|
30
|
+
|
|
31
|
+
`$ARGUMENTS` is Story ID or file path.
|
|
32
|
+
If none: read `project-status.yaml`, find stories with `status: Committed` or `status: In Progress`. If more than one, list for user to choose.
|
|
33
|
+
Read Story file.
|
|
34
|
+
|
|
35
|
+
### Step 1.5 — Gate: Check plan_status
|
|
36
|
+
|
|
37
|
+
Read `plan_status` from Story frontmatter.
|
|
38
|
+
|
|
39
|
+
**If `plan_status: pending`:**
|
|
40
|
+
Read `require_plan` from root/`tas.yaml`:
|
|
41
|
+
- `require_plan: true` (or field doesn't exist) → **STOP**:
|
|
42
|
+
> "This Story has no Technical Plan. Run `/tas-plan {Story-ID}` before implementing."
|
|
43
|
+
- `require_plan: false` → continue, show warning and wait for confirmation:
|
|
44
|
+
> "⚠️ Quick mode: Story has no Technical Plan. Continue implementing?"
|
|
45
|
+
|
|
46
|
+
**If `plan_status: completed`:** continue normally.
|
|
47
|
+
|
|
48
|
+
### Step 2 — Read Technical Plan
|
|
49
|
+
|
|
50
|
+
From Story file, read `## Technical Plan` section:
|
|
51
|
+
- Chosen approach
|
|
52
|
+
- Files to Change / Files to Create
|
|
53
|
+
- Database Changes, Config Changes
|
|
54
|
+
- Tasks list (checklist to follow in order)
|
|
55
|
+
|
|
56
|
+
If no Technical Plan (quick mode) → analyze AC and implement directly per AC.
|
|
57
|
+
|
|
58
|
+
### Step 3 — Implement
|
|
59
|
+
|
|
60
|
+
**If stack is Node.js/Express/Next.js** → invoke skill `js-backend-patterns` to reference
|
|
61
|
+
repository pattern, service layer, N+1 prevention, caching, error handling before coding.
|
|
62
|
+
|
|
63
|
+
#### If `use_tdd = true` in `tas.yaml`:
|
|
64
|
+
a. **Red phase** — Write test cases FIRST per AC in Story. Run tests, confirm FAIL.
|
|
65
|
+
|
|
66
|
+
Platform-specific (from stack detection):
|
|
67
|
+
- **Mobile (React Native)**: Jest + React Testing Library — Components (`render`, `fireEvent`, `screen`), Hooks (`renderHook`), Services/API (Jest mocks + MSW), Utils, Zustand stores. File: `src/**/*.test.ts(x)`
|
|
68
|
+
- **Web (React + Node)**: Vitest/Jest + React Testing Library — Components, Hooks, Services (MSW/Nock), Backend services (Jest). File: `src/**/*.test.ts(x)`
|
|
69
|
+
- **Backend (.NET)**: xUnit — Unit (services, repositories), Integration (TestServer), API (WebApplicationFactory). File: `tests/Unit/`, `tests/Integration/`, `tests/Api/`
|
|
70
|
+
|
|
71
|
+
b. **Green phase** — Write minimal code to pass tests.
|
|
72
|
+
c. **Refactor** — Clean up, ensure tests still pass.
|
|
73
|
+
|
|
74
|
+
#### If `use_tdd = false`:
|
|
75
|
+
a. Implement code per AC + Tasks in Technical Plan
|
|
76
|
+
b. Write unit tests covering cases in `## Unit Test Cases`
|
|
77
|
+
c. Run tests, fix if fail
|
|
78
|
+
→ If tests still fail after 1 self-fix: launch `build-resolver` agent with error output to diagnose.
|
|
79
|
+
|
|
80
|
+
During implementation, tick each completed task in Story file: `- [x] Task 1: ...`
|
|
81
|
+
|
|
82
|
+
If discover plan needs significant changes → notify user before changing direction.
|
|
83
|
+
|
|
84
|
+
### Step 4 — Post-Implementation Review (Isolated Agent)
|
|
85
|
+
|
|
86
|
+
Follow `.claude/rules/common/post-review-agent.md`.
|
|
87
|
+
Pass in: Story file path, changed files list, stack (from CLAUDE.md), lang_agent.
|
|
88
|
+
|
|
89
|
+
### Step 5 — Definition of Done
|
|
90
|
+
|
|
91
|
+
Read `.tas/checklists/story-done.md`, verify each item, tick in Story:
|
|
92
|
+
- `- [x] Technical plan completed` — if plan_status: completed (or quick mode confirmed)
|
|
93
|
+
- `- [x] Code implemented` — if implementation done
|
|
94
|
+
- `- [x] Unit tests pass` — if tests passed
|
|
95
|
+
- `- [x] No regression` — if full test suite passed
|
|
96
|
+
- `- [x] Documentation updated (if needed)` — if updated
|
|
97
|
+
- `- [x] Code review passed` — if review gate passed (no Critical/High)
|
|
98
|
+
- `- [ ] Acceptance criteria verified` — DO NOT tick, let PE verify
|
|
99
|
+
|
|
100
|
+
**Optional — if Story changes public API, database schema, or setup:**
|
|
101
|
+
Launch `doc-updater` agent: update related docs (README, SAD section, API docs).
|
|
102
|
+
> Scope: [changed files list]. Story: [Story ID + title].
|
|
103
|
+
> Only update outdated docs — don't rewrite from scratch.
|
|
104
|
+
|
|
105
|
+
### Step 6 — Wrap up
|
|
106
|
+
|
|
107
|
+
Update Story status → `In Progress` (if not already).
|
|
108
|
+
Create commit message per conventions in `CLAUDE.md`.
|
|
109
|
+
Ask: "Tests OK and review passed — have you tested manually? Want to move to Deploy Test?"
|
|
110
|
+
|
|
111
|
+
If Yes:
|
|
112
|
+
- Update Story status → `Deploy Test`
|
|
113
|
+
- Add Changelog entry
|
|
114
|
+
- Update `project-status.yaml`
|
|
115
|
+
- Suggest: `/ado-update story {ado-id} --status "Deploy Test"` if using ADO
|
|
116
|
+
|
|
117
|
+
## Principles
|
|
118
|
+
- DO NOT implement outside Story scope
|
|
119
|
+
- Each public method MUST have XML doc comment (C#) or JSDoc (TypeScript) or docstring (Python)
|
|
120
|
+
- Review must run through independent Agent — not inline in current session
|
|
121
|
+
- **When to create ADR** (if Technical Plan didn't mention):
|
|
122
|
+
- Architecture changes affecting multiple components
|
|
123
|
+
- New design pattern or framework
|
|
124
|
+
- Important technical trade-off decisions
|
|
125
|
+
|
|
126
|
+
## Final Step — Token Log
|
|
127
|
+
|
|
128
|
+
Invoke skill `token-logger`: write AI Usage Log to working Story file.
|
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
# /tas-e2e-mobile $ARGUMENTS
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Generate Detox E2E test scripts
|
|
5
|
-
|
|
6
|
-
##
|
|
7
|
-
-
|
|
8
|
-
- Scripts
|
|
9
|
-
- REUSE helpers
|
|
10
|
-
- Chain functional test steps
|
|
11
|
-
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
###
|
|
15
|
-
1. $ARGUMENTS
|
|
16
|
-
2.
|
|
17
|
-
3. List scenarios
|
|
18
|
-
|
|
19
|
-
###
|
|
20
|
-
1.
|
|
21
|
-
2.
|
|
22
|
-
- Scenario steps
|
|
23
|
-
- FT ID references (
|
|
24
|
-
- FT Reuse Map (section
|
|
25
|
-
- Test data per environment
|
|
26
|
-
- Scenario type (single-epic / cross-epic)
|
|
27
|
-
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
1.
|
|
31
|
-
2. Verify helper functions
|
|
32
|
-
3.
|
|
33
|
-
4. Import map: FT ID → file path → function name
|
|
34
|
-
|
|
35
|
-
###
|
|
36
|
-
|
|
37
|
-
**File output**: `apps/mobile/e2e/flows/{scenario-slug}.e2e.ts`
|
|
38
|
-
|
|
39
|
-
**Structure**:
|
|
40
|
-
```typescript
|
|
41
|
-
/**
|
|
42
|
-
* E2E Flow: {Scenario Name}
|
|
43
|
-
* Scenario: {Scenario_ID}
|
|
44
|
-
* Epic(s): {Epic_ID(s)}
|
|
45
|
-
* Type: {single-epic | cross-epic}
|
|
46
|
-
*
|
|
47
|
-
* Generated by /tas-e2e-mobile
|
|
48
|
-
* Spec: {path to E2E-Scenario-*.md}
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
import { device, element, expect, by, waitFor } from 'detox';
|
|
52
|
-
import { TEST_IDS } from '../test-ids';
|
|
53
|
-
import { loadTestData, getCredentials } from '../helpers/data-loader';
|
|
54
|
-
import { login, logout, navigateToTab } from '../helpers/test-utils';
|
|
55
|
-
|
|
56
|
-
// Layer 2 helpers (reuse from functional tests)
|
|
57
|
-
import { fillLoginForm, verifyLoginSuccess } from '../features/{epic}/{feature}/helpers';
|
|
58
|
-
import { viewAllergenList } from '../features/{epic2}/{feature2}/helpers';
|
|
59
|
-
|
|
60
|
-
const testData = loadTestData();
|
|
61
|
-
|
|
62
|
-
describe('E2E Flow: {Scenario Name}', () => {
|
|
63
|
-
beforeAll(async () => {
|
|
64
|
-
await device.launchApp({ newInstance: true });
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Main Flow
|
|
68
|
-
describe('{PROJECT}_E{EPIC}_E2E_001_H: {Flow Title}', () => {
|
|
69
|
-
it('Step 1: {Action}', async () => {
|
|
70
|
-
// Reuses: AL_E002_F002_S001_FT_001_H
|
|
71
|
-
const creds = getCredentials();
|
|
72
|
-
await fillLoginForm(creds.email, creds.password);
|
|
73
|
-
await verifyLoginSuccess();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('Step 2: {Action}', async () => {
|
|
77
|
-
// Reuses: AL_E003_F001_S001_FT_001_H
|
|
78
|
-
await viewAllergenList();
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('Step 3: {New logic - no FT reference}', async () => {
|
|
82
|
-
// New step: no functional test helper exists
|
|
83
|
-
await element(by.id(TEST_IDS.SCAN.SCREEN.CAMERA)).tap();
|
|
84
|
-
// ...
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// Alternate Flow (if defined in scenario)
|
|
89
|
-
describe('{PROJECT}_E{EPIC}_E2E_002_N: {Alternate Flow}', () => {
|
|
90
|
-
it('should handle {error condition}', async () => {
|
|
91
|
-
// ...
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
###
|
|
98
|
-
|
|
99
|
-
```json
|
|
100
|
-
"e2e:flow:{scenario-slug}": "detox test --configuration ios.sim.debug --testPathPattern='e2e/flows/{scenario-slug}'"
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
###
|
|
104
|
-
|
|
105
|
-
- Summary metrics (passed/failed/skipped)
|
|
106
|
-
- Results by test ID
|
|
107
|
-
- Failed test details
|
|
108
|
-
- Performance metrics
|
|
109
|
-
- AC coverage analysis
|
|
110
|
-
|
|
111
|
-
## File Structure Output
|
|
112
|
-
```
|
|
113
|
-
apps/mobile/e2e/flows/
|
|
114
|
-
├── {scenario-1-slug}.e2e.ts
|
|
115
|
-
├── {scenario-2-slug}.e2e.ts
|
|
116
|
-
└── ...
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Reuse Strategy
|
|
120
|
-
```
|
|
121
|
-
Layer 2 (features/) Layer 3 (flows/)
|
|
122
|
-
┌───────────────────┐ ┌──────────────────────┐
|
|
123
|
-
│ helpers.ts │──────>│ {scenario}.e2e.ts │
|
|
124
|
-
│ - fillLoginForm()│ │ import { fillLogin } │
|
|
125
|
-
│ - verifyLogin() │ │ import { viewList } │
|
|
126
|
-
└───────────────────┘ │ │
|
|
127
|
-
┌───────────────────┐ │ Step 1: fillLogin() │
|
|
128
|
-
│ helpers.ts │──────>│ Step 2: viewList() │
|
|
129
|
-
│ - viewList() │ │ Step 3: new logic │
|
|
130
|
-
└───────────────────┘ └──────────────────────┘
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
##
|
|
134
|
-
```bash
|
|
135
|
-
#
|
|
136
|
-
yarn e2e:flow:{scenario-slug}
|
|
137
|
-
|
|
138
|
-
#
|
|
139
|
-
npx detox test --configuration ios.sim.debug --testPathPattern='e2e/flows/'
|
|
140
|
-
|
|
141
|
-
#
|
|
142
|
-
npx detox test --configuration android.emu.debug --testPathPattern='e2e/flows/{scenario}'
|
|
143
|
-
|
|
144
|
-
#
|
|
145
|
-
npx detox test --configuration ios.sim.debug --testPathPattern='e2e/flows/{scenario}' --reporters=jest-junit
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
##
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
- Steps
|
|
152
|
-
- Scripts
|
|
153
|
-
-
|
|
154
|
-
- describe block
|
|
155
|
-
- import paths: relative
|
|
1
|
+
# /tas-e2e-mobile $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Role: SE / QA
|
|
4
|
+
Generate Detox E2E test scripts from an E2E Scenario markdown file.
|
|
5
|
+
|
|
6
|
+
## IMPORTANT - Layer 3: Mobile E2E Scripts
|
|
7
|
+
- Create Detox test scripts from E2E-Scenario (markdown)
|
|
8
|
+
- Scripts located in `apps/mobile/e2e/flows/`
|
|
9
|
+
- REUSE helpers from Layer 2 functional tests (features/)
|
|
10
|
+
- Chain functional test steps into end-to-end flows
|
|
11
|
+
|
|
12
|
+
## Actions
|
|
13
|
+
|
|
14
|
+
### Step 1: Identify Scenario
|
|
15
|
+
1. $ARGUMENTS is path to E2E-Scenario-*.md file
|
|
16
|
+
2. If not provided: scan `docs/epics/**/E2E-Scenario-*.md` and `docs/e2e-scenarios/E2E-Scenario-*.md`
|
|
17
|
+
3. List scenarios and ask user to choose
|
|
18
|
+
|
|
19
|
+
### Step 2: Check Prerequisites
|
|
20
|
+
1. Check `apps/mobile/` exists. If not → graceful error
|
|
21
|
+
2. Read scenario file to get:
|
|
22
|
+
- Scenario steps and flow
|
|
23
|
+
- FT ID references ("Builds on FT IDs" column)
|
|
24
|
+
- FT Reuse Map (section at end)
|
|
25
|
+
- Test data per environment
|
|
26
|
+
- Scenario type (single-epic / cross-epic)
|
|
27
|
+
|
|
28
|
+
### Step 3: Find Functional Test Helpers
|
|
29
|
+
From FT Reuse Map in scenario:
|
|
30
|
+
1. Find each source file in `apps/mobile/e2e/features/`
|
|
31
|
+
2. Verify helper functions exist
|
|
32
|
+
3. If helper doesn't exist → create stub and note "TODO: implement helper"
|
|
33
|
+
4. Import map: FT ID → file path → function name
|
|
34
|
+
|
|
35
|
+
### Step 4: Generate E2E Script
|
|
36
|
+
|
|
37
|
+
**File output**: `apps/mobile/e2e/flows/{scenario-slug}.e2e.ts`
|
|
38
|
+
|
|
39
|
+
**Structure**:
|
|
40
|
+
```typescript
|
|
41
|
+
/**
|
|
42
|
+
* E2E Flow: {Scenario Name}
|
|
43
|
+
* Scenario: {Scenario_ID}
|
|
44
|
+
* Epic(s): {Epic_ID(s)}
|
|
45
|
+
* Type: {single-epic | cross-epic}
|
|
46
|
+
*
|
|
47
|
+
* Generated by /tas-e2e-mobile
|
|
48
|
+
* Spec: {path to E2E-Scenario-*.md}
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
import { device, element, expect, by, waitFor } from 'detox';
|
|
52
|
+
import { TEST_IDS } from '../test-ids';
|
|
53
|
+
import { loadTestData, getCredentials } from '../helpers/data-loader';
|
|
54
|
+
import { login, logout, navigateToTab } from '../helpers/test-utils';
|
|
55
|
+
|
|
56
|
+
// Layer 2 helpers (reuse from functional tests)
|
|
57
|
+
import { fillLoginForm, verifyLoginSuccess } from '../features/{epic}/{feature}/helpers';
|
|
58
|
+
import { viewAllergenList } from '../features/{epic2}/{feature2}/helpers';
|
|
59
|
+
|
|
60
|
+
const testData = loadTestData();
|
|
61
|
+
|
|
62
|
+
describe('E2E Flow: {Scenario Name}', () => {
|
|
63
|
+
beforeAll(async () => {
|
|
64
|
+
await device.launchApp({ newInstance: true });
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Main Flow
|
|
68
|
+
describe('{PROJECT}_E{EPIC}_E2E_001_H: {Flow Title}', () => {
|
|
69
|
+
it('Step 1: {Action}', async () => {
|
|
70
|
+
// Reuses: AL_E002_F002_S001_FT_001_H
|
|
71
|
+
const creds = getCredentials();
|
|
72
|
+
await fillLoginForm(creds.email, creds.password);
|
|
73
|
+
await verifyLoginSuccess();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('Step 2: {Action}', async () => {
|
|
77
|
+
// Reuses: AL_E003_F001_S001_FT_001_H
|
|
78
|
+
await viewAllergenList();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('Step 3: {New logic - no FT reference}', async () => {
|
|
82
|
+
// New step: no functional test helper exists
|
|
83
|
+
await element(by.id(TEST_IDS.SCAN.SCREEN.CAMERA)).tap();
|
|
84
|
+
// ...
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Alternate Flow (if defined in scenario)
|
|
89
|
+
describe('{PROJECT}_E{EPIC}_E2E_002_N: {Alternate Flow}', () => {
|
|
90
|
+
it('should handle {error condition}', async () => {
|
|
91
|
+
// ...
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Step 5: Update package.json Script
|
|
98
|
+
Add or update script in `apps/mobile/package.json`:
|
|
99
|
+
```json
|
|
100
|
+
"e2e:flow:{scenario-slug}": "detox test --configuration ios.sim.debug --testPathPattern='e2e/flows/{scenario-slug}'"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Step 6: Generate Execution Report (Optional)
|
|
104
|
+
After running tests, generate report from `.tas/templates/E2E-Execution-Report.md`:
|
|
105
|
+
- Summary metrics (passed/failed/skipped)
|
|
106
|
+
- Results by test ID
|
|
107
|
+
- Failed test details
|
|
108
|
+
- Performance metrics
|
|
109
|
+
- AC coverage analysis
|
|
110
|
+
|
|
111
|
+
## File Structure Output
|
|
112
|
+
```
|
|
113
|
+
apps/mobile/e2e/flows/
|
|
114
|
+
├── {scenario-1-slug}.e2e.ts
|
|
115
|
+
├── {scenario-2-slug}.e2e.ts
|
|
116
|
+
└── ...
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Reuse Strategy
|
|
120
|
+
```
|
|
121
|
+
Layer 2 (features/) Layer 3 (flows/)
|
|
122
|
+
┌───────────────────┐ ┌──────────────────────┐
|
|
123
|
+
│ helpers.ts │──────>│ {scenario}.e2e.ts │
|
|
124
|
+
│ - fillLoginForm()│ │ import { fillLogin } │
|
|
125
|
+
│ - verifyLogin() │ │ import { viewList } │
|
|
126
|
+
└───────────────────┘ │ │
|
|
127
|
+
┌───────────────────┐ │ Step 1: fillLogin() │
|
|
128
|
+
│ helpers.ts │──────>│ Step 2: viewList() │
|
|
129
|
+
│ - viewList() │ │ Step 3: new logic │
|
|
130
|
+
└───────────────────┘ └──────────────────────┘
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Run Tests
|
|
134
|
+
```bash
|
|
135
|
+
# Run specific E2E flow
|
|
136
|
+
yarn e2e:flow:{scenario-slug}
|
|
137
|
+
|
|
138
|
+
# Run all E2E flows
|
|
139
|
+
npx detox test --configuration ios.sim.debug --testPathPattern='e2e/flows/'
|
|
140
|
+
|
|
141
|
+
# Run with Android
|
|
142
|
+
npx detox test --configuration android.emu.debug --testPathPattern='e2e/flows/{scenario}'
|
|
143
|
+
|
|
144
|
+
# Run and generate report
|
|
145
|
+
npx detox test --configuration ios.sim.debug --testPathPattern='e2e/flows/{scenario}' --reporters=jest-junit
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Principles
|
|
149
|
+
- MUST reuse helpers from Layer 2 when possible, DO NOT rewrite existing logic
|
|
150
|
+
- Each step in E2E flow should correspond to 1 functional test helper
|
|
151
|
+
- Steps without FT reference → write new logic in flow file
|
|
152
|
+
- Scripts MUST be runnable from CLI, WITHOUT Claude window
|
|
153
|
+
- If apps/mobile/ doesn't exist → graceful error
|
|
154
|
+
- describe block uses full E2E ID for grep-ability
|
|
155
|
+
- import paths: relative from flows/ up to features/
|