-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add full name field to access and submission page #1797
Changes from 4 commits
77b00bb
5db0c6f
05a3703
196dc31
6c5ff38
c4b38d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { testValidEligibility } from '../support/check-eligibility.js'; | ||
import { testValidAuditeeInfo } from '../support/auditee-info.js'; | ||
import { addValidEmail, testValidAccess } from '../support/check-access.js'; | ||
import { addValidInfo, testValidAccess } from '../support/check-access.js'; | ||
|
||
describe('Create New Audit', () => { | ||
|
||
|
@@ -21,7 +21,7 @@ describe('Create New Audit', () => { | |
|
||
describe('A Blank Form', () => { | ||
it('marks empty responses as invalid', () => { | ||
cy.get('#grant-access input:invalid').should('have.length', 8); | ||
cy.get('#grant-access input:invalid').should('have.length', 12); | ||
}); | ||
|
||
it('will not submit', () => { | ||
|
@@ -40,6 +40,31 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
describe('Auditee certifying official', () => { | ||
describe('Full name', () => { | ||
it('should display an error message when left blank', () => { | ||
cy.get('#certifying_auditee_contact_fullname').click().blur(); | ||
cy.get('#certifying_auditee_contact_fullname-not-null').should( | ||
'be.visible' | ||
); | ||
}); | ||
|
||
it('should disable the submit button when fields are left blank', () => { | ||
cy.get('#certifying_auditee_contact_fullname').click().blur(); | ||
cy.get('button').contains('Create').should('be.disabled'); | ||
}); | ||
|
||
it('should remove the error message when input is supplied', () => { | ||
addValidInfo('#certifying_auditee_contact_fullname') | ||
cy.get('#certifying_auditee_contact_fullname-not-null').should( | ||
'not.be.visible' | ||
); | ||
}); | ||
|
||
it('should enable the "Create" button when entities are fixed', () => { | ||
addValidInfo('#certifying_auditee_contact_fullname'); | ||
cy.get('button').contains('Create').should('not.be.disabled'); | ||
}); | ||
}); | ||
describe('Email Address', () => { | ||
it('should display an error message when left blank', () => { | ||
cy.get('#certifying_auditee_contact_email').click().blur(); | ||
|
@@ -76,21 +101,21 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
it('should remove the error message when valid input is supplied', () => { | ||
addValidEmail('#certifying_auditee_contact_email'); | ||
addValidInfo('#certifying_auditee_contact_email'); | ||
cy.get('#certifying_auditee_contact_email-error-message').should( | ||
'not.be.visible' | ||
); | ||
}); | ||
|
||
it('should enable the "Create" button when entities are fixed', () => { | ||
addValidEmail('#certifying_auditee_contact_email'); | ||
addValidInfo('#certifying_auditee_contact_email'); | ||
cy.get('button').contains('Create').should('not.be.disabled'); | ||
}); | ||
}); | ||
|
||
describe('Email Address Confirmation', () => { | ||
it('should display an error message when input does not match email field', () => { | ||
addValidEmail('#certifying_auditee_contact_email'); | ||
addValidInfo('#certifying_auditee_contact_email'); | ||
cy.get('#certifying_auditee_contact_re_email') | ||
.clear() | ||
.type('test.address-wit') | ||
|
@@ -101,8 +126,8 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
it('should remove the error message when input matches email field', () => { | ||
addValidEmail('#certifying_auditee_contact_email'); | ||
addValidEmail('#certifying_auditee_contact_re_email'); | ||
addValidInfo('#certifying_auditee_contact_email'); | ||
addValidInfo('#certifying_auditee_contact_re_email'); | ||
cy.get('#certifying_auditee_contact_re_email-must-match').should( | ||
'not.be.visible' | ||
); | ||
|
@@ -111,6 +136,33 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
describe('Auditor certifying official', () => { | ||
|
||
describe('Full name', () => { | ||
it('should display an error message when left blank', () => { | ||
cy.get('#certifying_auditor_contact_fullname').click().blur(); | ||
cy.get('#certifying_auditor_contact_fullname-not-null').should( | ||
'be.visible' | ||
); | ||
}); | ||
|
||
it('should disable the submit button when fields are left blank', () => { | ||
cy.get('#certifying_auditor_contact_fullname').click().blur(); | ||
cy.get('button').contains('Create').should('be.disabled'); | ||
}); | ||
|
||
it('should remove the error message when input is supplied', () => { | ||
addValidInfo('#certifying_auditor_contact_fullname'); | ||
cy.get('#certifying_auditor_contact_fullname-not-null').should( | ||
'not.be.visible' | ||
); | ||
}); | ||
|
||
it('should enable the "Create" button when entities are fixed', () => { | ||
addValidInfo('#certifying_auditor_contact_fullname'); | ||
cy.get('button').contains('Create').should('not.be.disabled'); | ||
}); | ||
}); | ||
|
||
describe('Email Address', () => { | ||
it('should display an error message when left blank', () => { | ||
cy.get('#certifying_auditor_contact_email').click().blur(); | ||
|
@@ -151,7 +203,7 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
it('should remove the error message when valid input is supplied', () => { | ||
addValidEmail('#certifying_auditor_contact_email') | ||
addValidInfo('#certifying_auditor_contact_email') | ||
cy.get('#certifying_auditor_contact_email-email').should( | ||
'not.be.visible' | ||
); | ||
|
@@ -164,7 +216,7 @@ describe('Create New Audit', () => { | |
|
||
describe('Email Address Confirmation', () => { | ||
it('should display an error message when input does not match email field', () => { | ||
addValidEmail('#certifying_auditor_contact_email') | ||
addValidInfo('#certifying_auditor_contact_email') | ||
cy.get('#certifying_auditor_contact_re_email') | ||
.clear() | ||
.type('test.address-wit') | ||
|
@@ -175,8 +227,8 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
it('should remove the error message when input matches email field', () => { | ||
addValidEmail('#certifying_auditor_contact_email') | ||
addValidEmail('#certifying_auditor_contact_re_email') | ||
addValidInfo('#certifying_auditor_contact_email') | ||
addValidInfo('#certifying_auditor_contact_re_email') | ||
|
||
cy.get('#certifying_auditor_contact_re_email-must-match').should( | ||
'not.be.visible' | ||
|
@@ -186,6 +238,33 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
describe('Auditee contacts', () => { | ||
|
||
describe('Full name', () => { | ||
it('should display an error message when left blank', () => { | ||
cy.get('#auditee_contacts_fullname').click().blur(); | ||
cy.get('#auditee_contacts_fullname-not-null').should( | ||
'be.visible' | ||
); | ||
}); | ||
|
||
it('should disable the submit button when fields are left blank', () => { | ||
cy.get('#auditee_contacts_fullname').click().blur(); | ||
cy.get('button').contains('Create').should('be.disabled'); | ||
}); | ||
|
||
it('should remove the error message when input is supplied', () => { | ||
addValidInfo('#auditee_contacts_fullname') | ||
cy.get('#auditee_contacts_fullname-not-null').should( | ||
'not.be.visible' | ||
); | ||
}); | ||
|
||
it('should enable the "Create" button when entities are fixed', () => { | ||
addValidInfo('#auditee_contacts_fullname'); | ||
cy.get('button').contains('Create').should('not.be.disabled'); | ||
}); | ||
}); | ||
|
||
describe('Email Address', () => { | ||
it('should display an error message when left blank', () => { | ||
cy.get('#auditee_contacts_email').click().blur(); | ||
|
@@ -208,14 +287,14 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
it('should remove the error message when valid input is supplied', () => { | ||
addValidEmail('#auditee_contacts_email') | ||
addValidInfo('#auditee_contacts_email') | ||
cy.get('#auditee_contacts_email-email').should('not.be.visible'); | ||
}); | ||
}); | ||
|
||
describe('Email Address Confirmation', () => { | ||
it('should display an error message when input does not match email field', () => { | ||
addValidEmail('#auditee_contacts_email') | ||
addValidInfo('#auditee_contacts_email') | ||
|
||
cy.get('#auditee_contacts_re_email') | ||
.clear() | ||
|
@@ -225,8 +304,8 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
it('should remove the error message when input matches email field', () => { | ||
addValidEmail('#auditee_contacts_email') | ||
addValidEmail('#auditee_contacts_re_email') | ||
addValidInfo('#auditee_contacts_email') | ||
addValidInfo('#auditee_contacts_re_email') | ||
|
||
cy.get('#auditee_contacts_re_email-must-match').should( | ||
'not.be.visible' | ||
|
@@ -237,7 +316,7 @@ describe('Create New Audit', () => { | |
it('should allow adding new contact fields', () => { | ||
cy.get('.auditee_contacts').within(() => { | ||
cy.get('button').click(); | ||
cy.get('.grid-row').should('have.length', 2); | ||
cy.get('.grid-row').should('have.length', 4); | ||
}); | ||
}); | ||
|
||
|
@@ -247,13 +326,13 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
cy.get('.auditee_contacts .delete-contact').click(); | ||
cy.get('.auditee_contacts .grid-row').should('have.length', 1); | ||
cy.get('.auditee_contacts .grid-row').should('have.length', 3); | ||
}); | ||
|
||
it('should be able to add contact and contact info to new inputs', () => { | ||
cy.get('.auditee_contacts').within(() => { | ||
cy.get('button').click(); | ||
cy.get('.grid-row').should('have.length', 2); | ||
cy.get('.grid-row').should('have.length', 4); | ||
cy.get('input[id*="auditee_contacts_email"]') | ||
.eq(1) | ||
.clear() | ||
|
@@ -267,6 +346,36 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
describe('Auditor contacts', () => { | ||
|
||
describe('Full name', () => { | ||
it('should display an error message when left blank', () => { | ||
cy.get('#auditor_contacts_fullname').click().blur(); | ||
cy.get('#auditor_contacts_fullname-not-null').should( | ||
'be.visible' | ||
); | ||
}); | ||
|
||
it('should disable the submit button when fields are left blank', () => { | ||
cy.get('#auditor_contacts_fullname').click().blur(); | ||
cy.get('button').contains('Create').should('be.disabled'); | ||
}); | ||
|
||
it('should remove the error message when input is supplied', () => { | ||
cy.get('#auditor_contacts_fullname') | ||
.clear() | ||
.type('A Name') | ||
.blur(); | ||
cy.get('#auditor_contacts_fullname-not-null').should( | ||
'not.be.visible' | ||
); | ||
}); | ||
|
||
it('should enable the "Create" button when entities are fixed', () => { | ||
addValidInfo('#auditor_contacts_fullname'); | ||
cy.get('button').contains('Create').should('not.be.disabled'); | ||
}); | ||
}); | ||
|
||
describe('Email Address', () => { | ||
it('should display an error message when left blank', () => { | ||
cy.get('#auditor_contacts_email').click().blur(); | ||
|
@@ -294,19 +403,19 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
it('should remove the error message when valid input is supplied', () => { | ||
addValidEmail('#auditor_contacts_email') | ||
addValidInfo('#auditor_contacts_email') | ||
cy.get('#auditor_contacts_email-email').should('not.be.visible'); | ||
}); | ||
|
||
it('should enable the "Create" button when entities are fixed', () => { | ||
addValidEmail('#auditor_contacts_email') | ||
addValidInfo('#auditor_contacts_email') | ||
cy.get('button').contains('Create').should('not.be.disabled'); | ||
}); | ||
}); | ||
|
||
describe('Email Address Confirmation', () => { | ||
it('should display an error message when input does not match email field', () => { | ||
addValidEmail('#auditor_contacts_email') | ||
addValidInfo('#auditor_contacts_email') | ||
|
||
cy.get('#auditor_contacts_re_email') | ||
.clear() | ||
|
@@ -316,8 +425,8 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
it('should remove the error message when input matches email field', () => { | ||
addValidEmail('#auditor_contacts_email') | ||
addValidEmail('#auditor_contacts_re_email') | ||
addValidInfo('#auditor_contacts_email') | ||
addValidInfo('#auditor_contacts_re_email') | ||
|
||
cy.get('#auditor_contacts_re_email-must-match').should( | ||
'not.be.visible' | ||
|
@@ -328,7 +437,7 @@ describe('Create New Audit', () => { | |
it('should allow adding new contact fields', () => { | ||
cy.get('.auditor_contacts').within(() => { | ||
cy.get('button').click(); | ||
cy.get('.grid-row').should('have.length', 2); | ||
cy.get('.grid-row').should('have.length', 4); | ||
}); | ||
}); | ||
|
||
|
@@ -338,13 +447,17 @@ describe('Create New Audit', () => { | |
}); | ||
|
||
cy.get('.auditor_contacts .delete-contact').click(); | ||
cy.get('.auditor_contacts .grid-row').should('have.length', 1); | ||
cy.get('.auditor_contacts .grid-row').should('have.length', 3); | ||
}); | ||
|
||
it('should be able to add contact and contact info to new inputs', () => { | ||
cy.get('.auditor_contacts').within(() => { | ||
cy.get('button').click(); | ||
cy.get('.grid-row').should('have.length', 2); | ||
cy.get('.grid-row').should('have.length', 4); | ||
cy.get('input[id*="auditor_contacts_fullname"]') | ||
.eq(1) | ||
.clear() | ||
.type('[email protected]'); | ||
cy.get('input[id*="auditor_contacts_email"]') | ||
.eq(1) | ||
.clear() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,13 @@ describe('Create new audit', () => { | |
}); | ||
|
||
it('Fills out the Audit submission access', () => { | ||
cy.get('#certifying_auditee_contact_fullname').type('Real Full Name'); | ||
cy.get('#certifying_auditee_contact_email').type('va@test'); | ||
cy.get('#certifying_auditor_contact_email').type('[email protected]'); | ||
cy.get('#certifying_auditor_contact_fullname').type('A. Humanbeing'); | ||
cy.get('#auditee_contacts_fullname').type('Doe A. Deer'); | ||
cy.get('#auditee_contacts_email').type('[email protected]'); | ||
cy.get('#auditor_contacts_fullname').type('Percy Person'); | ||
cy.get('#auditor_contacts_email').type('[email protected]'); | ||
cy.get('#create').click(); | ||
cy.url().should('contain', '/report_submission/general-information/2023MAY0001000001'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
// reusable code for the accessandsubmission page | ||
const accessFields = [ | ||
'#certifying_auditee_contact_fullname', '#certifying_auditee_contact_email', '#certifying_auditee_contact_re_email', | ||
'#certifying_auditor_contact_fullname', '#certifying_auditor_contact_email', '#certifying_auditor_contact_re_email', | ||
'#auditee_contacts_fullname', '#auditee_contacts_email', '#auditee_contacts_re_email', | ||
'#auditor_contacts_fullname', '#auditor_contacts_email', '#auditor_contacts_re_email', | ||
]; | ||
|
||
export function addValidEmail(field) { | ||
cy.get(field) | ||
export function addValidInfo(field) { | ||
const filedType = field.split('_').pop(); | ||
if(filedType === 'email') { | ||
cy.get(field) | ||
.clear() | ||
.type('[email protected]') | ||
.blur(); | ||
} else { | ||
cy.get(field) | ||
.clear() | ||
.type('[email protected]') | ||
.type('Real Full Name') | ||
.blur(); | ||
} | ||
|
||
function completeFormWithValidInfo() { | ||
[ | ||
'#certifying_auditee_contact_email', '#certifying_auditee_contact_re_email', | ||
'#certifying_auditor_contact_email', '#certifying_auditor_contact_re_email', | ||
'#auditee_contacts_email', '#auditee_contacts_re_email', | ||
'#auditor_contacts_email', '#auditor_contacts_re_email' | ||
].forEach(field => addValidEmail(field)) | ||
} | ||
} | ||
|
||
export function testValidAccess() { | ||
completeFormWithValidInfo(); | ||
cy.wrap(accessFields).each((field) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
addValidInfo(field); | ||
}); | ||
cy.get('.usa-button').contains('Create').click(); | ||
cy.url().should('contains', '/report_submission/general-information/'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put the new full name fields in their own row, which means two new rows are added each time you add a new contact.