X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/9ee35a64c605f116aec71f78c65b54730d6e1076..df5bb74b46652b2e0a73a0e9ef2c09a63314e409:/cypress/integration/collection-panel.spec.js diff --git a/cypress/integration/collection-panel.spec.js b/cypress/integration/collection-panel.spec.js index 404d1c5b..466d7433 100644 --- a/cypress/integration/collection-panel.spec.js +++ b/cypress/integration/collection-panel.spec.js @@ -21,12 +21,12 @@ describe('Collection panel tests', function() { activeUser = this.activeUser; } ); - }) + }); beforeEach(function() { - cy.clearCookies() - cy.clearLocalStorage() - }) + cy.clearCookies(); + cy.clearLocalStorage(); + }); it('shows collection by URL', function() { cy.loginAs(activeUser); @@ -128,8 +128,64 @@ describe('Collection panel tests', function() { }) }) + it('renames a file', function() { + // Creates the collection using the admin token so we can set up + // a bogus manifest text without block signatures. + cy.createCollection(adminUser.token, { + name: `Test collection ${Math.floor(Math.random() * 999999)}`, + owner_uuid: activeUser.user.uuid, + manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"}) + .as('testCollection').then(function() { + cy.loginAs(activeUser); + cy.visit(`/collections/${this.testCollection.uuid}`); + cy.get('[data-cy=collection-files-panel]') + .contains('bar').rightclick(); + cy.get('[data-cy=context-menu]') + .contains('Rename') + .click(); + cy.get('[data-cy=form-dialog]') + .should('contain', 'Rename') + .within(() => { + cy.get('input').type('{backspace}{backspace}{backspace}foo'); + }); + cy.get('[data-cy=form-submit-btn]').click(); + cy.get('[data-cy=collection-files-panel]') + .should('not.contain', 'bar') + .and('contain', 'foo'); + }); + }); + + it('tries to rename a file with an illegal name', function() { + // Creates the collection using the admin token so we can set up + // a bogus manifest text without block signatures. + cy.createCollection(adminUser.token, { + name: `Test collection ${Math.floor(Math.random() * 999999)}`, + owner_uuid: activeUser.user.uuid, + manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"}) + .as('testCollection').then(function() { + cy.loginAs(activeUser); + cy.visit(`/collections/${this.testCollection.uuid}`); + cy.get('[data-cy=collection-files-panel]') + .contains('bar').rightclick(); + cy.get('[data-cy=context-menu]') + .contains('Rename') + .click(); + cy.get('[data-cy=form-dialog]') + .should('contain', 'Rename') + .within(() => { + cy.get('input').type('{backspace}{backspace}{backspace}'); + }); + cy.get('[data-cy=form-submit-btn]').click(); + cy.get('[data-cy=form-dialog]') + .should('contain', 'Rename') + .within(() => { + cy.contains('Could not rename'); + }); + }); + }); + it('can correctly display old versions', function() { - const colName = `Versioned Collection ${Math.floor(Math.random() * Math.floor(999999))}`; + const colName = `Versioned Collection ${Math.floor(Math.random() * 999999)}`; let colUuid = ''; let oldVersionUuid = ''; // Make sure no other collections with this name exist