From af2364992b5ffaab0fe13d5697ebb890b8582f7c Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 9 Apr 2024 11:58:10 +0200 Subject: [PATCH] test: allow both 200 and 201 in response --- .../integration/edit/edit_dashboard/show_description.js | 9 +++++---- .../view/view_dashboard/toggle_show_more_dashboards.js | 2 +- .../view/view_errors/error_while_show_description.js | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cypress/integration/edit/edit_dashboard/show_description.js b/cypress/integration/edit/edit_dashboard/show_description.js index 5d56f918b..6be5cd353 100644 --- a/cypress/integration/edit/edit_dashboard/show_description.js +++ b/cypress/integration/edit/edit_dashboard/show_description.js @@ -2,7 +2,8 @@ import { When, Then } from 'cypress-cucumber-preprocessor/steps' import { clickViewActionButton } from '../../../elements/viewDashboard.js' import { getApiBaseUrl } from '../../../support/server/utils.js' -const SHOW_DESC_RESP_CODE_SUCCESS = 201 +const RESP_CODE_200 = 200 +const RESP_CODE_201 = 201 const SHOW_DESC_RESP_CODE_FAIL = 409 before(() => { @@ -15,7 +16,7 @@ before(() => { }, body: 'false', }).then((response) => - expect(response.status).to.equal(SHOW_DESC_RESP_CODE_SUCCESS) + expect(response.status).to.be.oneOf([RESP_CODE_201, RESP_CODE_200]) ) }) @@ -29,7 +30,7 @@ When('I click to show description', () => { cy.wait('@toggleDescription') .its('response.statusCode') - .should('eq', SHOW_DESC_RESP_CODE_SUCCESS) + .should('be.oneOf', [RESP_CODE_200, RESP_CODE_201]) }) When('I click to hide the description', () => { @@ -38,7 +39,7 @@ When('I click to hide the description', () => { cy.wait('@toggleDescription') .its('response.statusCode') - .should('eq', SHOW_DESC_RESP_CODE_SUCCESS) + .should('be.oneOf', [RESP_CODE_200, RESP_CODE_201]) }) // Error scenario diff --git a/cypress/integration/view/view_dashboard/toggle_show_more_dashboards.js b/cypress/integration/view/view_dashboard/toggle_show_more_dashboards.js index b1dad68a1..25579ee52 100644 --- a/cypress/integration/view/view_dashboard/toggle_show_more_dashboards.js +++ b/cypress/integration/view/view_dashboard/toggle_show_more_dashboards.js @@ -18,7 +18,7 @@ beforeEach(() => { 'content-type': 'application/json', }, body: '1', - }).then((response) => expect(response.status).to.equal(201)) + }).then((response) => expect(response.status).to.be.oneOf([200, 201])) }) When('I toggle show more dashboards', () => { 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 e63549f04..367be68cd 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.be.oneOf([200, 201])) }) When('clicking to show description fails', () => {