From beacdc4d38efb1880aaa14e8b3985e683d14e457 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Wed, 28 Apr 2021 19:15:30 -0300 Subject: [PATCH] 17289: Adds test. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- cypress/integration/collection.spec.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/cypress/integration/collection.spec.js b/cypress/integration/collection.spec.js index 5bad87b3..15170076 100644 --- a/cypress/integration/collection.spec.js +++ b/cypress/integration/collection.spec.js @@ -53,7 +53,7 @@ describe('Collection panel tests', function () { const childrenCollection = Array.prototype.slice.call(Cypress.$(body).find('dict')[0].children); const map = {}; let i, j = 2; - + for (i=0; i < childrenCollection.length; i += j) { map[childrenCollection[i].outerText] = childrenCollection[i + 1].outerText; } @@ -116,6 +116,7 @@ describe('Collection panel tests', function () { // on this loop may pass an assertion from the first iteration by looking // for the same file name. const fileName = isWritable ? 'bar' : 'foo'; + const subDirName = 'subdir'; cy.createGroup(adminUser.token, { name: 'Shared project', group_class: 'project', @@ -126,7 +127,7 @@ describe('Collection panel tests', function () { name: 'Test collection', owner_uuid: this.sharedGroup.uuid, properties: { someKey: 'someValue' }, - manifest_text: `. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:${fileName}\n` + manifest_text: `. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:${fileName}\n./${subDirName} 37b51d194a7513e45b56f6524f2d51f2+3 0:3:${fileName}\n` }) .as('testCollection').then(function () { // Share the group with active user. @@ -184,6 +185,7 @@ describe('Collection panel tests', function () { .should(`${isWritable ? '' : 'not.'}contain`, 'Upload data'); } }); + // Test context menus cy.get('[data-cy=collection-files-panel]') .contains(fileName).rightclick({ force: true }); cy.get('[data-cy=context-menu]') @@ -193,6 +195,15 @@ describe('Collection panel tests', function () { .and(`${isWritable ? '' : 'not.'}contain`, 'Rename') .and(`${isWritable ? '' : 'not.'}contain`, 'Remove'); cy.get('body').click(); // Collapse the menu + cy.get('[data-cy=collection-files-panel]') + .contains(subDirName).rightclick({ force: true }); + cy.get('[data-cy=context-menu]') + .should('not.contain', 'Download') + .and('contain', 'Open in new tab') + .and('contain', 'Copy to clipboard') + .and(`${isWritable ? '' : 'not.'}contain`, 'Rename') + .and(`${isWritable ? '' : 'not.'}contain`, 'Remove'); + cy.get('body').click(); // Collapse the menu // Hamburger 'more options' menu button cy.get('[data-cy=collection-files-panel-options-btn]') .click() @@ -202,16 +213,8 @@ describe('Collection panel tests', function () { cy.get('[data-cy=collection-files-panel-options-btn]') .click() cy.get('[data-cy=context-menu]') - // .should('contain', 'Download selected') .should(`${isWritable ? '' : 'not.'}contain`, 'Remove selected') cy.get('body').click(); // Collapse the menu - // File item 'more options' button - cy.get('[data-cy=file-item-options-btn') - .click() - cy.get('[data-cy=context-menu]') - .should('contain', 'Download') - .and(`${isWritable ? '' : 'not.'}contain`, 'Remove'); - cy.get('body').click(); // Collapse the menu }) }) }) -- 2.30.2