Skip to content

Commit

Permalink
test: allow both 200 and 201 in response
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Apr 9, 2024
1 parent 6d7594f commit af23649
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions cypress/integration/edit/edit_dashboard/show_description.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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])
)
})

Expand All @@ -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', () => {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit af23649

Please sign in to comment.