-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#vebt-853 #comment Form tester utility 22-10282 form (#33582)
* #vebt-853 #comment Form tester utility 22-10282 form * #vebt-853 #comment Removed comments of code and fixed maximal data * #vebt-853 #comment Fixed unit test 10282 * #vebt-853 #comment Added mock submit to e2e test
- Loading branch information
1 parent
e7b2dbc
commit 269f78f
Showing
6 changed files
with
93 additions
and
25 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
src/applications/edu-benefits/10282/tests/10282-edu-benefits.cypress.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import path from 'path'; | ||
|
||
import testForm from 'platform/testing/e2e/cypress/support/form-tester'; | ||
import { createTestConfig } from 'platform/testing/e2e/cypress/support/form-tester/utilities'; | ||
import mockSubmit from './fixtures/mocks/application-submit.json'; | ||
|
||
import formConfig from '../config/form'; | ||
import manifest from '../manifest.json'; | ||
|
||
const testConfig = createTestConfig( | ||
{ | ||
dataPrefix: 'data', | ||
|
||
dataDir: path.join(__dirname, 'fixtures', 'data'), | ||
|
||
dataSets: ['minimal-test.json', 'maximal-test.json'], | ||
|
||
pageHooks: { | ||
introduction: ({ afterHook }) => { | ||
afterHook(() => { | ||
cy.get('a.va-link--primary') | ||
.first() | ||
.click(); | ||
}); | ||
}, | ||
'review-and-submit': ({ afterHook }) => { | ||
afterHook(() => { | ||
cy.get('va-text-input') | ||
.shadow() | ||
.find('input') | ||
.type('Jane Doe'); | ||
cy.get(`va-checkbox`) | ||
.shadow() | ||
.find('input') | ||
.check({ force: true }); | ||
|
||
cy.findAllByText(/submit/i, { selector: 'button' }) | ||
.first() | ||
.click(); | ||
}); | ||
}, | ||
}, | ||
|
||
setupPerTest: () => { | ||
// Log in if the form requires an authenticated session. | ||
// cy.login(); | ||
cy.intercept('POST', formConfig.submitUrl, mockSubmit); | ||
}, | ||
|
||
// Skip tests in CI until the form is released. | ||
// Remove this setting when the form has a content page in production. | ||
skip: Cypress.env('CI'), | ||
}, | ||
manifest, | ||
formConfig, | ||
); | ||
|
||
testForm(testConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,11 @@ | |
}, | ||
"raceAndGender": true, | ||
"ethnicity": "NA", | ||
"orginRace": { | ||
"gender": "NA", | ||
"originRace": { | ||
"noAnswer": true | ||
}, | ||
"gender": "NA", | ||
"state": "Texas", | ||
"state": "TX", | ||
"country": "United States", | ||
"contactInfo": { | ||
"email": "[email protected]", | ||
|
@@ -25,8 +25,6 @@ | |
"first": "Jane", | ||
"middle": "Test", | ||
"last": "Doe" | ||
}, | ||
"signature": "Jane Doe", | ||
"AGREED": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"data": { | ||
"state": "Virginia", | ||
"state": "VA", | ||
"country": "United States", | ||
"contactInfo": { | ||
"email": "[email protected]" | ||
|
@@ -10,8 +10,6 @@ | |
"first": "Jane", | ||
"last": "Doe" | ||
}, | ||
"highestLevelOfEducation": {}, | ||
"signature": "Jane Doe", | ||
"AGREED": true | ||
"highestLevelOfEducation": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const transformedMinimalDataActual = { | ||
state: 'Virginia', | ||
state: 'VA', | ||
country: 'United States', | ||
contactInfo: { | ||
email: '[email protected]', | ||
|
@@ -10,8 +10,6 @@ const transformedMinimalDataActual = { | |
last: 'Doe', | ||
}, | ||
highestLevelOfEducation: {}, | ||
// signature: 'Jane Doe', | ||
// AGREED: true, | ||
}; | ||
|
||
export const transformedMinimalData = JSON.stringify({ | ||
|
@@ -31,8 +29,8 @@ const transformedMaximalDataActual = { | |
raceAndGender: true, | ||
ethnicity: 'NA', | ||
gender: 'NA', | ||
orginRace: { noAnswer: true }, | ||
state: 'Texas', | ||
originRace: { noAnswer: true }, | ||
state: 'TX', | ||
country: 'United States', | ||
contactInfo: { | ||
email: '[email protected]', | ||
|
@@ -45,8 +43,6 @@ const transformedMaximalDataActual = { | |
middle: 'Test', | ||
last: 'Doe', | ||
}, | ||
signature: 'Jane Doe', | ||
AGREED: true, | ||
}; | ||
|
||
export const transformedMaximalData = JSON.stringify({ | ||
|
15 changes: 15 additions & 0 deletions
15
src/applications/edu-benefits/10282/tests/fixtures/mocks/application-submit.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"data": { | ||
"id": "1234567890-uuid", | ||
"type": "education_benefits_claim", | ||
"attributes": { | ||
"status": "pending", | ||
"updatedAt": "2022-01-02T03:04:05.067Z", | ||
"createdAt": "2022-01-02T03:04:05.067Z", | ||
"formData": { | ||
"data": {} | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters