+ .its("body.items")
+ .as("collections")
+ .then(function () {
+ expect(this.collections).to.have.lengthOf(2);
+ this.collections.map(function (aCollection) {
+ expect(aCollection.current_version_uuid).to.equal(colUuid);
+ if (aCollection.uuid !== aCollection.current_version_uuid) {
+ oldVersionUuid = aCollection.uuid;
+ }
+ });
+ cy.loginAs(activeUser);
+ const searchQuery = `${colName} type:arvados#collection`;
+ // Search for only collection's current version
+ cy.doSearch(`${searchQuery}`);
+ cy.get("[data-cy=search-results]").should("contain", "head version");
+ cy.get("[data-cy=search-results]").should("not.contain", "version 1");
+ // ...and then, include old versions.
+ cy.doSearch(`${searchQuery} is:pastVersion`);
+ cy.get("[data-cy=search-results]").should("contain", "head version");
+ cy.get("[data-cy=search-results]").should("contain", "version 1");
+ });
+ });
+
+ it("can display path of the selected item", function () {
+ const colName = `Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
+
+ // 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",
+ }).then(function () {
+ cy.loginAs(activeUser);
+
+ cy.doSearch(colName);
+
+ cy.get("[data-cy=search-results]").should("contain", colName);
+
+ cy.get("[data-cy=search-results]").contains(colName).closest("tr").click();
+
+ cy.get("[data-cy=element-path]").should("contain", `/ Projects / ${colName}`);
+ });
+ });
+
+ 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))}`;
+
+ cy.createCollection(adminUser.token, {
+ name: colName,
+ owner_uuid: activeUser.user.uuid,
+ preserve_version: true,
+ manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n",
+ }).then(function () {
+ cy.loginAs(activeUser);
+
+ cy.doSearch(colName);
+
+ cy.get("[data-cy=search-results]").should("contain", colName);
+
+ cy.get("[data-cy=search-results]")
+ .contains(colName)
+ .closest("tr")
+ .within(() => {
+ cy.get("p").contains(activeUser.user.uuid).should("contain", activeUser.user.full_name);
+ });
+ });
+ });
+
+ 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 federatedColUuid = "xxxxx-4zz18-000000000000000";
+
+ // Intercept config to insert remote cluster
+ cy.intercept({ method: "GET", hostname: "localhost", url: "**/arvados/v1/config?nocache=*" }, req => {
+ req.reply(res => {
+ res.body.RemoteClusters = {
+ "*": res.body.RemoteClusters["*"],
+ xxxxx: {
+ ActivateUsers: true,
+ Host: "xxxxx.fakecluster.tld",
+ Insecure: false,
+ Proxy: true,
+ Scheme: "",
+ },
+ };