From 555a6df1236e6c36a2552ee6100225c389f4c884 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Wed, 2 Mar 2022 18:34:15 -0300 Subject: [PATCH] 18787: Separating the wheat from the chaff. This changes should be innocuous. The remaining `wait(...)` and `.click({force: true})` calls are the most probable signs of issues on the code being tested. As a bonus: I've discovered some issues with the test about cancelling multiple uploads. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- cypress/integration/collection.spec.js | 37 +++++++++++++++++++++----- cypress/integration/favorites.spec.js | 2 +- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/cypress/integration/collection.spec.js b/cypress/integration/collection.spec.js index b62a3441..0b06e53e 100644 --- a/cypress/integration/collection.spec.js +++ b/cypress/integration/collection.spec.js @@ -261,7 +261,7 @@ describe('Collection panel tests', function () { }); // Test context menus cy.get('[data-cy=collection-files-panel]') - .contains(fileName).rightclick({ force: true }); + .contains(fileName).rightclick(); cy.get('[data-cy=context-menu]') .should('contain', 'Download') .and('not.contain', 'Open in new tab') @@ -270,7 +270,7 @@ describe('Collection panel tests', function () { .and(`${isWritable ? '' : 'not.'}contain`, 'Remove'); cy.get('body').click(); // Collapse the menu cy.get('[data-cy=collection-files-panel]') - .contains(subDirName).rightclick({ force: true }); + .contains(subDirName).rightclick(); cy.get('[data-cy=context-menu]') .should('not.contain', 'Download') .and('not.contain', 'Open in new tab') @@ -368,7 +368,7 @@ describe('Collection panel tests', function () { ['subdir', 'G%C3%BCnter\'s%20file', 'table%&?*2'].forEach((subdir) => { cy.get('[data-cy=collection-files-panel]') - .contains('bar').rightclick({force: true}); + .contains('bar').rightclick(); cy.get('[data-cy=context-menu]') .contains('Rename') .click(); @@ -381,9 +381,9 @@ describe('Collection panel tests', function () { cy.get('[data-cy=collection-files-panel]') .should('not.contain', 'bar') .and('contain', subdir); - cy.wait(1000); cy.get('[data-cy=collection-files-panel]').contains(subdir).click(); - // Rename 'subdir/foo' to 'foo' + + // Rename 'subdir/foo' to 'bar' cy.wait(1000); cy.get('[data-cy=collection-files-panel]') .contains('foo').rightclick(); @@ -399,7 +399,6 @@ describe('Collection panel tests', function () { }); cy.get('[data-cy=form-submit-btn]').click(); - cy.wait(1000); cy.get('[data-cy=collection-files-panel]') .contains('Home') .click(); @@ -1034,6 +1033,14 @@ describe('Collection panel tests', function () { cy.goToPath(`/collections/${testCollection1.uuid}`); + // Confirm initial collection state. + cy.get('[data-cy=collection-files-panel]') + .contains('bar').should('exist'); + cy.get('[data-cy=collection-files-panel]') + .contains('5mb_a.bin').should('not.exist'); + cy.get('[data-cy=collection-files-panel]') + .contains('5mb_b.bin').should('not.exist'); + cy.get('[data-cy=upload-button]').click(); cy.fixture('files/5mb.bin', 'base64').then(content => { @@ -1043,9 +1050,25 @@ describe('Collection panel tests', function () { cy.get('[data-cy=form-submit-btn]').click(); cy.get('button[aria-label=Remove]').should('exist'); - cy.get('button[aria-label=Remove]').click({ multiple: true, force: true }); + cy.get('button[aria-label=Remove]') + .click({ multiple: true, force: true }); cy.get('[data-cy=form-submit-btn]').should('not.exist'); + + // Confirm final collection state. + cy.get('[data-cy=collection-files-panel]') + .contains('bar').should('exist'); + // The following fails, but doesn't seem to happen + // in the real world. Maybe there's a race between + // the PUT request finishing and the 'Remove' button + // dissapearing, because sometimes just one of the 2 + // files gets uploaded. + // Maybe this will be needed to simulate a slow network: + // https://docs.cypress.io/api/commands/intercept#Convenience-functions-1 + // cy.get('[data-cy=collection-files-panel]') + // .contains('5mb_a.bin').should('not.exist'); + // cy.get('[data-cy=collection-files-panel]') + // .contains('5mb_b.bin').should('not.exist'); }); }); }); diff --git a/cypress/integration/favorites.spec.js b/cypress/integration/favorites.spec.js index 105657ef..7fd09124 100644 --- a/cypress/integration/favorites.spec.js +++ b/cypress/integration/favorites.spec.js @@ -64,7 +64,7 @@ describe('Favorites tests', function () { cy.loginAs(activeUser); cy.goToPath(`/collections/${testSourceCollection.uuid}`); cy.get('[data-cy=collection-files-panel]').contains('bar'); - cy.get('[data-cy=collection-files-panel]').find('input[type=checkbox]').click({ force: true }); + cy.get('[data-cy=collection-files-panel]').find('input[type=checkbox]').click(); cy.get('[data-cy=collection-files-panel-options-btn]').click(); cy.get('[data-cy=context-menu]') .contains('Copy selected into the collection').click(); -- 2.30.2