Skip to content

Commit d47db49

Browse files
author
Nick Campanini
committed
fix EnrolledChildren field mapping and update E2E fixtures for summerEbtCases + CO IAL
1 parent 7e3aed1 commit d47db49

File tree

5 files changed

+182
-80
lines changed

5 files changed

+182
-80
lines changed

src/SEBT.Portal.Web/e2e/card-replacement/address-flow.spec.ts

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,39 @@ import { expect, test } from '@playwright/test'
22

33
import { setupApiRoutes } from '../fixtures/api-routes'
44
import { injectAuth } from '../fixtures/auth'
5-
import { makeApplication, makeHouseholdData, OLD_CARD_DATE } from '../fixtures/household-data'
5+
import {
6+
makeApplication,
7+
makeHouseholdData,
8+
makeSummerEbtCase,
9+
OLD_CARD_DATE
10+
} from '../fixtures/household-data'
11+
import { currentState } from '../fixtures/state'
12+
13+
const ADDRESS_FORM_DATA =
14+
currentState === 'co'
15+
? { street: '200 E Colfax Ave', city: 'Denver', state: 'Colorado', zip: '80203' }
16+
: {
17+
street: '456 Oak Avenue NW',
18+
city: 'Washington',
19+
state: 'District of Columbia',
20+
zip: '20002'
21+
}
22+
23+
const EXPECTED_PREFILL =
24+
currentState === 'co'
25+
? { street: '200 E Colfax Ave', city: 'Denver', zip: '80203' }
26+
: { street: '1350 Pennsylvania Ave NW', city: 'Washington', zip: '20004' }
627

728
/**
829
* Fills and submits the address form with valid data.
930
* The form submits via PUT /api/household/address, then stores the address
1031
* in AddressFlowContext (React state only) and navigates to the next step.
1132
*/
1233
async function fillAndSubmitAddressForm(page: import('@playwright/test').Page) {
13-
await page.fill('[name="streetAddress1"]', '456 Oak Avenue NW')
14-
await page.fill('[name="city"]', 'Washington')
15-
await page.selectOption('[name="state"]', 'District of Columbia')
16-
await page.fill('[name="postalCode"]', '20002')
34+
await page.fill('[name="streetAddress1"]', ADDRESS_FORM_DATA.street)
35+
await page.fill('[name="city"]', ADDRESS_FORM_DATA.city)
36+
await page.selectOption('[name="state"]', ADDRESS_FORM_DATA.state)
37+
await page.fill('[name="postalCode"]', ADDRESS_FORM_DATA.zip)
1738
await page.getByRole('button', { name: 'Continue' }).click()
1839
}
1940

@@ -22,16 +43,17 @@ test.describe('Address update flow', () => {
2243
await injectAuth(page)
2344
await setupApiRoutes(page, {
2445
householdData: makeHouseholdData({
46+
summerEbtCases: [makeSummerEbtCase({ issuanceType: 1 })],
2547
applications: [makeApplication({ cardRequestedAt: OLD_CARD_DATE, issuanceType: 1 })]
2648
})
2749
})
2850
})
2951

3052
test('address form renders with pre-filled data from household API', async ({ page }) => {
3153
await page.goto('/profile/address')
32-
await expect(page.locator('[name="streetAddress1"]')).toHaveValue('1350 Pennsylvania Ave NW')
33-
await expect(page.locator('[name="city"]')).toHaveValue('Washington')
34-
await expect(page.locator('[name="postalCode"]')).toHaveValue('20004')
54+
await expect(page.locator('[name="streetAddress1"]')).toHaveValue(EXPECTED_PREFILL.street)
55+
await expect(page.locator('[name="city"]')).toHaveValue(EXPECTED_PREFILL.city)
56+
await expect(page.locator('[name="postalCode"]')).toHaveValue(EXPECTED_PREFILL.zip)
3557
})
3658

