@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.
Files changed (68) hide show
  1. package/.claude/commands/ado-create.md +17 -17
  2. package/.claude/commands/ado-delete.md +11 -11
  3. package/.claude/commands/ado-get.md +12 -12
  4. package/.claude/commands/ado-status.md +12 -12
  5. package/.claude/commands/ado-update.md +15 -15
  6. package/.claude/commands/tas-adr.md +33 -33
  7. package/.claude/commands/tas-apitest-plan.md +173 -173
  8. package/.claude/commands/tas-apitest.md +143 -143
  9. package/.claude/commands/tas-brainstorm.md +14 -14
  10. package/.claude/commands/tas-bug.md +113 -113
  11. package/.claude/commands/tas-design.md +37 -37
  12. package/.claude/commands/tas-dev.md +128 -128
  13. package/.claude/commands/tas-e2e-mobile.md +155 -155
  14. package/.claude/commands/tas-e2e-web.md +163 -163
  15. package/.claude/commands/tas-e2e.md +102 -102
  16. package/.claude/commands/tas-epic.md +35 -35
  17. package/.claude/commands/tas-feature.md +47 -47
  18. package/.claude/commands/tas-fix.md +51 -51
  19. package/.claude/commands/tas-functest-mobile.md +144 -144
  20. package/.claude/commands/tas-functest-web.md +192 -192
  21. package/.claude/commands/tas-functest.md +76 -76
  22. package/.claude/commands/tas-init.md +14 -14
  23. package/.claude/commands/tas-plan.md +198 -200
  24. package/.claude/commands/tas-prd.md +37 -37
  25. package/.claude/commands/tas-review.md +111 -111
  26. package/.claude/commands/tas-sad.md +43 -43
  27. package/.claude/commands/tas-security.md +87 -81
  28. package/.claude/commands/tas-spec.md +20 -20
  29. package/.claude/commands/tas-status.md +13 -13
  30. package/.claude/commands/tas-story.md +91 -91
  31. package/.claude/commands/tas-verify.md +51 -51
  32. package/.claude/rules/common/post-review-agent.md +49 -49
  33. package/.claude/rules/common/project-status.md +14 -14
  34. package/.claude/rules/common/stack-detection.md +6 -6
  35. package/.claude/rules/common/token-logging.md +27 -27
  36. package/.claude/rules/csharp/api-testing.md +171 -171
  37. package/.claude/skills/ado-integration/SKILL.md +36 -36
  38. package/.claude/skills/tas-conventions/SKILL.md +32 -32
  39. package/.claude/skills/tas-implementation-complete/SKILL.md +100 -99
  40. package/.claude/skills/tas-tdd/SKILL.md +123 -123
  41. package/.claude/skills/token-logger/SKILL.md +19 -19
  42. package/.tas/README.md +266 -1520
  43. package/.tas/checklists/code-review.md +13 -13
  44. package/.tas/checklists/security.md +3 -3
  45. package/.tas/checklists/story-done.md +11 -11
  46. package/.tas/hooks/README.md +138 -0
  47. package/.tas/hooks/pre-commit +26 -0
  48. package/.tas/hooks/security-scan.js +599 -0
  49. package/.tas/project-status-example.yaml +3 -3
  50. package/.tas/tas-example.yaml +25 -8
  51. package/.tas/templates/ADR.md +16 -16
  52. package/.tas/templates/API-Test-Spec.md +3 -3
  53. package/.tas/templates/Bug.md +12 -12
  54. package/.tas/templates/Design-Spec.md +8 -8
  55. package/.tas/templates/E2E-Execution-Report.md +1 -1
  56. package/.tas/templates/Epic.md +1 -1
  57. package/.tas/templates/Feature.md +10 -10
  58. package/.tas/templates/Func-Test-Spec.md +3 -3
  59. package/.tas/templates/SAD.md +106 -106
  60. package/.tas/templates/Security-Report.md +3 -3
  61. package/.tas/templates/Story.md +9 -9
  62. package/.tas/tools/tas-ado-readme.md +169 -169
  63. package/.tas/tools/tas-ado.py +1 -1
  64. package/CLAUDE-Example.md +37 -58
  65. package/README.md +294 -42
  66. package/bin/cli.js +24 -7
  67. package/lib/install.js +161 -47
  68. package/package.json +1 -1
