Changeset View
Changeset View
Standalone View
Standalone View
cypress/integration/vault.spec.js
Show First 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | describe('Vault Cooking User Interface Tests', function() { | ||||
it('should create a directory cooking task and report the success', function() { | it('should create a directory cooking task and report the success', function() { | ||||
// Browse a directory | // Browse a directory | ||||
cy.visit(this.directoryUrl); | cy.visit(this.directoryUrl); | ||||
// Stub response to the vault API to simulate archive download | // Stub response to the vault API to simulate archive download | ||||
cy.intercept('GET', this.vaultFetchDirectoryUrl, { | cy.intercept('GET', this.vaultFetchDirectoryUrl, { | ||||
fixture: `${this.directory}.tar.gz`, | fixture: `${this.directory.replace(/:/g, '_')}.tar.gz`, | ||||
headers: { | headers: { | ||||
'Content-disposition': `attachment; filename=${this.directory}.tar.gz`, | 'Content-disposition': `attachment; filename=${this.directory.replace(/:/g, '_')}.tar.gz`, | ||||
'Content-Type': 'application/gzip' | 'Content-Type': 'application/gzip' | ||||
} | } | ||||
}).as('fetchCookedArchive'); | }).as('fetchCookedArchive'); | ||||
// Stub responses when checking vault task status | // Stub responses when checking vault task status | ||||
const checkVaulResponses = [ | const checkVaulResponses = [ | ||||
{'exception': 'NotFoundExc'}, | {'exception': 'NotFoundExc'}, | ||||
this.genVaultDirCookingResponse('new'), | this.genVaultDirCookingResponse('new'), | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | describe('Vault Cooking User Interface Tests', function() { | ||||
it('should create a revision cooking task and report its status', function() { | it('should create a revision cooking task and report its status', function() { | ||||
cy.adminLogin(); | cy.adminLogin(); | ||||
// Browse a revision | // Browse a revision | ||||
cy.visit(this.revisionUrl); | cy.visit(this.revisionUrl); | ||||
// Stub response to the vault API indicating to simulate archive download | // Stub response to the vault API indicating to simulate archive download | ||||
cy.intercept({url: this.vaultFetchRevisionUrl}, { | cy.intercept({url: this.vaultFetchRevisionUrl}, { | ||||
fixture: `${this.revision}.git.tar`, | fixture: `${this.revision.replace(/:/g, '_')}.git.tar`, | ||||
headers: { | headers: { | ||||
'Content-disposition': `attachment; filename=${this.revision}.git.tar`, | 'Content-disposition': `attachment; filename=${this.revision.replace(/:/g, '_')}.git.tar`, | ||||
'Content-Type': 'application/gzip' | 'Content-Type': 'application/gzip' | ||||
} | } | ||||
}).as('fetchCookedArchive'); | }).as('fetchCookedArchive'); | ||||
// Stub responses when checking vault task status | // Stub responses when checking vault task status | ||||
const checkVaultResponses = [ | const checkVaultResponses = [ | ||||
{'exception': 'NotFoundExc'}, | {'exception': 'NotFoundExc'}, | ||||
this.genVaultRevCookingResponse('new'), | this.genVaultRevCookingResponse('new'), | ||||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | describe('Vault Cooking User Interface Tests', function() { | ||||
it('should offer to immediately download a directory tarball if already cooked', function() { | it('should offer to immediately download a directory tarball if already cooked', function() { | ||||
// Browse a directory | // Browse a directory | ||||
cy.visit(this.directoryUrl); | cy.visit(this.directoryUrl); | ||||
// Stub response to the vault API to simulate archive download | // Stub response to the vault API to simulate archive download | ||||
cy.intercept({url: this.vaultFetchDirectoryUrl}, { | cy.intercept({url: this.vaultFetchDirectoryUrl}, { | ||||
fixture: `${this.directory}.tar.gz`, | fixture: `${this.directory.replace(/:/g, '_')}.tar.gz`, | ||||
headers: { | headers: { | ||||
'Content-disposition': `attachment; filename=${this.directory}.tar.gz`, | 'Content-disposition': `attachment; filename=${this.directory.replace(/:/g, '_')}.tar.gz`, | ||||
'Content-Type': 'application/gzip' | 'Content-Type': 'application/gzip' | ||||
} | } | ||||
}).as('fetchCookedArchive'); | }).as('fetchCookedArchive'); | ||||
// Stub responses when requesting the vault API to simulate | // Stub responses when requesting the vault API to simulate | ||||
// the directory tarball has already been cooked | // the directory tarball has already been cooked | ||||
cy.intercept(this.vaultDirectoryUrl, { | cy.intercept(this.vaultDirectoryUrl, { | ||||
body: this.genVaultDirCookingResponse('done') | body: this.genVaultDirCookingResponse('done') | ||||
Show All 14 Lines | describe('Vault Cooking User Interface Tests', function() { | ||||
it('should offer to immediately download a bare revision git archive if already cooked', function() { | it('should offer to immediately download a bare revision git archive if already cooked', function() { | ||||
cy.adminLogin(); | cy.adminLogin(); | ||||
// Browse a directory | // Browse a directory | ||||
cy.visit(this.revisionUrl); | cy.visit(this.revisionUrl); | ||||
// Stub response to the vault API to simulate archive download | // Stub response to the vault API to simulate archive download | ||||
cy.intercept({url: this.vaultFetchRevisionUrl}, { | cy.intercept({url: this.vaultFetchRevisionUrl}, { | ||||
fixture: `${this.revision}.git.tar`, | fixture: `${this.revision.replace(/:/g, '_')}.git.tar`, | ||||
headers: { | headers: { | ||||
'Content-disposition': `attachment; filename=${this.revision}.git.tar`, | 'Content-disposition': `attachment; filename=${this.revision.replace(/:/g, '_')}.git.tar`, | ||||
'Content-Type': 'application/gzip' | 'Content-Type': 'application/gzip' | ||||
} | } | ||||
}).as('fetchCookedArchive'); | }).as('fetchCookedArchive'); | ||||
// Stub responses when requesting the vault API to simulate | // Stub responses when requesting the vault API to simulate | ||||
// the directory tarball has already been cooked | // the directory tarball has already been cooked | ||||
cy.intercept(this.vaultRevisionUrl, { | cy.intercept(this.vaultRevisionUrl, { | ||||
body: this.genVaultRevCookingResponse('done') | body: this.genVaultRevCookingResponse('done') | ||||
Show All 33 Lines |