Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the response code for PUT userDataStore has been changed from 201 to 200 #1896

Merged
merged 5 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions cypress/integration/edit/edit_dashboard/show_description.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -11,7 +14,9 @@ before(() => {
'content-type': 'application/json',
},
body: 'false',
}).then(response => expect(response.status).to.equal(201))
}).then(response =>
expect(response.status).to.equal(SHOW_DESC_RESP_CODE_SUCCESS)
)
})

When('I click to show description', () => {
Expand All @@ -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(
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.equal(200))
})

When('clicking to show description fails', () => {
Expand Down