3759
test('address form submission navigates to replacement card prompt', async ({ page }) => {
@@ -115,7 +137,7 @@ test.describe('Address update flow', () => {
115137

116138
test('shows mailing address', async ({ page }) => {
117139
// The submitted address (from the form, not the household data address on file)
118-
await expect(page.locator('address')).toContainText('456 Oak Avenue NW')
140+
await expect(page.locator('address')).toContainText(ADDRESS_FORM_DATA.street)
119141
})
120142

121143
test('"Order card" button posts to replace endpoint and shows success alert', async ({

src/SEBT.Portal.Web/e2e/card-replacement/child-card.spec.ts

Lines changed: 18 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ import { expect, test } from '@playwright/test'
22

33
import { setupApiRoutes } from '../fixtures/api-routes'
44
import { injectAuth } from '../fixtures/auth'
5-
import {
6-
makeApplication,
7-
makeHouseholdData,
8-
OLD_CARD_DATE,
9-
recentCardDate
10-
} from '../fixtures/household-data'
5+
import { makeHouseholdData, makeSummerEbtCase, recentCardDate } from '../fixtures/household-data'
116
import { skipUnlessState } from '../fixtures/state'
127

138
test.describe('ChildCard', () => {
@@ -21,7 +16,7 @@ test.describe('ChildCard', () => {
2116
}) => {
2217
await setupApiRoutes(page, {
2318
householdData: makeHouseholdData({
24-
applications: [makeApplication({ issuanceType: 1 })]
19+
summerEbtCases: [makeSummerEbtCase({ issuanceType: 1 })]
2520
})
2621
})
2722
await page.goto('/dashboard')
@@ -36,13 +31,7 @@ test.describe('ChildCard', () => {
3631
test('SnapEbtCard (issuanceType 3) shows SNAP card type label', async ({ page }) => {
3732
await setupApiRoutes(page, {
3833
householdData: makeHouseholdData({
39-
applications: [
40-
makeApplication({
41-
issuanceType: 3,
42-
applicationNumber: 'APP-SNAP-001',
43-
cardRequestedAt: OLD_CARD_DATE
44-
})
45-
]
34+
summerEbtCases: [makeSummerEbtCase({ issuanceType: 3 })]
4635
})
4736
})
4837
await page.goto('/dashboard')
@@ -53,13 +42,7 @@ test.describe('ChildCard', () => {
5342
test('TanfEbtCard (issuanceType 2) shows TANF card type label', async ({ page }) => {
5443
await setupApiRoutes(page, {
5544
householdData: makeHouseholdData({
56-
applications: [
57-
makeApplication({
58-
issuanceType: 2,
59-
applicationNumber: 'APP-TANF-001',
60-
cardRequestedAt: OLD_CARD_DATE
61-
})
62-
]
45+
summerEbtCases: [makeSummerEbtCase({ issuanceType: 2 })]
6346
})
6447
})
6548
await page.goto('/dashboard')
@@ -106,15 +89,15 @@ test.describe('ChildCard', () => {
10689
})
10790

10891
test.describe('replacement link visibility', () => {
109-
test('shows replacement link when card was requested more than 14 days ago', async ({
110-
page
111-
}) => {
92+
test('shows replacement link when card is not within cooldown', async ({ page }) => {
11293
await setupApiRoutes(page, {
11394
householdData: makeHouseholdData({
114-
applications: [makeApplication({ cardRequestedAt: OLD_CARD_DATE, issuanceType: 1 })]
95+
summerEbtCases: [makeSummerEbtCase({ issuanceType: 1 })]
11596
})
11697
})
11798
await page.goto('/dashboard')
99+
// SummerEbtCase has no cardRequestedAt, so cooldown does not apply.
100+
// applicationId maps to applicationNumber, enabling the link.
118101
await expect(
119102
page.locator('[data-testid="accordion-content"] a', {
120103
hasText: 'Request a replacement card'
@@ -127,7 +110,9 @@ test.describe('ChildCard', () => {
127110
}) => {
128111
await setupApiRoutes(page, {
129112
householdData: makeHouseholdData({
130-
applications: [makeApplication({ cardRequestedAt: recentCardDate(), issuanceType: 1 })]
113+
summerEbtCases: [
114+
makeSummerEbtCase({ issuanceType: 1, cardRequestedAt: recentCardDate() })
115+
]
131116
})
132117
})
133118
await page.goto('/dashboard')
@@ -141,10 +126,9 @@ test.describe('ChildCard', () => {
141126
test('replacement link points to /cards/replace for SummerEbt', async ({ page }) => {
142127
await setupApiRoutes(page, {
143128
householdData: makeHouseholdData({
144-
applications: [
145-
makeApplication({
146-
applicationNumber: 'APP-2026-001',
147-
cardRequestedAt: OLD_CARD_DATE,
129+
summerEbtCases: [
130+
makeSummerEbtCase({
131+
applicationId: 'APP-2026-001',
148132
issuanceType: 1
149133
})
150134
]
@@ -162,12 +146,7 @@ test.describe('ChildCard', () => {
162146

163147
await setupApiRoutes(page, {
164148
householdData: makeHouseholdData({
165-
applications: [
166-
makeApplication({
167-
issuanceType: 3,
168-
cardRequestedAt: OLD_CARD_DATE
169-
})
170-
]
149+
summerEbtCases: [makeSummerEbtCase({ issuanceType: 3 })]
171150
})
172151
})
173152
await page.goto('/dashboard')
@@ -183,12 +162,7 @@ test.describe('ChildCard', () => {
183162

184163
await setupApiRoutes(page, {
185164
householdData: makeHouseholdData({
186-
applications: [
187-
makeApplication({
188-
issuanceType: 3,
189-
cardRequestedAt: OLD_CARD_DATE
190-
})
191-
]
165+
summerEbtCases: [makeSummerEbtCase({ issuanceType: 3 })]
192166
})
193167
})
194168
await page.goto('/dashboard')
@@ -204,12 +178,7 @@ test.describe('ChildCard', () => {
204178

205179
await setupApiRoutes(page, {
206180
householdData: makeHouseholdData({
207-
applications: [
208-
makeApplication({
209-
issuanceType: 2,
210-
cardRequestedAt: OLD_CARD_DATE
211-
})
212-
]
181+
summerEbtCases: [makeSummerEbtCase({ issuanceType: 2 })]
213182
})
214183
})
215184
await page.goto('/dashboard')
@@ -225,12 +194,7 @@ test.describe('ChildCard', () => {
225194

226195
await setupApiRoutes(page, {
227196
householdData: makeHouseholdData({
228-
applications: [
229-
makeApplication({
230-
issuanceType: 2,
231-
cardRequestedAt: OLD_CARD_DATE
232-
})
233-
]
197+
summerEbtCases: [makeSummerEbtCase({ issuanceType: 2 })]
234198
})
235199
})
236200
await page.goto('/dashboard')

src/SEBT.Portal.Web/e2e/card-replacement/standalone-flow.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { expect, test } from '@playwright/test'
33
import { setupApiRoutes } from '../fixtures/api-routes'
44
import { injectAuth } from '../fixtures/auth'
55
import { makeApplication, makeHouseholdData, OLD_CARD_DATE } from '../fixtures/household-data'
6+
import { currentState } from '../fixtures/state'
67

78
const APP_NUMBER = 'APP-2026-001'
9+
const EXPECTED_ADDRESS = currentState === 'co' ? '200 E Colfax Ave' : '1350 Pennsylvania Ave NW'
810
const ENCODED_APP = encodeURIComponent(APP_NUMBER)
911

1012
test.describe('Standalone replacement flow', () => {
@@ -25,7 +27,7 @@ test.describe('Standalone replacement flow', () => {
2527
await expect(page.locator('h1')).toContainText(
2628
'Do you want the new card mailed to this address?'
2729
)
28-
await expect(page.getByText('1350 Pennsylvania Ave NW')).toBeVisible()
30+
await expect(page.getByText(EXPECTED_ADDRESS)).toBeVisible()
2931
})
3032

3133
test('shows validation error when submitted without a selection', async ({ page }) => {
@@ -77,7 +79,7 @@ test.describe('Standalone replacement flow', () => {
7779
test('renders confirm request page with child name and address', async ({ page }) => {
7880
await page.goto(`/cards/replace/confirm?app=${ENCODED_APP}`)
7981
await expect(page.getByText("John Doe's card")).toBeVisible()
80-
await expect(page.locator('address')).toContainText('1350 Pennsylvania Ave NW')
82+
await expect(page.locator('address')).toContainText(EXPECTED_ADDRESS)
8183
})
8284

8385
test('"Order card" posts to replace endpoint and redirects to dashboard with success alert', async ({

0 commit comments

Comments
 (0)