Skip to content

Commit

Permalink
BAU Fix failing cypress tests
Browse files Browse the repository at this point in the history
govuk-frontend v3.1.0 removed the default type attribute on the button
element as it was unnecessary.

alphagov/govuk-frontend#1538

Some of our cypress tests used the type attribute in the selector, so remove
this to get them passing.
  • Loading branch information
stephencdaly committed Oct 9, 2019
1 parent 688a588 commit 3896e08
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 96 deletions.
32 changes: 16 additions & 16 deletions test/cypress/integration/payment-links/create_payment_link_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('The create payment link flow', () => {

cy.get('div#payment-link-title-confirmation').should('not.exist')

cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('exist').within(() => {
Expand All @@ -88,7 +88,7 @@ describe('The create payment link flow', () => {

it('Should continue to the reference page', () => {
cy.get('form[method=post][action="/create-payment-link/information"]').within(() => {
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('The create payment link flow', () => {
cy.get('textarea#reference-hint-text').parent('.govuk-form-group').get('span')
.should('contain', 'Tell users what the')

cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('exist').within(() => {
Expand All @@ -131,7 +131,7 @@ describe('The create payment link flow', () => {
.within(() => {
cy.get('input#reference-label').type(referenceName)
cy.get('textarea#reference-hint-text').type(referenceHint)
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand All @@ -147,7 +147,7 @@ describe('The create payment link flow', () => {
cy.get('input[type=radio]#amount-type-fixed').should('exist')
cy.get('input[type=radio]#amount-type-variable').should('exist')
cy.get('input#payment-amount').should('exist')
cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('exist').within(() => {
Expand All @@ -161,7 +161,7 @@ describe('The create payment link flow', () => {
.within(() => {
cy.get('input[type=radio]#amount-type-fixed').click()
cy.get('input#payment-amount').type(amount)
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('The create payment link flow', () => {
cy.get('.govuk-summary-list__actions a').should('have.attr', 'href', '/create-payment-link/amount')
})

cy.get('button[type=submit]').should('exist').should('contain', 'Create payment link')
cy.get('button').should('exist').should('contain', 'Create payment link')
})

it('should redirect to information page when "Change" clicked', () => {
Expand Down Expand Up @@ -255,7 +255,7 @@ describe('The create payment link flow', () => {
cy.get('textarea#payment-link-description').parent('.govuk-form-group').get('span')
.should('contain', 'Give your users more information in Welsh')

cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('not.exist')
Expand All @@ -275,7 +275,7 @@ describe('The create payment link flow', () => {

it('Should continue to the reference page', () => {
cy.get('form[method=post][action="/create-payment-link/information"]').within(() => {
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('The create payment link flow', () => {
cy.get('textarea#reference-hint-text').parent('.govuk-form-group').get('span')
.should('contain', 'Explain in Welsh')

cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('not.exist')
Expand All @@ -314,7 +314,7 @@ describe('The create payment link flow', () => {
.within(() => {
cy.get('input#reference-label').type(referenceName)
cy.get('textarea#reference-hint-text').type(referenceHint)
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand All @@ -330,7 +330,7 @@ describe('The create payment link flow', () => {
cy.get('input[type=radio]#amount-type-fixed').should('exist')
cy.get('input[type=radio]#amount-type-variable').should('exist')
cy.get('input#payment-amount').should('exist')
cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('not.exist')
Expand All @@ -341,7 +341,7 @@ describe('The create payment link flow', () => {
.within(() => {
cy.get('input[type=radio]#amount-type-fixed').click()
cy.get('input#payment-amount').type(amount)
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand All @@ -352,7 +352,7 @@ describe('The create payment link flow', () => {

describe('Review page', () => {
it('should have Welsh-specific instructions', () => {
cy.get('button[type=submit]').should('exist').should('contain', 'Create Welsh payment link')
cy.get('button').should('exist').should('contain', 'Create Welsh payment link')
})

it('should redirect to information page when "Change" clicked', () => {
Expand All @@ -375,7 +375,7 @@ describe('The create payment link flow', () => {

it('should redirect to the review page when "Continue" is clicked', () => {
cy.get('form[method=post][action="/create-payment-link/information"]').within(() => {
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand All @@ -384,7 +384,7 @@ describe('The create payment link flow', () => {
})

it('should have Welsh-specific instructions', () => {
cy.get('button[type=submit]').should('exist').should('contain', 'Create Welsh payment link')
cy.get('button').should('exist').should('contain', 'Create Welsh payment link')
})
})

Expand Down
22 changes: 11 additions & 11 deletions test/cypress/integration/payment-links/edit_payment_link_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('Editing a payment link', () => {
cy.get('.govuk-summary-list__actions a').should('have.attr', 'href', `/create-payment-link/manage/edit/amount/${productId}`)
})

cy.get('button[type=submit]').should('exist').should('contain', 'Save changes')
cy.get('button').should('exist').should('contain', 'Save changes')
})

it('should navigate to edit information page', () => {
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('Editing a payment link', () => {

cy.get('div#payment-link-title-confirmation').should('not.exist')

cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('exist').within(() => {
Expand All @@ -122,7 +122,7 @@ describe('Editing a payment link', () => {

it('should navigate to edit details page when "Save changes" clicked', () => {
cy.get(`form[method=post][action="/create-payment-link/manage/edit/information/${productId}"]`).within(() => {
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand Down Expand Up @@ -156,7 +156,7 @@ describe('Editing a payment link', () => {
cy.get('textarea#reference-hint-text').parent('.govuk-form-group').get('span')
.should('contain', 'Tell users what the payment reference looks like and where they can find it.')

cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('exist').within(() => {
Expand All @@ -172,7 +172,7 @@ describe('Editing a payment link', () => {

it('should navigate to edit details page when "Save changes" clicked', () => {
cy.get(`form[method=post][action="/create-payment-link/manage/edit/reference/${productId}"]`).within(() => {
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand All @@ -194,7 +194,7 @@ describe('Editing a payment link', () => {
cy.get('input[type=radio]#amount-type-fixed').should('exist')
cy.get('input[type=radio]#amount-type-variable').should('exist')
cy.get('input#payment-amount').should('exist')
cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('exist').within(() => {
Expand All @@ -212,7 +212,7 @@ describe('Editing a payment link', () => {

it('should navigate to edit details page when "Save changes" clicked', () => {
cy.get(`form[method=post][action="/create-payment-link/manage/edit/amount/${productId}"]`).within(() => {
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand Down Expand Up @@ -274,15 +274,15 @@ describe('Editing a payment link', () => {

cy.get('div#payment-link-title-confirmation').should('not.exist')

cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})

cy.get('#payment-link-example').should('not.exist')
})

it('should navigate to edit details page when "Save changes" clicked', () => {
cy.get(`form[method=post][action="/create-payment-link/manage/edit/information/${productId}"]`).within(() => {
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand Down Expand Up @@ -316,13 +316,13 @@ describe('Editing a payment link', () => {
cy.get('textarea#reference-hint-text').parent('.govuk-form-group').get('span')
.should('contain', 'Explain in Welsh what the payment reference looks like and where to find it.')

cy.get('button[type=submit]').should('exist')
cy.get('button').should('exist')
})
})

it('should navigate to edit details page when "Save changes" clicked', () => {
cy.get(`form[method=post][action="/create-payment-link/manage/edit/reference/${productId}"]`).within(() => {
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('The organisation address page', () => {
.within(() => {
// create errors for all fields except country by leaving them blank or inputting invalid values
cy.get('#address-line2').type(longText, { delay: 0 })
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.get('.govuk-error-summary').find('a').should('have.length', 4)
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('The organisation address page', () => {
cy.get('#address-country').select(countryIe)
cy.get('#address-postcode').type(validPostcodeIe)
cy.get('#telephone-number').type(invalidTelephoneNumber)
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.get('.govuk-error-summary').find('a').should('have.length', 1)
Expand Down Expand Up @@ -135,7 +135,7 @@ describe('The organisation address page', () => {
cy.get('#address-country').select(countryGb)
cy.get('#address-postcode').type(invalidPostcode)
cy.get('#telephone-number').type(validTelephoneNumber)
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.get('.govuk-error-summary').find('a').should('have.length', 1)
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('The organisation address page', () => {
cy.get('#address-country').select(countryGb)
cy.get('#address-postcode').type(validPostcodeGb)
cy.get('#telephone-number').type(validTelephoneNumber)
cy.get('button[type=submit]').click()
cy.get('button').click()
})

cy.location().should((location) => {
Expand Down
20 changes: 10 additions & 10 deletions test/cypress/integration/stripe-setup/bank_details_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ describe('Stripe setup: bank details page', () => {
.within(() => {
cy.get('input#account-number').should('exist')
cy.get('input#sort-code').should('exist')
cy.get('button[type=submit]').should('exist')
cy.get('button[type=submit]').should('contain', 'Continue')
cy.get('button').should('exist')
cy.get('button').should('contain', 'Continue')
})
})

it('should display an error when all fields are blank', () => {
cy.get('#bank-details-form > button[type=submit]').click()
cy.get('#bank-details-form > button').click()

cy.get('h2').should('contain', 'There was a problem with the details you gave for:')
cy.get('ul.govuk-error-summary__list > li:nth-child(1) > a').should('contain', 'Account number')
Expand All @@ -104,7 +104,7 @@ describe('Stripe setup: bank details page', () => {
cy.get('input#account-number[name="account-number"]').type('abc')
cy.get('input#sort-code[name="sort-code"]').type(sortCode)

cy.get('#bank-details-form > button[type=submit]').click()
cy.get('#bank-details-form > button').click()

cy.get('h2').should('contain', 'There was a problem with the details you gave for:')
cy.get('ul.govuk-error-summary__list > li:nth-child(1) > a').should('contain', 'Account number')
Expand All @@ -118,7 +118,7 @@ describe('Stripe setup: bank details page', () => {
cy.get('input#account-number[name="account-number"]').type(accountNumber)
cy.get('input#sort-code[name="sort-code"]').type('abc')

cy.get('#bank-details-form > button[type=submit]').click()
cy.get('#bank-details-form > button').click()

cy.get('h2').should('contain', 'There was a problem with the details you gave for:')
cy.get('ul.govuk-error-summary__list > li:nth-child(1) > a').should('contain', 'Sort code')
Expand All @@ -132,7 +132,7 @@ describe('Stripe setup: bank details page', () => {
cy.get('input#account-number[name="account-number"]').type(accountNumber)
cy.get('input#sort-code[name="sort-code"]').type(sortCode)

cy.get('#bank-details-form > button[type=submit]').click()
cy.get('#bank-details-form > button').click()

cy.get('#account-number-value').should('contain', accountNumber)
cy.get('#sort-code-value').should('contain', displaySortCode)
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('Stripe setup: bank details page', () => {

cy.get('input#account-number[name="account-number"]').type(accountNumber)
cy.get('input#sort-code[name="sort-code"]').type(sortCode)
cy.get('#bank-details-form > button[type=submit]').click()
cy.get('#bank-details-form > button').click()

cy.get('h1').should('contain', 'Dashboard')
cy.location().should((location) => {
Expand All @@ -195,10 +195,10 @@ describe('Stripe setup: bank details page', () => {
// Bank details page
cy.get('input#account-number[name="account-number"]').type(accountNumber)
cy.get('input#sort-code[name="sort-code"]').type(sortCode)
cy.get('#bank-details-form > button[type=submit]').click()
cy.get('#bank-details-form > button').click()

// Check your answers page
cy.get('#bank-details-check-submit-form > button[type=submit]').click()
cy.get('#bank-details-check-submit-form > button').click()

// Dashboard page
cy.get('h1').should('contain', 'Dashboard')
Expand Down Expand Up @@ -268,7 +268,7 @@ describe('Stripe setup: bank details page', () => {

cy.get('input#account-number[name="account-number"]').type(accountNumber)
cy.get('input#sort-code[name="sort-code"]').type(sortCode)
cy.get('#bank-details-form > button[type=submit]').click()
cy.get('#bank-details-form > button').click()
})

it('should go to check your answers page when inputs are valid', () => {
Expand Down
Loading

0 comments on commit 3896e08

Please sign in to comment.