Skip to content

Commit 046ddc9

Browse files
committed
Updated e2e testing
1 parent 1146e14 commit 046ddc9

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

e2e/fixtures/teams.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"teams": [
3+
{
4+
"_id": "5e863b833150f6001b34627d",
5+
"global": "false",
6+
"name": "Education",
7+
"cityId": "5cefa67c071d210018e3dccf",
8+
"description": "EDU",
9+
"__v": 0,
10+
"leaderEmail": "[email protected]"
11+
}
12+
]
13+
}

e2e/integration/journey.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ beforeEach(() => {
44
cy.intercept('GET', `${mockServerURL}/cities?visibleIn=VOLUNTEER_FORM`, {
55
fixture: 'cities.json'
66
})
7+
cy.intercept('GET', `${mockServerURL}/teams`, {
8+
fixture: 'teams.json'
9+
})
710
cy.visit('/')
811
})
912

@@ -19,16 +22,15 @@ it('can submit a minimal form', () => {
1922
interestedInVolunteer: 'just sounds interesting',
2023
interestedInCYF: 'trying to do my bit',
2124
industry: 'Education',
22-
hearAboutCYF: 'Social media',
23-
teamId: '5e863b833150f6001b34627d'
25+
hearAboutCYF: 'Social media'
2426
}
2527

2628
cy.findByRole('textbox', { name: /first name/i }).type(initialData.firstName)
2729
cy.findByRole('textbox', { name: /last name/i }).type(initialData.lastName)
2830
cy.findByRole('combobox', { name: /city/i }).select('London')
2931
cy.findByRole('combobox', {
3032
name: /select the team you want to volunteer for/i
31-
}).select(initialData.teamId)
33+
}).select('Education')
3234
cy.findByRole('textbox', { name: /email/i }).type(initialData.email)
3335
cy.findByRole('textbox', { name: /phone number/i }).type(initialData.tel)
3436
cy.findByRole('textbox', { name: /interested in volunteering/i }).type(

e2e/integration/withCode.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ beforeEach(() => {
44
cy.intercept('GET', `${mockServerURL}/cities?visibleIn=VOLUNTEER_FORM`, {
55
fixture: 'cities.json'
66
})
7+
cy.intercept('GET', `${mockServerURL}/teams`, {
8+
fixture: 'teams.json'
9+
})
710
})
811

912
it('shows success message', () => {
@@ -27,8 +30,7 @@ it('includes the user ID when resubmitting', () => {
2730
)
2831
cy.findByRole('combobox', {
2932
name: /select the team you want to volunteer for/i
30-
}).select('5e863b833150f6001b34627d')
31-
33+
}).select('Education')
3234
cy.findByRole('textbox', { name: /phone number/i }).type('0158-8969905')
3335
cy.findByRole('textbox', { name: /interested in volunteering/i }).type('just')
3436
cy.findByRole('textbox', { name: /interested in code your future/i }).type(

0 commit comments

Comments
 (0)