}
)
+Cypress.Commands.add(
+ "getCollection", (token, uuid) => {
+ return cy.getResource(token, 'collections', uuid)
+ }
+)
+
Cypress.Commands.add(
"createCollection", (token, data) => {
return cy.createResource(token, 'collections', {
}
)
+Cypress.Commands.add(
+ "getContainer", (token, uuid) => {
+ return cy.getResource(token, 'containers', uuid)
+ }
+)
+
+Cypress.Commands.add(
+ "updateContainer", (token, uuid, data) => {
+ return cy.updateResource(token, 'containers', uuid, {
+ container: JSON.stringify(data)
+ })
+ }
+)
+
+Cypress.Commands.add(
+ 'createContainerRequest', (token, data) => {
+ return cy.createResource(token, 'container_requests', {
+ container_request: JSON.stringify(data),
+ ensure_unique_name: true
+ })
+ }
+)
+
+Cypress.Commands.add(
+ "updateContainerRequest", (token, uuid, data) => {
+ return cy.updateResource(token, 'container_requests', uuid, {
+ container_request: JSON.stringify(data)
+ })
+ }
+)
+
+Cypress.Commands.add(
+ "createLog", (token, data) => {
+ return cy.createResource(token, 'logs', {
+ log: JSON.stringify(data)
+ })
+ }
+)
+
+Cypress.Commands.add(
+ "logsForContainer", (token, uuid, logType, logTextArray = []) => {
+ let logs = [];
+ for (const logText of logTextArray) {
+ logs.push(cy.createLog(token, {
+ object_uuid: uuid,
+ event_type: logType,
+ properties: {
+ text: logText
+ }
+ }).as('lastLogRecord'))
+ }
+ cy.getAll('@lastLogRecord').then(function () {
+ return logs;
+ })
+ }
+)
+
+Cypress.Commands.add(
+ "createVirtualMachine", (token, data) => {
+ return cy.createResource(token, 'virtual_machines', {
+ virtual_machine: JSON.stringify(data),
+ ensure_unique_name: true
+ })
+ }
+)
+
+Cypress.Commands.add(
+ "getResource", (token, suffix, uuid) => {
+ return cy.doRequest('GET', `/arvados/v1/${suffix}/${uuid}`, null, {}, token)
+ .its('body')
+ .then(function (resource) {
+ return resource;
+ })
+ }
+)
+
Cypress.Commands.add(
"createResource", (token, suffix, data) => {
return cy.doRequest('POST', '/arvados/v1/' + suffix, data, null, token, true)
- .its('body').as('resource')
- .then(function () {
- createdResources.push({suffix, uuid: this.resource.uuid});
- return this.resource;
+ .its('body')
+ .then(function (resource) {
+ createdResources.push({suffix, uuid: resource.uuid});
+ return resource;
})
}
)
Cypress.Commands.add(
"deleteResource", (token, suffix, uuid, failOnStatusCode = true) => {
return cy.doRequest('DELETE', '/arvados/v1/' + suffix + '/' + uuid, null, null, token, false, true, failOnStatusCode)
- .its('body').as('resource')
- .then(function () {
- return this.resource;
+ .its('body')
+ .then(function (resource) {
+ return resource;
})
}
)
Cypress.Commands.add(
"updateResource", (token, suffix, uuid, data) => {
- return cy.doRequest('PUT', '/arvados/v1/' + suffix + '/' + uuid, data, null, token, true)
- .its('body').as('resource')
- .then(function () {
- return this.resource;
+ return cy.doRequest('PATCH', '/arvados/v1/' + suffix + '/' + uuid, data, null, token, true)
+ .its('body')
+ .then(function (resource) {
+ return resource;
})
}
)
const blob = new Blob(byteArrays, { type: contentType });
return blob
-}
\ No newline at end of file
+}