test(e2e): adjust tests to fit refactored version of the app

This commit is contained in:
Benedikt Rötsch
2017-11-06 12:21:16 +01:00
committed by Benedikt Rötsch
parent c7567ca895
commit 1e271656de
2 changed files with 18 additions and 18 deletions

View File

@@ -176,55 +176,55 @@ describe('The Example App', () => {
.invoke('text').then((text) => {
expect(text).to.match(/Connected to space “.+”/)
})
cy.get('input#input-space').should('have.value', Cypress.env('CF_SPACE'))
cy.get('input#input-cda').should('have.value', Cypress.env('CF_ACCESS_TOKEN'))
cy.get('input#input-cpa').should('have.value', Cypress.env('CF_PREVIEW_ACCESS_TOKEN'))
cy.get('input#input-space-id').should('have.value', Cypress.env('CONTENTFUL_SPACE_ID'))
cy.get('input#input-delivery-token').should('have.value', Cypress.env('CONTENTFUL_DELIVERY_TOKEN'))
cy.get('input#input-preview-token').should('have.value', Cypress.env('CONTENTFUL_PREVIEW_TOKEN'))
})
it('checks for required fields', () => {
cy.get('input#input-space').clear()
cy.get('input#input-cda').clear()
cy.get('input#input-cpa').clear()
cy.get('input#input-space-id').clear()
cy.get('input#input-delivery-token').clear()
cy.get('input#input-preview-token').clear()
cy.get('input[type=submit]').click()
cy.get('.status-block--info').should('not.exist')
cy.get('.status-block--success').should('not.exist')
cy.get('.status-block--error').should('exist')
cy.get('input#input-space').parent().children('.form-item__error-wrapper')
cy.get('input#input-space-id').parent().children('.form-item__error-wrapper')
.should('exist')
.find('.form-item__error-message')
.should('have.text', 'This field is required')
cy.get('input#input-cda').parent().children('.form-item__error-wrapper')
cy.get('input#input-delivery-token').parent().children('.form-item__error-wrapper')
.should('exist')
.find('.form-item__error-message')
.should('have.text', 'This field is required')
cy.get('input#input-cpa').parent().children('.form-item__error-wrapper')
cy.get('input#input-preview-token').parent().children('.form-item__error-wrapper')
.should('exist')
.find('.form-item__error-message')
.should('have.text', 'This field is required')
})
it('validates field with actual client', () => {
cy.get('input#input-space').clear().type(Math.random().toString(36).substring(12))
cy.get('input#input-cda').clear().type(Math.random().toString(36))
cy.get('input#input-cpa').clear().type(Math.random().toString(36))
cy.get('input#input-space-id').clear().type(Math.random().toString(36).substring(12))
cy.get('input#input-delivery-token').clear().type(Math.random().toString(36))
cy.get('input#input-preview-token').clear().type(Math.random().toString(36))
cy.get('input[type=submit]').click()
cy.get('.status-block--info').should('not.exist')
cy.get('.status-block--success').should('not.exist')
cy.get('.status-block--error').should('exist')
cy.get('input#input-cda').parent().children('.form-item__error-wrapper')
cy.get('input#input-delivery-token').parent().children('.form-item__error-wrapper')
.should('exist')
.find('.form-item__error-message')
.should('have.text', 'Your Delivery API key is invalid.')
})
it('shows success message when valid credentials are supplied', () => {
cy.get('input#input-space').clear().type(Cypress.env('CF_SPACE'))
cy.get('input#input-cda').clear().type(Cypress.env('CF_ACCESS_TOKEN'))
cy.get('input#input-cpa').clear().type(Cypress.env('CF_PREVIEW_ACCESS_TOKEN'))
cy.get('input#input-space-id').clear().type(Cypress.env('CONTENTFUL_SPACE_ID'))
cy.get('input#input-delivery-token').clear().type(Cypress.env('CONTENTFUL_DELIVERY_TOKEN'))
cy.get('input#input-preview-token').clear().type(Cypress.env('CONTENTFUL_PREVIEW_TOKEN'))
cy.get('input[type=submit]').click()
cy.get('.status-block--info').should('exist')