Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/component/ERACommons/era_commons.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Buffer } from 'buffer'

// Example token from https://broad-shibboleth-prod.appspot.com/dev/login?return-url=%2Fexample-return%3Ftoken%3D%3Ctoken%3E
const encodedToken
= `eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ
= `eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ
lcmFDb21tb25zVXNlcm5hbWUiOiJ0ZXN0aW5nIiw
iaWF0IjoxNzA5NTYxMjc2LCJleHAiOjE3MDk1NjQ
4NzZ9.HKnqebvJVL63jKZDqheYWRSNaLvB92b0Dk
Expand Down
33 changes: 22 additions & 11 deletions cypress/component/Forms/forms.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('FormField - Tests', () => {
mount(<FormField {...props} />)
cy.get('#lbl_optionalDate').contains('Optional Date')
cy.get('#lbl_optionalDate').should('not.contain', '*')
cy.get('input').type('{end}{del}99')
cy.get('input').type('{end}{del}9999')
cy.get('.formField-optionalDate .error-message').contains(FormValidators.DATEJS.msg)
})
it('should render a calendar picker control initialized with an error', () => {
Expand Down Expand Up @@ -827,14 +827,17 @@ describe('FormField - Tests', () => {
it('should not allow mounting if unknown prop', (done) => {
// this event will automatically be unbound when this
// test ends because it's attached to 'cy'
let called = false
cy.on('uncaught:exception', (err) => {
if (!called) {
// ensure the error is about an unknown field
expect(err.message).to.include('unknown')

// using mocha's async done callback to finish
// this test so we prove that an uncaught exception
// was thrown
done()
expect(err.message).to.include('unknown')
called = true
// using mocha's async done callback to finish
// this test so we prove that an uncaught exception
// was thrown
done()
}

// return false to prevent the error from
// failing this test
Expand All @@ -850,9 +853,13 @@ describe('FormField - Tests', () => {
})

it('errors if required prop not given', (done) => {
let called = false
cy.on('uncaught:exception', (err) => {
expect(err.message).to.include('id')
done()
if (!called) {
expect(err.message).to.include('id')
called = true
done()
}
return false
})

Expand All @@ -865,9 +872,13 @@ describe('FormField - Tests', () => {
})

it('errors based on custom validation', (done) => {
let called = false
cy.on('uncaught:exception', (err) => {
expect(err.message).to.include('example failure')
done()
if (!called) {
expect(err.message).to.include('example failure')
called = true
done()
}
return false
})

Expand Down
Loading
Loading