Skip to content

Commit 945bcbd

Browse files
committed
Explore and test other flows
1 parent c3ec0b9 commit 945bcbd

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

e2e/fixtures/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ app.post('/volunteer', (req, res) => {
2222
body: req.body,
2323
headers: req.headers
2424
})
25-
res.json({ volunteer: req.body })
25+
res.json({ volunteer: { _id: 'abc123', ...req.body } })
2626
})
2727

2828
app.get('/_calls', (req, res) => {

e2e/integration/journey.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ it('can submit a minimal form', () => {
5858
userId: ''
5959
})
6060
})
61+
cy.findByText(
62+
`Welcome ${initialData.firstName} ${initialData.lastName}`
63+
).should('exist')
64+
cy.findByText(/thank you for submitting your application/i).should('exist')
6165
})
6266

6367
it('requires employee selection', () => {

e2e/integration/withCode.test.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,40 @@ beforeEach(() => {
44
cy.request('POST', `${mockServerURL}/_reset`)
55
})
66

7+
it('shows success message', () => {
8+
cy.visit('/code/foobar/success')
9+
cy.findByText(/we will review your application/i).should('exist')
10+
})
11+
12+
it('includes the user ID when resubmitting', () => {
13+
const userId = 'something'
14+
const code = 'does-this-matter'
15+
cy.visit(`/code/${userId}/${code}`)
16+
17+
cy.findByRole('textbox', { name: /first name/i }).type('Erhard')
18+
cy.findByRole('textbox', { name: /last name/i }).type('Hennemann')
19+
cy.findByRole('combobox', { name: /city/i }).select('London')
20+
cy.findByRole('textbox', { name: /email/i }).type(
21+
22+
)
23+
cy.findByRole('textbox', { name: /phone number/i }).type('0158-8969905')
24+
cy.findByRole('textbox', { name: /interested in volunteering/i }).type('just')
25+
cy.findByRole('textbox', { name: /interested in code your future/i }).type(
26+
'testing'
27+
)
28+
cy.findByRole('checkbox', { name: /terms of use/i }).check()
29+
cy.findByRole('checkbox', { name: /contact me/i }).check()
30+
cy.findByRole('button', { name: /submit/i }).click()
31+
32+
cy.request(`${mockServerURL}/_calls`).then(({ body }) => {
33+
expect(body).to.have.length(1)
34+
const [{ body: payload, method, path }] = body
35+
expect(method).to.equal('POST')
36+
expect(path).to.equal('/volunteer')
37+
expect(payload).to.have.property('userId', userId)
38+
})
39+
})
40+
741
it('lets you request a reminder email', () => {
842
const userId = 'whoever'
943
const code = 'whatever'
@@ -26,3 +60,8 @@ it('lets you request a reminder email', () => {
2660
expect(payload).to.deep.equal({ email, userId })
2761
})
2862
})
63+
64+
it('lets you revalidate on failure', () => {
65+
cy.visit('/code/user/failed')
66+
cy.findByText(/failed to verify your email address/i).should('exist')
67+
})

0 commit comments

Comments
 (0)