21224: merged main to pass int tests
[arvados.git] / services / workbench2 / cypress / e2e / search.cy.js
index d8aa35d3d2d4b6398282350f9d68e88ccb5a2030..4e5aa31f4dc2b209bcf1ae35927bf2477ac930d4 100644 (file)
@@ -23,11 +23,6 @@ describe("Search tests", function () {
             });
     });
 
-    beforeEach(function () {
-        cy.clearCookies();
-        cy.clearLocalStorage();
-    });
-
     it("can search for old collection versions", function () {
         const colName = `Versioned Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
         let colUuid = "";
@@ -165,14 +160,16 @@ describe("Search tests", function () {
         });
     });
 
-    it("shows search context menu", function () {
+    // The following test is enabled on Electron only, as Chromium and Firefox
+    // require permissions to access the clipboard.
+    it("shows search context menu", { browser: 'electron' } , function () {
         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: "127.0.0.1", url: "**/arvados/v1/config?nocache=*" }, req => {
-            req.reply(res => {
+            req.on('response', res => {
                 res.body.RemoteClusters = {
                     "*": res.body.RemoteClusters["*"],
                     xxxxx: {
@@ -218,8 +215,6 @@ describe("Search tests", function () {
                         DispatchCloud: { ExternalURL: "" },
                         DispatchLSF: { ExternalURL: "" },
                         DispatchSLURM: { ExternalURL: "" },
-                        GitHTTP: { ExternalURL: "https://xxxxx.fakecluster.tld:39105/" },
-                        GitSSH: { ExternalURL: "" },
                         Health: { ExternalURL: "https://xxxxx.fakecluster.tld:42915/" },
                         Keepbalance: { ExternalURL: "" },
                         Keepproxy: { ExternalURL: "https://xxxxx.fakecluster.tld:46773/" },
@@ -252,7 +247,7 @@ describe("Search tests", function () {
 
             // Intercept search results to add federated result
             cy.intercept({ method: "GET", url: "**/arvados/v1/groups/contents?*" }, req => {
-                req.reply(res => {
+                req.on('response', res => {
                     res.body.items = [
                         res.body.items[0],
                         {
@@ -274,17 +269,17 @@ describe("Search tests", function () {
                 cy.stub(win, "open").as("Open");
             });
 
-            // Check copy to clipboard
+            // Check Copy link to clipboard
             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("API Details");
-                cy.contains("Copy to clipboard");
+                cy.contains("Copy link to clipboard");
                 cy.contains("Open in new tab");
                 cy.contains("View details");
 
-                cy.contains("Copy to clipboard").click();
+                cy.contains("Copy link to clipboard").click();
                 cy.waitForDom();
                 cy.window().then(win =>
                     win.navigator.clipboard.readText().then(text => {
@@ -301,10 +296,10 @@ describe("Search tests", function () {
                 cy.get("@Open").should("have.been.calledOnceWith", `${window.location.origin}/collections/${testCollection.uuid}`);
             });
 
-            // Check federated result copy to clipboard
+            // Check federated result Copy link to clipboard
             cy.get("[data-cy=search-results]").contains(federatedColName).rightclick();
             cy.get("[data-cy=context-menu]").within(() => {
-                cy.contains("Copy to clipboard").click();
+                cy.contains("Copy link to clipboard").click();
                 cy.waitForDom();
                 cy.window().then(win =>
                     win.navigator.clipboard.readText().then(text => {