-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: application is no longer 404'd on creation and navigation (#2338)
* fix: get rid of isReadOnly flag the data already exists in prop so no need to make router checks * chore: add more form filling tests * feat: use env to skip console.log on tests * docs: add missing env for running tests * refactor: rename types * fix: disable tests that fail on CI
- Loading branch information
Showing
28 changed files
with
644 additions
and
227 deletions.
There are no files selected for viewing
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
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
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
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
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
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
26 changes: 26 additions & 0 deletions
26
frontend/benefit/applicant/browser-tests/page-model/step4.ts
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,26 @@ | ||
import { t } from 'testcafe'; | ||
|
||
import WizardStep from './WizardStep'; | ||
|
||
class Step4 extends WizardStep { | ||
constructor() { | ||
super(4); | ||
} | ||
|
||
private employeeConsent = this.component.findByTestId('employee_consent'); | ||
|
||
async employeeConsentNeeded(): Promise<void> { | ||
await t.expect(this.employeeConsent.exists).ok(); | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
async stageUploadFiles(): Promise<void> { | ||
await t.setFilesToUpload( | ||
'#upload_attachment_employee_consent', | ||
'sample.pdf' | ||
); | ||
await t.wait(500); | ||
} | ||
} | ||
|
||
export default Step4; |
69 changes: 69 additions & 0 deletions
69
frontend/benefit/applicant/browser-tests/page-model/step5.ts
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,69 @@ | ||
import { Selector, t } from 'testcafe'; | ||
|
||
import { ApplicationFormData } from '../types'; | ||
import { | ||
ApplicationField, | ||
mapFullForm as mapFieldsExtra, | ||
mapRequiredForm as mapFieldsMandatory, | ||
} from '../utils/fieldMaps'; | ||
import WizardStep from './WizardStep'; | ||
|
||
class Step5 extends WizardStep { | ||
private fieldsRequired: ApplicationField[]; | ||
|
||
private fieldsExtra: ApplicationField[]; | ||
|
||
private Selector = Selector; | ||
|
||
constructor(form: ApplicationFormData) { | ||
super(5); | ||
|
||
this.fieldsRequired = mapFieldsMandatory(form); | ||
this.fieldsExtra = mapFieldsExtra(form); | ||
} | ||
|
||
private associationFieldNames = [ | ||
'application-field-associationImmediateManagerCheck', | ||
]; | ||
|
||
private fieldIsVisible = async (testId: string): Promise<boolean> => | ||
this.component.findByTestId(testId).visible; | ||
|
||
private fieldValueIsVisible = async ( | ||
testId: string, | ||
value: string | ||
): Promise<boolean> => | ||
this.Selector(`[data-testid="${testId}"]`).withText(value).visible; | ||
|
||
async fieldsExistFor( | ||
organizationType: 'company' | 'association' | ||
): Promise<void> { | ||
const fullForm = [...this.fieldsRequired, ...this.fieldsExtra]; | ||
// eslint-disable-next-line no-restricted-syntax | ||
for (const field of fullForm) { | ||
// eslint-disable-next-line no-await-in-loop | ||
await t.scrollIntoView(`[data-testid="${field.testId}"]`); | ||
// eslint-disable-next-line no-await-in-loop | ||
await t.expect(await this.fieldIsVisible(field.testId)).ok(); | ||
if (field.value) { | ||
// eslint-disable-next-line no-await-in-loop | ||
const fieldIsVisible = await this.fieldValueIsVisible( | ||
field.testId, | ||
field.value | ||
); | ||
// eslint-disable-next-line no-await-in-loop | ||
await t.expect(fieldIsVisible).ok(); | ||
} | ||
} | ||
|
||
if (organizationType === 'association') { | ||
// eslint-disable-next-line no-restricted-syntax | ||
for (const testId of this.associationFieldNames) { | ||
// eslint-disable-next-line no-await-in-loop | ||
await t.expect(await this.fieldIsVisible(testId)).ok(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
export default Step5; |
44 changes: 44 additions & 0 deletions
44
frontend/benefit/applicant/browser-tests/page-model/step6.ts
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,44 @@ | ||
import { Selector, t } from 'testcafe'; | ||
|
||
import WizardStep from './WizardStep'; | ||
|
||
class Step6 extends WizardStep { | ||
constructor() { | ||
super(6); | ||
} | ||
|
||
protected nextButton = this.component.findByRole('button', { | ||
name: this.translations.applications.actions.send, | ||
}); | ||
|
||
public submitSuccessLabel = this.component.findByText( | ||
this.translations.notifications.applicationSubmitted.label, | ||
{ selector: 'h1' } | ||
); | ||
|
||
public async isShowingSubmitSuccess(): Promise<void> { | ||
await t | ||
.expect( | ||
await Selector('h1').withText( | ||
this.translations.notifications.applicationSubmitted.label | ||
).visible | ||
) | ||
.ok(); | ||
} | ||
|
||
public applicantTerms = this.component.findByTestId(''); | ||
|
||
/** | ||
* Click through all applicant terms. | ||
* Assume terms are loaded from fixture default_terms.json using LOAD_DEFAULT_TERMS=1 | ||
*/ | ||
public async checkApplicantTerms(): Promise<void> { | ||
const consentSelector = '[data-testid="application-terms-consent"]'; | ||
await t.click(Selector(consentSelector).nth(0)); | ||
await t.click(Selector(consentSelector).nth(1)); | ||
await t.click(Selector(consentSelector).nth(2)); | ||
await t.click(Selector(consentSelector).nth(3)); | ||
} | ||
} | ||
|
||
export default Step6; |
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
Oops, something went wrong.