From 5e07b733472a2b63337a8dc8e3cb10bd205b4756 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 10 Aug 2021 14:11:45 +0200 Subject: [PATCH 1/3] fix: seems the api team changed the response to a 200 --- .../view/view_errors/error_while_show_description.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/view/view_errors/error_while_show_description.js b/cypress/integration/view/view_errors/error_while_show_description.js index 07e09ffd3..3e32b08a0 100644 --- a/cypress/integration/view/view_errors/error_while_show_description.js +++ b/cypress/integration/view/view_errors/error_while_show_description.js @@ -12,7 +12,7 @@ before(() => { 'content-type': 'application/json', }, body: 'false', - }).then(response => expect(response.status).to.equal(201)) + }).then(response => expect(response.status).to.equal(200)) }) When('clicking to show description fails', () => { From 1a02a4a6bdcbd3787391593a775d904bde0f41f8 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 10 Aug 2021 14:19:20 +0200 Subject: [PATCH 2/3] fix: seems the api team changed the response to a 200 --- cypress/integration/edit/edit_dashboard/show_description.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/edit/edit_dashboard/show_description.js b/cypress/integration/edit/edit_dashboard/show_description.js index 56f9809c3..91bb1933c 100644 --- a/cypress/integration/edit/edit_dashboard/show_description.js +++ b/cypress/integration/edit/edit_dashboard/show_description.js @@ -11,7 +11,7 @@ before(() => { 'content-type': 'application/json', }, body: 'false', - }).then(response => expect(response.status).to.equal(201)) + }).then(response => expect(response.status).to.equal(200)) }) When('I click to show description', () => { From 1f1e607908e2d683930d75a2299bf85c8c246431 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Wed, 11 Aug 2021 10:59:21 +0200 Subject: [PATCH 3/3] fix: more places with resp code --- .../edit/edit_dashboard/show_description.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/cypress/integration/edit/edit_dashboard/show_description.js b/cypress/integration/edit/edit_dashboard/show_description.js index 91bb1933c..22f35719a 100644 --- a/cypress/integration/edit/edit_dashboard/show_description.js +++ b/cypress/integration/edit/edit_dashboard/show_description.js @@ -2,6 +2,9 @@ import { When, Then } from 'cypress-cucumber-preprocessor/steps' import { clickViewActionButton } from '../../../elements/viewDashboard' import { getApiBaseUrl } from '../../../support/server/utils' +const SHOW_DESC_RESP_CODE_SUCCESS = 200 +const SHOW_DESC_RESP_CODE_FAIL = 409 + before(() => { //ensure that the description is not currently shown cy.request({ @@ -11,7 +14,9 @@ before(() => { 'content-type': 'application/json', }, body: 'false', - }).then(response => expect(response.status).to.equal(200)) + }).then(response => + expect(response.status).to.equal(SHOW_DESC_RESP_CODE_SUCCESS) + ) }) When('I click to show description', () => { @@ -22,27 +27,31 @@ When('I click to show description', () => { clickViewActionButton('More') cy.contains('Show description').click() - cy.wait('@toggleDescription').its('response.statusCode').should('eq', 201) + cy.wait('@toggleDescription') + .its('response.statusCode') + .should('eq', SHOW_DESC_RESP_CODE_SUCCESS) }) When('I click to hide the description', () => { clickViewActionButton('More') cy.contains('Hide description').click() - cy.wait('@toggleDescription').its('response.statusCode').should('eq', 201) + cy.wait('@toggleDescription') + .its('response.statusCode') + .should('eq', SHOW_DESC_RESP_CODE_SUCCESS) }) // Error scenario When('clicking to show description fails', () => { cy.intercept('PUT', 'userDataStore/dashboard/showDescription', { - statusCode: 409, + statusCode: SHOW_DESC_RESP_CODE_FAIL, }).as('showDescriptionFails') clickViewActionButton('More') cy.contains('Show description').click() cy.wait('@showDescriptionFails') .its('response.statusCode') - .should('eq', 409) + .should('eq', SHOW_DESC_RESP_CODE_FAIL) }) Then(