From 1e271656de8a29dfcc80e0318901c58eae866d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20R=C3=B6tsch?= Date: Mon, 6 Nov 2017 12:21:16 +0100 Subject: [PATCH] test(e2e): adjust tests to fit refactored version of the app --- test/e2e/run-e2e-test.js | 4 ++-- test/e2e/specs/the-example-app-spec.js | 32 +++++++++++++------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/e2e/run-e2e-test.js b/test/e2e/run-e2e-test.js index 63600de..c2e35b0 100644 --- a/test/e2e/run-e2e-test.js +++ b/test/e2e/run-e2e-test.js @@ -12,7 +12,7 @@ app.set('port', TEST_PORT) const server = http.createServer(app) -const { CF_SPACE, CF_ACCESS_TOKEN, CF_PREVIEW_ACCESS_TOKEN } = process.env +const { CONTENTFUL_SPACE_ID, CONTENTFUL_DELIVERY_TOKEN, CONTENTFUL_PREVIEW_TOKEN } = process.env server.on('error', console.error) server.listen(TEST_PORT, function () { @@ -20,7 +20,7 @@ server.listen(TEST_PORT, function () { spec: resolve(__dirname, 'specs', 'the-example-app-spec.js'), headed: !process.env.CI, env: { - CF_SPACE, CF_ACCESS_TOKEN, CF_PREVIEW_ACCESS_TOKEN + CONTENTFUL_SPACE_ID, CONTENTFUL_DELIVERY_TOKEN, CONTENTFUL_PREVIEW_TOKEN } }) .then(() => { diff --git a/test/e2e/specs/the-example-app-spec.js b/test/e2e/specs/the-example-app-spec.js index 04a596a..62dabb9 100644 --- a/test/e2e/specs/the-example-app-spec.js +++ b/test/e2e/specs/the-example-app-spec.js @@ -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')