@@ -1,192 +1,192 @@
1
- # /tas-functest-web $ARGUMENTS
2
-
3
- Vai tro: SE / QA
4
- Generate tat ca Playwright automation test scripts cho mot web Feature.
5
-
6
- ## QUAN TRONG - Layer 2: Web Functional Test Scripts
7
- - Tao Playwright test scripts tu Func-Test-Spec (markdown)
8
- - Scripts nam trong `apps/web/e2e/features/`
9
- - Reusable helpers duoc export de Layer 3 (E2E) tai su dung
10
- - Data hardcoded trong test, credentials tu .env
11
- - Cross-viewport testing (mobile, tablet, desktop)
12
-
13
- ## Hanh dong
14
-
15
- ### Buoc 1: Xac dinh Feature
16
- 1. $ARGUMENTS la Feature ID hoac file path
17
- 2. Neu khong co: scan `docs/epics/**/Feature-*.md` tim features co status In Progress
18
- 3. Doc Feature file de lay Epic/Feature numbers va danh sach Stories
19
-
20
- ### Buoc 2: Kiem tra Prerequisites
21
- 1. Kiem tra `apps/web/` ton tai. Neu khongbao:
22
- > "Web app chua ton tai trong project nay. Neu project chi co mobile, dung /tas-functest-mobile."
23
- > DUNG LAI, KHONG tao file.
24
- 2. Tim tat ca `Func-Test-*.md` files trong Feature directory:
25
- ```
26
- docs/epics/{epic-dir}/{feature-dir}/Func-Test-*.md
27
- ```
28
- 3. Neu khong co Func-Test-Spec naobao loi:
29
- > "Chua co Func-Test-Spec nao cho Feature nay. Chay /tas-functest {story-ID} truoc."
30
- 4. Doc `apps/web/playwright.config.ts` (neu co) de hieu config hien tai
31
- 5. Doc `apps/web/e2e/helpers/` (neu co) de hieu patterns
32
-
33
- ### Buoc 3: Aggregate FT Test Cases
34
- - Tu tat ca Func-Test-Spec files, tong hop danh sach FT test cases
35
- - Nhom theo Story
36
- - Lay test data requirements tu moi spec
37
-
38
- ### Buoc 4: Generate Test Scripts
39
- Voi MOI Story co Func-Test-Spec:
40
-
41
- **File output**: `apps/web/e2e/features/{epic-slug}/{feature-slug}/{story-slug}.func.spec.ts`
42
-
43
- **Structure**:
44
- ```typescript
45
- /**
46
- * Functional Tests: {Story Name}
47
- * Story: {Story_ID}
48
- * Feature: {Feature_ID}
49
- * Epic: {Epic_ID}
50
- *
51
- * Generated by /tas-functest-web
52
- * Spec: docs/epics/{epic-dir}/{feature-dir}/Func-Test-{story-slug}.md
53
- */
54
-
55
- import { test, expect } from '@playwright/test';
56
- import { loadTestData, getCredentials } from '../../../helpers/data-loader';
57
-
58
- const testData = loadTestData();
59
-
60
- test.describe('{Feature Name} - {Story Name}', () => {
61
- test.beforeEach(async ({ page }) => {
62
- await page.goto('/target-page');
63
- });
64
-
65
- // AC Reference: AC-1
66
- test.describe('{PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_FT_001_H', () => {
67
- test('should {description from spec}', async ({ page }) => {
68
- // Given: {precondition}
69
- // When: {action}
70
- await page.getByTestId('element-id').click();
71
- // Then: {expected}
72
- await expect(page.getByTestId('result')).toBeVisible();
73
- });
74
- });
75
-
76
- // Viewport testing for responsive features
77
- test.describe('{PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_FT_001_H - Viewports', () => {
78
- const viewports = [
79
- { width: 375, height: 812, name: 'mobile' },
80
- { width: 768, height: 1024, name: 'tablet' },
81
- { width: 1280, height: 720, name: 'desktop' },
82
- ];
83
-
84
- for (const vp of viewports) {
85
- test(`should work on ${vp.name} (${vp.width}x${vp.height})`, async ({ page }) => {
86
- await page.setViewportSize({ width: vp.width, height: vp.height });
87
- // Test responsive behavior
88
- });
89
- }
90
- });
91
- });
92
- ```
93
-
94
- ### Buoc 5: Generate Feature Helpers
95
- Tao file `apps/web/e2e/features/{epic-slug}/{feature-slug}/helpers.ts`:
96
- ```typescript
97
- import { Page, expect } from '@playwright/test';
98
-
99
- /**
100
- * Reusable helpers cho {Feature Name}
101
- * Duoc tai su dung boi Layer 3 E2E scripts
102
- */
103
-
104
- export async function {featureSpecificHelper}(page: Page) {
105
- // Helper logic extracted from functional tests
106
- }
107
- ```
108
-
109
- ### Buoc 6: Generate/Update Data Loader (neu chua co)
110
- Neu `apps/web/e2e/helpers/data-loader.ts` chua ton tai, tao:
111
- ```typescript
112
- type TestEnv = 'dev' | 'staging' | 'prod';
113
-
114
- export function loadTestData(env?: TestEnv) {
115
- const targetEnv = env || (process.env.TEST_ENV as TestEnv) || 'dev';
116
- return require(`../data/test-data.${targetEnv}.json`);
117
- }
118
-
119
- export function getCredentials(userType = 'default') {
120
- const data = loadTestData();
121
- const user = data.users[userType] || data.users.default;
122
- return {
123
- email: user.email,
124
- password: process.env.TEST_USER_PASSWORD || '',
125
- };
126
- }
127
- ```
128
-
129
- ### Buoc 7: Update package.json Script
130
- Them hoac update script trong `apps/web/package.json`:
131
- ```json
132
- "functest:web:{feature-slug}": "npx playwright test e2e/features/{epic-slug}/{feature-slug}"
133
- ```
134
-
135
- ### Buoc 8: Generate Index
136
- Tao `apps/web/e2e/features/{epic-slug}/{feature-slug}/index.ts`:
137
- ```typescript
138
- export * from './helpers';
139
- ```
140
-
141
- ## File Structure Output
142
- ```
143
- apps/web/e2e/features/
144
- └── {epic-slug}/
145
- └── {feature-slug}/
146
- ├── {story-1-slug}.func.spec.ts
147
- ├── {story-2-slug}.func.spec.ts
148
- ├── helpers.ts
149
- └── index.ts
150
- ```
151
-
152
- ## Selector Strategy (Playwright)
153
- - **Uu tien**: `data-testid` → `page.getByTestId('login-submit')`
154
- - **Text content**: `page.getByText('Welcome')`
155
- - **Role**: `page.getByRole('button', { name: 'Submit' })`
156
- - **Label**: `page.getByLabel('Email')`
157
- - KHONG dung CSS selectors truyen thong (`.class`, `#id`) tru khi bat buoc
158
-
159
- ## Cross-Browser Testing
160
- - Chromium (bat buoc)
161
- - Firefox (bat buoc)
162
- - WebKit (bat buoc)
163
- - Config trong `playwright.config.ts` projects section
164
-
165
- ## Test Data Convention
166
- - **Hardcoded values**: Truc tiep trong test
167
- - **Credentials**: `getCredentials()` → password tu process.env
168
- - **Environment data**: `loadTestData()` → tu test-data.{env}.json
169
- - **KHONG BAO GIO** hardcode passwords/tokens
170
-
171
- ## Chay Tests
172
- ```bash
173
- # Chay tat ca func tests cho feature
174
- yarn functest:web:{feature-slug}
175
-
176
- # Chay chi mot story
177
- npx playwright test e2e/features/{epic}/{feature}/{story}
178
-
179
- # Chay voi browser cu the
180
- npx playwright test --project=firefox e2e/features/{epic}/{feature}
181
-
182
- # Chay voi debug UI
183
- npx playwright test --ui e2e/features/{epic}/{feature}
184
- ```
185
-
186
- ## Nguyen tac
187
- - Script PHAI chay duoc ngay tu CLI
188
- - Moi describe block dung full FT ID
189
- - Helpers PHAI export de Layer 3 reuse
190
- - KHONG import tu Layer 3 (flows/)
191
- - Neu apps/web/ khong ton tai bao loi graceful, KHONG tao
192
- - Test phai work tren tat ca viewports (mobile, tablet, desktop)
1
+ # /tas-functest-web $ARGUMENTS
2
+
3
+ Role: SE / QA
4
+ Generate all Playwright automation test scripts for a web Feature.
5
+
6
+ ## IMPORTANT - Layer 2: Web Functional Test Scripts
7
+ - Create Playwright test scripts from Func-Test-Spec (markdown)
8
+ - Scripts located in `apps/web/e2e/features/`
9
+ - Reusable helpers exported for Layer 3 (E2E) reuse
10
+ - Hardcoded data in tests, credentials from .env
11
+ - Cross-viewport testing (mobile, tablet, desktop)
12
+
13
+ ## Actions
14
+
15
+ ### Step 1: Identify Feature
16
+ 1. $ARGUMENTS is Feature ID or file path
17
+ 2. If not provided: scan `docs/epics/**/Feature-*.md` for features with status In Progress
18
+ 3. Read Feature file to get Epic/Feature numbers and list of Stories
19
+
20
+ ### Step 2: Check Prerequisites
21
+ 1. Check `apps/web/` exists. If notreport:
22
+ > "Web app doesn't exist in this project. If project only has mobile, use /tas-functest-mobile."
23
+ > STOP, DO NOT create file.
24
+ 2. Find all `Func-Test-*.md` files in Feature directory:
25
+ ```
26
+ docs/epics/{epic-dir}/{feature-dir}/Func-Test-*.md
27
+ ```
28
+ 3. If no Func-Test-Spec existsreport:
29
+ > "No Func-Test-Spec for this Feature yet. Run /tas-functest {story-ID} first."
30
+ 4. Read `apps/web/playwright.config.ts` (if exists) to understand current config
31
+ 5. Read `apps/web/e2e/helpers/` (if exists) to understand patterns
32
+
33
+ ### Step 3: Aggregate FT Test Cases
34
+ - From all Func-Test-Spec files, aggregate list of FT test cases
35
+ - Group by Story
36
+ - Get test data requirements from each spec
37
+
38
+ ### Step 4: Generate Test Scripts
39
+ For EACH Story with Func-Test-Spec:
40
+
41
+ **File output**: `apps/web/e2e/features/{epic-slug}/{feature-slug}/{story-slug}.func.spec.ts`
42
+
43
+ **Structure**:
44
+ ```typescript
45
+ /**
46
+ * Functional Tests: {Story Name}
47
+ * Story: {Story_ID}
48
+ * Feature: {Feature_ID}
49
+ * Epic: {Epic_ID}
50
+ *
51
+ * Generated by /tas-functest-web
52
+ * Spec: docs/epics/{epic-dir}/{feature-dir}/Func-Test-{story-slug}.md
53
+ */
54
+
55
+ import { test, expect } from '@playwright/test';
56
+ import { loadTestData, getCredentials } from '../../../helpers/data-loader';
57
+
58
+ const testData = loadTestData();
59
+
60
+ test.describe('{Feature Name} - {Story Name}', () => {
61
+ test.beforeEach(async ({ page }) => {
62
+ await page.goto('/target-page');
63
+ });
64
+
65
+ // AC Reference: AC-1
66
+ test.describe('{PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_FT_001_H', () => {
67
+ test('should {description from spec}', async ({ page }) => {
68
+ // Given: {precondition}
69
+ // When: {action}
70
+ await page.getByTestId('element-id').click();
71
+ // Then: {expected}
72
+ await expect(page.getByTestId('result')).toBeVisible();
73
+ });
74
+ });
75
+
76
+ // Viewport testing for responsive features
77
+ test.describe('{PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_FT_001_H - Viewports', () => {
78
+ const viewports = [
79
+ { width: 375, height: 812, name: 'mobile' },
80
+ { width: 768, height: 1024, name: 'tablet' },
81
+ { width: 1280, height: 720, name: 'desktop' },
82
+ ];
83
+
84
+ for (const vp of viewports) {
85
+ test(`should work on ${vp.name} (${vp.width}x${vp.height})`, async ({ page }) => {
86
+ await page.setViewportSize({ width: vp.width, height: vp.height });
87
+ // Test responsive behavior
88
+ });
89
+ }
90
+ });
91
+ });
92
+ ```
93
+
94
+ ### Step 5: Generate Feature Helpers
95
+ Create file `apps/web/e2e/features/{epic-slug}/{feature-slug}/helpers.ts`:
96
+ ```typescript
97
+ import { Page, expect } from '@playwright/test';
98
+
99
+ /**
100
+ * Reusable helpers for {Feature Name}
101
+ * Exported for Layer 3 E2E scripts reuse
102
+ */
103
+
104
+ export async function {featureSpecificHelper}(page: Page) {
105
+ // Helper logic extracted from functional tests
106
+ }
107
+ ```
108
+
109
+ ### Step 6: Generate/Update Data Loader (if not exists)
110
+ If `apps/web/e2e/helpers/data-loader.ts` doesn't exist, create:
111
+ ```typescript
112
+ type TestEnv = 'dev' | 'staging' | 'prod';
113
+
114
+ export function loadTestData(env?: TestEnv) {
115
+ const targetEnv = env || (process.env.TEST_ENV as TestEnv) || 'dev';
116
+ return require(`../data/test-data.${targetEnv}.json`);
117
+ }
118
+
119
+ export function getCredentials(userType = 'default') {
120
+ const data = loadTestData();
121
+ const user = data.users[userType] || data.users.default;
122
+ return {
123
+ email: user.email,
124
+ password: process.env.TEST_USER_PASSWORD || '',
125
+ };
126
+ }
127
+ ```
128
+
129
+ ### Step 7: Update package.json Script
130
+ Add or update script in `apps/web/package.json`:
131
+ ```json
132
+ "functest:web:{feature-slug}": "npx playwright test e2e/features/{epic-slug}/{feature-slug}"
133
+ ```
134
+
135
+ ### Step 8: Generate Index
136
+ Create `apps/web/e2e/features/{epic-slug}/{feature-slug}/index.ts`:
137
+ ```typescript
138
+ export * from './helpers';
139
+ ```
140
+
141
+ ## File Structure Output
142
+ ```
143
+ apps/web/e2e/features/
144
+ └── {epic-slug}/
145
+ └── {feature-slug}/
146
+ ├── {story-1-slug}.func.spec.ts
147
+ ├── {story-2-slug}.func.spec.ts
148
+ ├── helpers.ts
149
+ └── index.ts
150
+ ```
151
+
152
+ ## Selector Strategy (Playwright)
153
+ - **Priority**: `data-testid` → `page.getByTestId('login-submit')`
154
+ - **Text content**: `page.getByText('Welcome')`
155
+ - **Role**: `page.getByRole('button', { name: 'Submit' })`
156
+ - **Label**: `page.getByLabel('Email')`
157
+ - DO NOT use traditional CSS selectors (`.class`, `#id`) unless required
158
+
159
+ ## Cross-Browser Testing
160
+ - Chromium (required)
161
+ - Firefox (required)
162
+ - WebKit (required)
163
+ - Config in `playwright.config.ts` projects section
164
+
165
+ ## Test Data Convention
166
+ - **Hardcoded values**: Directly in test
167
+ - **Credentials**: `getCredentials()` → password from process.env
168
+ - **Environment data**: `loadTestData()` → from test-data.{env}.json
169
+ - **NEVER** hardcode passwords/tokens
170
+
171
+ ## Run Tests
172
+ ```bash
173
+ # Run all func tests for feature
174
+ yarn functest:web:{feature-slug}
175
+
176
+ # Run only one story
177
+ npx playwright test e2e/features/{epic}/{feature}/{story}
178
+
179
+ # Run with specific browser
180
+ npx playwright test --project=firefox e2e/features/{epic}/{feature}
181
+
182
+ # Run with debug UI
183
+ npx playwright test --ui e2e/features/{epic}/{feature}
184
+ ```
185
+
186
+ ## Principles
187
+ - Script MUST be runnable directly from CLI
188
+ - Each describe block uses full FT ID
189
+ - Helpers MUST export for Layer 3 reuse
190
+ - DO NOT import from Layer 3 (flows/)
191
+ - If apps/web/ doesn't existgraceful error, DO NOT create
192
+ - Tests must work on all viewports (mobile, tablet, desktop)
@@ -1,76 +1,76 @@
1
- # /tas-functest $ARGUMENTS
2
-
3
- Vai tro: SE / QA
4
- Generate Functional Test Specification tu mot User Story, lien ket test cases voi Acceptance Criteria (AC).
5
-
6
- ## QUAN TRONG - Layer 2: Functional Testing
7
- - Functional tests (FT) nam giua Unit tests (Layer 1) va E2E tests (Layer 3)
8
- - FT test tung chuc nang/story rieng le, KHONG test flow lien ket giua nhieu features
9
- - Moi FT case PHAI reference AC-ID de traceability
10
-
11
- ## Hanh dong
12
-
13
- ### Buoc 1: Xac dinh Story
14
- 1. $ARGUMENTS la Story ID hoac file path
15
- 2. Neu khong co $ARGUMENTS: scan `docs/epics/**/Story-*.md` tim stories co status In Progress hoac Committed
16
- 3. Doc Story file de lay:
17
- - Tat ca Acceptance Criteria (AC-1, AC-2, ...)
18
- - Epic/Feature/Story numbers (tu frontmatter hoac file path)
19
- - Platform context (mobile/web/backend)
20
- 4. Doc `root/tas.yaml` de lay project code (vd: "AL")
21
-
22
- ### Buoc 2: Auto-detect Platform
23
- Tu Story context, xac dinh platform:
24
- - **Mobile**: Keywords "screen", "navigation", "React Native", "Detox"; paths `apps/mobile/src/features/*`
25
- - **Web**: Keywords "browser", "page", "Playwright", "React"; paths `apps/web/*`
26
- - **Backend**: Keywords "API endpoint", "service", "controller"; paths `src/Torus.*`, `tests/`
27
- - Neu khong xac dinh duoc: hoi user
28
-
29
- ### Buoc 3: Generate FT Test Cases
30
- Doc template tu `.tas/templates/Func-Test-Spec.md`
31
-
32
- Naming format:
33
- ```
34
- {PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_FT_{NNN}_{MODIFIER}
35
- ```
36
-
37
- Voi moi AC, generate:
38
- - **BAT BUOC**: 1 Happy path test (H)
39
- - **NEN CO**: 1 Negative test (N) neu co error scenarios
40
- - **TUY CHON**: 1 Edge case test (E) neu co boundary conditions
41
-
42
- Moi test case PHAI co cot AC-ID trong bang mapping.
43
-
44
- ### Buoc 4: Generate Test Data Requirements
45
- - Xac dinh data can thiet cho moi test case
46
- - Data hardcoded: ghi truc tiep trong scenario
47
- - Credentials: chi reference `process.env.TEST_USER_PASSWORD`, KHONG hardcode
48
- - Data per environment: reference `test-data.{env}.json`
49
-
50
- ### Buoc 5: Output File
51
- Luu file tai:
52
- ```
53
- docs/epics/{epic-dir}/{feature-dir}/Func-Test-{story-slug}.md
54
- ```
55
-
56
- ### Buoc 6: Prompting
57
- Sau khi generate, hoi user:
58
- - "Co edge case nao can them khong?"
59
- - "Co negative test scenario nao bi bo sot khong?"
60
- - "Co test case nao can danh dau P0 Critical khong?"
61
- - "Test data va fixtures can chuan bi gi them?"
62
-
63
- ## Traceability Feature
64
- - Moi FT case gan AC-ID trong cot mapping
65
- - Khi AC thay doi: grep AC-ID trong Func-Test-*.md de biet FT nao can update
66
- - Trong test script, moi describe block co comment `// AC Reference: AC-{N}`
67
-
68
- ## Status Flow
69
- Draft → Ready → Implemented → Verified
70
-
71
- ## Nguyen tac
72
- - KHONG tao test code, chi tao specification (markdown)
73
- - Test code duoc tao boi `/tas-functest-mobile` hoac `/tas-functest-web`
74
- - Func-Test-Spec la input cho Layer 2 script generation
75
- - Moi AC phai co it nhat 1 FT case
76
- - FT dung type code `FT`, KHONG dung `E2E` hay `UT`
1
+ # /tas-functest $ARGUMENTS
2
+
3
+ Role: SE / QA
4
+ Generate Functional Test Specification from a User Story, linking test cases to Acceptance Criteria (AC).
5
+
6
+ ## IMPORTANT - Layer 2: Functional Testing
7
+ - Functional tests (FT) sit between Unit tests (Layer 1) and E2E tests (Layer 3)
8
+ - FT tests individual function/story in isolation, DOESN'T test linked flows between multiple features
9
+ - Each FT case MUST reference AC-ID for traceability
10
+
11
+ ## Actions
12
+
13
+ ### Step 1: Identify Story
14
+ 1. $ARGUMENTS is Story ID or file path
15
+ 2. If no $ARGUMENTS: scan `docs/epics/**/Story-*.md` for stories with status In Progress or Committed
16
+ 3. Read Story file to get:
17
+ - All Acceptance Criteria (AC-1, AC-2, ...)
18
+ - Epic/Feature/Story numbers (from frontmatter or file path)
19
+ - Platform context (mobile/web/backend)
20
+ 4. Read `root/tas.yaml` to get project code (e.g., "AL")
21
+
22
+ ### Step 2: Auto-detect Platform
23
+ From Story context, determine platform:
24
+ - **Mobile**: Keywords "screen", "navigation", "React Native", "Detox"; paths `apps/mobile/src/features/*`
25
+ - **Web**: Keywords "browser", "page", "Playwright", "React"; paths `apps/web/*`
26
+ - **Backend**: Keywords "API endpoint", "service", "controller"; paths `src/Torus.*`, `tests/`
27
+ - If cannot determine: ask user
28
+
29
+ ### Step 3: Generate FT Test Cases
30
+ Read template from `.tas/templates/Func-Test-Spec.md`
31
+
32
+ Naming format:
33
+ ```
34
+ {PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_FT_{NNN}_{MODIFIER}
35
+ ```
36
+
37
+ For each AC, generate:
38
+ - **REQUIRED**: 1 Happy path test (H)
39
+ - **SHOULD HAVE**: 1 Negative test (N) if error scenarios exist
40
+ - **OPTIONAL**: 1 Edge case test (E) if boundary conditions exist
41
+
42
+ Each test case MUST have AC-ID column in mapping table.
43
+
44
+ ### Step 4: Generate Test Data Requirements
45
+ - Identify data needed for each test case
46
+ - Hardcoded data: write directly in scenario
47
+ - Credentials: only reference `process.env.TEST_USER_PASSWORD`, DO NOT hardcode
48
+ - Environment-specific data: reference `test-data.{env}.json`
49
+
50
+ ### Step 5: Output File
51
+ Save file at:
52
+ ```
53
+ docs/epics/{epic-dir}/{feature-dir}/Func-Test-{story-slug}.md
54
+ ```
55
+
56
+ ### Step 6: Prompting
57
+ After generating, ask user:
58
+ - "Any edge cases to add?"
59
+ - "Any negative test scenarios missed?"
60
+ - "Any test cases to mark as P0 Critical?"
61
+ - "What additional test data and fixtures needed?"
62
+
63
+ ## Traceability Feature
64
+ - Each FT case links AC-ID in mapping column
65
+ - When AC changes: grep AC-ID in Func-Test-*.md to know which FTs need update
66
+ - In test script, each describe block has comment `// AC Reference: AC-{N}`
67
+
68
+ ## Status Flow
69
+ Draft → Ready → Implemented → Verified
70
+
71
+ ## Principles
72
+ - DO NOT create test code, only create specification (markdown)
73
+ - Test code created by `/tas-functest-mobile` or `/tas-functest-web`
74
+ - Func-Test-Spec is input for Layer 2 script generation
75
+ - Each AC must have at least 1 FT case
76
+ - FT uses type code `FT`, NOT `E2E` or `UT`
@@ -1,17 +1,17 @@
1
- # /tas-init
1
+ # /tas-init
2
2
 
