+
+Cypress.Commands.add(
+ "createLink", (token, data) => {
+ return cy.createResource(token, 'links', {
+ link: JSON.stringify(data)
+ })
+ }
+)
+
+Cypress.Commands.add(
+ "createGroup", (token, data) => {
+ return cy.createResource(token, 'groups', {
+ group: JSON.stringify(data),
+ ensure_unique_name: true
+ })
+ }
+)
+
+Cypress.Commands.add(
+ "createCollection", (token, data) => {
+ return cy.createResource(token, 'collections', {
+ collection: JSON.stringify(data),
+ ensure_unique_name: true
+ })
+ }
+)
+
+Cypress.Commands.add(
+ "createResource", (token, suffix, data) => {
+ return cy.doRequest('POST', '/arvados/v1/'+suffix, data, null, token, true)
+ .its('body').as('resource')
+ .then(function() {
+ return this.resource;
+ })
+ }
+)
+
+Cypress.Commands.add(
+ "loginAs", (user) => {
+ cy.visit(`/token/?api_token=${user.token}`);
+ cy.url().should('contain', '/projects/');
+ cy.get('div#root').should('contain', 'Arvados Workbench (zzzzz)');
+ cy.get('div#root').should('not.contain', 'Your account is inactive');
+ }
+)
\ No newline at end of file