activeUser = this.activeUser;
}
);
- })
+ });
beforeEach(function() {
- cy.clearCookies()
- cy.clearLocalStorage()
- })
+ cy.clearCookies();
+ cy.clearLocalStorage();
+ });
it('shows collection by URL', function() {
cy.loginAs(activeUser);
})
})
+ 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
inactiveUser = this.inactiveUser;
}
);
- randomUser.username = `randomuser${Math.floor(Math.random() * Math.floor(999999))}`;
+ randomUser.username = `randomuser${Math.floor(Math.random() * 999999)}`;
randomUser.password = {
crypt: 'zpAReoZzPnwmQ',
clear: 'topsecret',
cy.doRequest('PUT', `/arvados/v1/api_client_authorizations/${tokenUuid}`, {
id: tokenUuid,
api_client_authorization: JSON.stringify({
- api_token: `randomToken${Math.floor(Math.random() * Math.floor(999999))}`
+ api_token: `randomToken${Math.floor(Math.random() * 999999)}`
})
}, null, activeUser.token, true);
// Should log the user out.