3
- Khởi tạo bộ TAS cho dự án hiện tại.
3
+ Initialize TAS kit for the current project.
4
4
 
5
- ## Hành động
6
- 1. Cần context từ root/tas.yaml. Nếu chưa có, copy từ .tas/tas-example.yaml ra root hỏi user điền thông tin cần thiết.
7
- 2. Tạo cấu trúc thư mục: .tas/templates/, .tas/checklists/, docs/, docs/adr/, docs/epics/, docs/bugs/
8
- 3. Tạo file root/project-status.yaml với trạng thái ban đầu (artifacts, epics, adrs đều rỗng).
9
- 4. Copy các template mặc định vào .tas/templates/ nếu chưa có.
10
- 5. Nếu project type brownfield codebase_scan_on_init = true:
11
- - Quét codebase hiện tại
12
- - Tạo file docs/codebase-overview.md tóm tắt kiến trúc hiện có
13
- 6. Hiển thị trạng thái: project type, team roles, workflow phases đang bật.
5
+ ## Actions
6
+ 1. Need context from root/tas.yaml. If not exists, copy from .tas/tas-example.yaml to root and ask user to fill required information.
7
+ 2. Create directory structure: .tas/templates/, .tas/checklists/, docs/, docs/adr/, docs/epics/, docs/bugs/
8
+ 3. Create root/project-status.yaml file with initial state (artifacts, epics, adrs all empty).
9
+ 4. Copy default templates to .tas/templates/ if not exist.
10
+ 5. If project type is brownfield and codebase_scan_on_init = true:
11
+ - Scan existing codebase
12
+ - Create docs/codebase-overview.md summarizing current architecture
13
+ 6. Display status: project type, team roles, enabled workflow phases.
14
14
 
15
- ## Lưu ý
16
- - KHÔNG tạo lại file nếu đã tồn tại
17
- - Hỏi xác nhận trước khi thực hiện
15
+ ## Notes
16
+ - DO NOT recreate files if already exist
17
+ - Ask for confirmation before executing