20913: Fix test to check that use profile gets saved
[arvados.git] / cypress / integration / search.spec.js
index da33c7df02881dfc1d62c5bd9f03fa229e665362..085298dcd0e05e1c485167c83f5b13a4291e6c27 100644 (file)
@@ -105,6 +105,39 @@ describe('Search tests', function() {
         });
     });
 
+    it('can search items using quotes', function() {
+        const random = Math.floor(Math.random() * Math.floor(999999));
+        const colName = `Collection ${random}`;
+        const colName2 = `Collection test ${random}`;
+
+        // Creates the collection using the admin token so we can set up
+        // a bogus manifest text without block signatures.
+        cy.createCollection(adminUser.token, {
+            name: colName,
+            owner_uuid: activeUser.user.uuid,
+            preserve_version: true,
+            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+        }).as('collection1');
+
+        cy.createCollection(adminUser.token, {
+            name: colName2,
+            owner_uuid: activeUser.user.uuid,
+            preserve_version: true,
+            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+        }).as('collection2');
+
+        cy.getAll('@collection1', '@collection2')
+            .then(function() {
+                cy.loginAs(activeUser);
+
+                cy.doSearch(colName);
+                cy.get('[data-cy=search-results] table tbody tr').should('have.length', 2);
+
+                cy.doSearch(`"${colName}"`);
+                cy.get('[data-cy=search-results] table tbody tr').should('have.length', 1);
+            });
+    });
+
     it('can display owner of the item', function() {
         const colName = `Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
 
@@ -128,12 +161,12 @@ describe('Search tests', function() {
     });
 
     it('shows search context menu', function() {
-        const colName = `Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
-        const federatedColName = `Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
+        const colName = `Home Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
+        const federatedColName = `Federated Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
         const federatedColUuid = "xxxxx-4zz18-000000000000000";
 
         // Intercept config to insert remote cluster
-        cy.intercept({method: 'GET', hostname: 'localhost', url: '**/arvados/v1/config?nocache=*'}, (req) => {
+        cy.intercept({method: 'GET', hostname: '127.0.0.1', url: '**/arvados/v1/config?nocache=*'}, (req) => {
             req.reply((res) => {
                 res.body.RemoteClusters = {
                     "*": res.body.RemoteClusters["*"],
@@ -247,6 +280,7 @@ describe('Search tests', function() {
                 cy.contains('View details');
 
                 cy.contains('Copy to clipboard').click();
+                cy.waitForDom();
                 cy.window().then((win) => (
                     win.navigator.clipboard.readText().then((text) => {
                         expect(text).to.match(new RegExp(`/collections/${testCollection.uuid}$`));
@@ -258,6 +292,7 @@ describe('Search tests', function() {
             cy.get('[data-cy=search-results]').contains(colName).rightclick();
             cy.get('[data-cy=context-menu]').within(() => {
                 cy.contains('Open in new tab').click();
+                cy.waitForDom();
                 cy.get('@Open').should('have.been.calledOnceWith', `${window.location.origin}/collections/${testCollection.uuid}`)
             });
 
@@ -265,6 +300,7 @@ describe('Search tests', function() {
             cy.get('[data-cy=search-results]').contains(federatedColName).rightclick();
             cy.get('[data-cy=context-menu]').within(() => {
                 cy.contains('Copy to clipboard').click();
+                cy.waitForDom();
                 cy.window().then((win) => (
                     win.navigator.clipboard.readText().then((text) => {
                         expect(text).to.equal(`https://wb2.xxxxx.fakecluster.tld/collections/${federatedColUuid}`);
@@ -275,6 +311,7 @@ describe('Search tests', function() {
             cy.get('[data-cy=search-results]').contains(federatedColName).rightclick();
             cy.get('[data-cy=context-menu]').within(() => {
                 cy.contains('Open in new tab').click();
+                cy.waitForDom();
                 cy.get('@Open').should('have.been.calledWith', `https://wb2.xxxxx.fakecluster.tld/collections/${federatedColUuid}`)
             });