Changeset View
Changeset View
Standalone View
Standalone View
cypress/e2e/vault.cy.js
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | beforeEach(function() { | ||||
this.genVaultRevCookingResponse = (status, message = null) => { | this.genVaultRevCookingResponse = (status, message = null) => { | ||||
return genVaultCookingResponse('git_bare', this.revision, status, | return genVaultCookingResponse('git_bare', this.revision, status, | ||||
message, this.vaultFetchRevisionUrl); | message, this.vaultFetchRevisionUrl); | ||||
}; | }; | ||||
}); | }); | ||||
it('should report pending cooking task when already submitted', function() { | |||||
// Browse a directory | |||||
cy.visit(this.directoryUrl); | |||||
// Stub responses when requesting the vault API to simulate | |||||
// an internal server error | |||||
cy.intercept(this.vaultDirectoryUrl, { | |||||
body: this.genVaultDirCookingResponse('pending', 'Processing...') | |||||
}).as('checkVaultCookingTask'); | |||||
cy.intercept('POST', this.vaultDirectoryUrl, { | |||||
body: this.genVaultDirCookingResponse('pending', 'Processing...') | |||||
}).as('createVaultCookingTask'); | |||||
cy.contains('button', 'Download') | |||||
.click(); | |||||
// Create a vault cooking task through the GUI | |||||
cy.get('.modal-dialog') | |||||
.contains('button:visible', 'Ok') | |||||
.click(); | |||||
cy.wait('@createVaultCookingTask'); | |||||
// Check success alert is displayed | |||||
cy.get('.alert-success') | |||||
.should('be.visible') | |||||
.should('contain', 'Archive cooking request successfully submitted.'); | |||||
// Go to Downloads page | |||||
cy.visit(this.Urls.vault()); | |||||
cy.wait('@checkVaultCookingTask').then(() => { | |||||
testStatus(this.directory, progressbarColors['pending'], 'Processing...', 'pending'); | |||||
}); | |||||
}); | |||||
it('should report an error when vault service is experiencing issues', function() { | it('should report an error when vault service is experiencing issues', function() { | ||||
// Browse a directory | // Browse a directory | ||||
cy.visit(this.directoryUrl); | cy.visit(this.directoryUrl); | ||||
// Stub responses when requesting the vault API to simulate | // Stub responses when requesting the vault API to simulate | ||||
// an internal server error | // an internal server error | ||||
cy.intercept(this.vaultDirectoryUrl, { | cy.intercept(this.vaultDirectoryUrl, { | ||||
body: {'exception': 'APIError'}, | body: {'exception': 'APIError'}, | ||||
statusCode: 500 | statusCode: 500 | ||||
}).as('checkVaultCookingTask'); | }).as('checkVaultCookingTask'); | ||||
cy.contains('button', 'Download') | cy.contains('button', 'Download') | ||||
.click(); | .click(); | ||||
// Check error alert is displayed | // Check error alert is displayed | ||||
cy.get('.alert-danger') | cy.get('.alert-danger') | ||||
.should('be.visible') | .should('be.visible') | ||||
.should('contain', 'Archive cooking service is currently experiencing issues.'); | .should('contain', 'Something unexpected happened when requesting the archive cooking service.'); | ||||
}); | }); | ||||
it('should report an error when a cooking task creation failed', function() { | it('should report an error when a cooking task creation failed', function() { | ||||
// Browse a directory | // Browse a directory | ||||
cy.visit(this.directoryUrl); | cy.visit(this.directoryUrl); | ||||
// Stub responses when requesting the vault API to simulate | // Stub responses when requesting the vault API to simulate | ||||
▲ Show 20 Lines • Show All 434 Lines • Show Last 20 Lines |