Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla@contractors.roche.com>
cy.get('[data-cy=breadcrumb-last]').should('contain', collName);
});
- it.only('shows responsible person for collection if available', () => {
+ it('shows responsible person for collection if available', () => {
cy.createCollection(adminUser.token, {
name: `Test collection ${Math.floor(Math.random() * 999999)}`,
owner_uuid: activeUser.user.uuid,
cy.getAll('@mySharedWritableProject', '@testTargetCollection')
.then(function ([mySharedWritableProject, testTargetCollection]) {
cy.loginAs(activeUser);
+
+ cy.get('[data-cy=side-panel-tree]').contains('My Favorites').click();
const newProjectName = `New project name ${mySharedWritableProject.name}`;
const newProjectDescription = `New project description ${mySharedWritableProject.name}`;
const newCollectionName = `New collection name ${testTargetCollection.name}`;
const newCollectionDescription = `New collection description ${testTargetCollection.name}`;
- cy.get('[data-cy=side-panel-tree]').contains('My Favorites').click();
-
- cy.get('main').contains(mySharedWritableProject.name).rightclick();
- cy.get('[data-cy=context-menu]').contains('Edit project').click();
- cy.get('[data-cy=form-dialog]').within(() => {
- cy.get('input[name=name]').clear().type(newProjectName);
- cy.get('div[contenteditable=true]').type(newProjectDescription);
- cy.get('[data-cy=form-submit-btn]').click();
- });
+ cy.editProjectOrCollection('main', mySharedWritableProject.name, newProjectName, newProjectDescription);
+ cy.editProjectOrCollection('main', testTargetCollection.name, newCollectionName, newCollectionDescription, false);
cy.get('main').contains(newProjectName).rightclick();
- cy.get('[data-cy=context-menu]').contains('Edit project').click();
- cy.get('[data-cy=form-dialog]').within(() => {
- cy.get('input[name=name]').should('have.value', newProjectName);
- cy.get('span[data-text=true]').contains( newProjectDescription);
- cy.get('[data-cy=form-cancel-btn]').click();
- });
+ cy.contains('Remove from favorites').click();
+ cy.get('main').contains(newCollectionName).rightclick();
+ cy.contains('Remove from favorites').click();
- cy.get('main').contains(testTargetCollection.name).rightclick();
- cy.get('[data-cy=context-menu]').contains('Edit collection').click();
- cy.get('[data-cy=form-dialog]').within(() => {
- cy.get('input[name=name]').clear().type(newCollectionName);
- cy.get('input[name=description]').type(newCollectionDescription);
- cy.get('[data-cy=form-submit-btn]').click();
- });
+ cy.get('[data-cy=side-panel-tree]').contains('Projects').click();
+ cy.get('main').contains(newProjectName).rightclick();
+ cy.contains('Add to public favorites').click();
cy.get('main').contains(newCollectionName).rightclick();
- cy.get('[data-cy=context-menu]').contains('Edit collection').click();
- cy.get('[data-cy=form-dialog]').within(() => {
- cy.get('input[name=name]').should('have.value', newCollectionName);
- cy.get('input[name=description]').should('have.value', newCollectionDescription);
- cy.get('[data-cy=form-cancel-btn]').click();
- });
+ cy.contains('Add to public favorites').click();
+
+ cy.get('[data-cy=side-panel-tree]').contains('Public Favorites').click();
+
+ cy.editProjectOrCollection('main', newProjectName, mySharedWritableProject.name, 'newProjectDescription');
+ cy.editProjectOrCollection('main', newCollectionName, testTargetCollection.name, 'newCollectionDescription', false);
});
});
cy.get('[data-cy=context-menu]').should('not.contain', 'Move to trash');
});
});
+
+ it('can edit project in shared with me', () => {
+ cy.createProject({
+ owningUser: adminUser,
+ targetUser: activeUser,
+ projectName: 'mySharedWritableProject',
+ canWrite: true,
+ addToFavorites: true
+ });
+
+ cy.getAll('@mySharedWritableProject')
+ .then(function ([mySharedWritableProject]) {
+ cy.loginAs(activeUser);
+
+ cy.get('[data-cy=side-panel-tree]').contains('Shared with me').click();
+
+ const newProjectName = `New project name ${mySharedWritableProject.name}`;
+ const newProjectDescription = `New project description ${mySharedWritableProject.name}`;
+
+ cy.editProjectOrCollection('main', mySharedWritableProject.name, newProjectName, newProjectDescription);
+ });
+ });
});
\ No newline at end of file
})
})
+ it('can edit project in side panel', () => {
+ cy.createProject({
+ owningUser: activeUser,
+ targetUser: activeUser,
+ projectName: 'mySharedWritableProject',
+ canWrite: true,
+ addToFavorites: false
+ });
+
+ cy.getAll('@mySharedWritableProject')
+ .then(function ([mySharedWritableProject]) {
+ cy.loginAs(activeUser);
+
+ cy.get('[data-cy=side-panel-tree]').contains('Projects').click();
+
+ const newProjectName = `New project name ${mySharedWritableProject.name}`;
+ const newProjectDescription = `New project description ${mySharedWritableProject.name}`;
+
+ cy.editProjectOrCollection('[data-cy=side-panel-tree]', mySharedWritableProject.name, newProjectName, newProjectDescription);
+ });
+ });
+
})
}
)
+Cypress.Commands.add(
+ "editProjectOrCollection", (container, oldName, newName, newDescription, isProject = true) => {
+ cy.get(container).contains(oldName).rightclick();
+ cy.get('[data-cy=context-menu]').contains(isProject ? 'Edit project' : 'Edit collection').click();
+ cy.get('[data-cy=form-dialog]').within(() => {
+ cy.get('input[name=name]').clear().type(newName);
+ cy.get(isProject ? 'div[contenteditable=true]' : 'input[name=description]').type(newDescription);
+ cy.get('[data-cy=form-submit-btn]').click();
+ });
+
+ cy.get(container).contains(newName).rightclick();
+ cy.get('[data-cy=context-menu]').contains(isProject ? 'Edit project' : 'Edit collection').click();
+ cy.get('[data-cy=form-dialog]').within(() => {
+ cy.get('input[name=name]').should('have.value', newName);
+
+ if (isProject) {
+ cy.get('span[data-text=true]').contains(newDescription);
+ } else {
+ cy.get('input[name=description]').should('have.value', newDescription);
+ }
+
+ cy.get('[data-cy=form-cancel-btn]').click();
+ });
+ }
+)
+
Cypress.Commands.add(
"doSearch", (searchTerm) => {
cy.get('[data-cy=searchbar-input-field]').type(`{selectall}${searchTerm}{enter}`);
const menuKind = this.props.dispatch<any>(resourceUuidToContextMenuKind(resourceUuid));
if (menuKind && resource) {
this.props.dispatch<any>(openContextMenu(event, {
- name: '',
+ name: resource.name,
uuid: resource.uuid,
+ description: resource.description,
ownerUuid: resource.ownerUuid,
isTrashed: ('isTrashed' in resource) ? resource.isTrashed: false,
kind: resource.kind,