Changeset View
Changeset View
Standalone View
Standalone View
cypress/e2e/add-forge-now-request-dashboard.cy.js
Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | cy.get('#decisionOptions') | ||||
.children() | .children() | ||||
.should('have.length', 4); | .should('have.length', 4); | ||||
}); | }); | ||||
}); | }); | ||||
function populateAndSubmitForm() { | function populateAndSubmitForm() { | ||||
cy.get('#decisionOptions').select('WAITING_FOR_FEEDBACK'); | cy.get('#decisionOptions').select('WAITING_FOR_FEEDBACK'); | ||||
cy.get('#updateComment').type('This is an update comment'); | cy.get('#updateComment').type('This is an update comment'); | ||||
cy.get('#updateRequestForm').submit(); | cy.get('#updateRequestForm button[type=submit]').click(); | ||||
} | } | ||||
describe('Test add forge now request update', function() { | describe('Test add forge now request update', function() { | ||||
beforeEach(function() { | beforeEach(function() { | ||||
createDummyRequest(this.Urls).then(() => { | createDummyRequest(this.Urls).then(() => { | ||||
this.url = this.Urls.add_forge_now_request_dashboard(requestId); | this.url = this.Urls.add_forge_now_request_dashboard(requestId); | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | describe('Test add forge now request update', function() { | ||||
}); | }); | ||||
it('should show an error on API failure', function() { | it('should show an error on API failure', function() { | ||||
cy.intercept('POST', | cy.intercept('POST', | ||||
`${this.Urls.api_1_add_forge_request_update(requestId)}**`, | `${this.Urls.api_1_add_forge_request_update(requestId)}**`, | ||||
{forceNetworkError: true}) | {forceNetworkError: true}) | ||||
.as('updateFailedRequest'); | .as('updateFailedRequest'); | ||||
cy.get('#updateComment').type('This is an update comment'); | cy.get('#updateComment').type('This is an update comment'); | ||||
cy.get('#updateRequestForm').submit(); | cy.get('#updateRequestForm button[type=submit]').click(); | ||||
cy.wait('@updateFailedRequest'); | cy.wait('@updateFailedRequest'); | ||||
cy.get('#userMessage') | cy.get('#userMessage') | ||||
.should('contain', 'Sorry; Updating the request failed') | .should('contain', 'Sorry; Updating the request failed') | ||||
.should('have.class', 'badge-danger') | .should('have.class', 'badge-danger') | ||||
.should('not.have.class', 'badge-success'); | .should('not.have.class', 'badge-success'); | ||||
}); | }); | ||||
}); | }); |