19079: Add test for search context menu
authorStephen Smith <stephen@curii.com>
Wed, 27 Jul 2022 18:12:34 +0000 (14:12 -0400)
committerStephen Smith <stephen@curii.com>
Wed, 27 Jul 2022 18:12:34 +0000 (14:12 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

cypress/integration/search.spec.js
tools/run-integration-tests.sh

index 5434ca248a5167e5461014491d77f422980ae693..6f880e7fd6159acf269e5b746fb6f80ee962bb99 100644 (file)
@@ -126,4 +126,50 @@ describe('Search tests', function() {
                 });
         });
     });
-});
\ No newline at end of file
+
+    it.only('shows search context menu', function() {
+        const colName = `Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
+
+        cy.createCollection(adminUser.token, {
+            name: colName,
+            owner_uuid: activeUser.user.uuid,
+            preserve_version: true,
+            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+        }).then(function(testCollection) {
+            cy.loginAs(activeUser);
+
+            cy.doSearch(colName);
+
+            // Stub new window
+            cy.window().then(win => {
+                cy.stub(win, 'open').as('Open')
+            });
+
+            cy.get('[data-cy=search-results]').contains(colName).rightclick();
+            cy.get('[data-cy=context-menu]').within((ctx) => {
+                // Check that there are 4 items in the menu
+                cy.get(ctx).children().should('have.length', 4);
+                cy.contains('Advanced');
+                cy.contains('Copy to clipboard');
+                cy.contains('Open in new tab');
+                cy.contains('View details');
+
+                cy.contains('Copy to clipboard').click();
+                cy.window().then((win) => {
+                    win.navigator.clipboard.readText().then((text) => {
+                        expect(text).to.endWith(`/collections/${testCollection.uuid}`);
+                    });
+                });
+
+            });
+
+
+            cy.get('[data-cy=search-results]').contains(colName).rightclick();
+            cy.get('[data-cy=context-menu]').within((ctx) => {
+                cy.contains('Open in new tab').click();
+                cy.get('@Open').should('have.been.calledOnceWith', `${window.location.origin}/collections/${testCollection.uuid}`)
+            });
+
+        });
+    });
+});
index 0a9a0fc42adcf369da404fee334726d4b46bb05e..367ccecd3512d90f261adc30b85405aac3f6176a 100755 (executable)
@@ -114,6 +114,7 @@ coproc arvboot (~/go/bin/arvados-server boot \
     -type test \
     -config ${TMPDIR}/arvados.yml \
     -no-workbench1 \
+    -no-workbench2 \
     -own-temporary-database \
     -timeout 20m 2> ${ARVADOS_LOG})
 trap cleanup ERR EXIT