Changeset View
Changeset View
Standalone View
Standalone View
cypress/integration/vault.spec.js
Show All 30 Lines | .then(() => { | ||||
window.localStorage.setItem('swh-vault-cooking-tasks', JSON.stringify(vaultItems)); | window.localStorage.setItem('swh-vault-cooking-tasks', JSON.stringify(vaultItems)); | ||||
}); | }); | ||||
} | } | ||||
// Mocks API response : /api/1/vault/(:objectType)/(:hash) | // Mocks API response : /api/1/vault/(:objectType)/(:hash) | ||||
// objectType : {'directory', 'revision'} | // objectType : {'directory', 'revision'} | ||||
function genVaultCookingResponse(objectType, objectId, status, message, fetchUrl) { | function genVaultCookingResponse(objectType, objectId, status, message, fetchUrl) { | ||||
return { | return { | ||||
'obj_type': objectType, | 'type': objectType, | ||||
'id': 1, | 'id': 1, | ||||
'progress_message': message, | 'progress_msg': message, | ||||
'status': status, | 'task_status': status, | ||||
'obj_id': objectId, | 'object_id': objectId, | ||||
'fetch_url': fetchUrl | 'fetch_url': fetchUrl | ||||
}; | }; | ||||
}; | }; | ||||
// Tests progressbar color, status | // Tests progressbar color, status | ||||
// And status in localStorage | // And status in localStorage | ||||
function testStatus(taskId, color, statusMsg, status) { | function testStatus(taskId, color, statusMsg, status) { | ||||
cy.get(`.swh-vault-table #vault-task-${taskId}`) | cy.get(`.swh-vault-table #vault-task-${taskId}`) | ||||
Show All 23 Lines | before(function() { | ||||
this.vaultFetchDirectoryUrl = this.Urls.api_1_vault_fetch_directory(this.directory); | this.vaultFetchDirectoryUrl = this.Urls.api_1_vault_fetch_directory(this.directory); | ||||
this.revision = this.origin[1].revisions[0]; | this.revision = this.origin[1].revisions[0]; | ||||
this.revisionUrl = this.Urls.browse_revision(this.revision); | this.revisionUrl = this.Urls.browse_revision(this.revision); | ||||
this.vaultRevisionUrl = this.Urls.api_1_vault_cook_revision_gitfast(this.revision); | this.vaultRevisionUrl = this.Urls.api_1_vault_cook_revision_gitfast(this.revision); | ||||
this.vaultFetchRevisionUrl = this.Urls.api_1_vault_fetch_revision_gitfast(this.revision); | this.vaultFetchRevisionUrl = this.Urls.api_1_vault_fetch_revision_gitfast(this.revision); | ||||
vaultItems[0] = { | vaultItems[0] = { | ||||
'object_type': 'revision', | 'type': 'revision', | ||||
'object_id': this.revision, | 'object_id': this.revision, | ||||
'email': '', | 'email': '', | ||||
'status': 'done', | 'task_status': 'done', | ||||
'fetch_url': `/api/1/vault/revision/${this.revision}/gitfast/raw/`, | 'fetch_url': `/api/1/vault/revision/${this.revision}/gitfast/raw/`, | ||||
'progress_message': null | 'progress_msg': null | ||||
}; | }; | ||||
}); | }); | ||||
beforeEach(function() { | beforeEach(function() { | ||||
this.genVaultDirCookingResponse = (status, message = null) => { | this.genVaultDirCookingResponse = (status, message = null) => { | ||||
return genVaultCookingResponse('directory', this.directory, status, | return genVaultCookingResponse('directory', this.directory, status, | ||||
message, this.vaultFetchDirectoryUrl); | message, this.vaultFetchDirectoryUrl); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 425 Lines • Show Last 20 Lines |