From: Stephen Smith Date: Fri, 15 Mar 2024 17:15:08 +0000 (-0400) Subject: 21597: Use req.on('reply' instead of req.reply to workaround cypress bug X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/refs/heads/21597-cypress-reply-fix 21597: Use req.on('reply' instead of req.reply to workaround cypress bug https://github.com/cypress-io/cypress/issues/26248#issuecomment-1623005400 Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- diff --git a/services/workbench2/cypress/e2e/banner-tooltip.cy.js b/services/workbench2/cypress/e2e/banner-tooltip.cy.js index 1a93d83f31..0a0ac75164 100644 --- a/services/workbench2/cypress/e2e/banner-tooltip.cy.js +++ b/services/workbench2/cypress/e2e/banner-tooltip.cy.js @@ -60,7 +60,7 @@ describe('Banner / tooltip tests', function () { .should('contain', 'tooltips.json'); cy.intercept({ method: 'GET', url: '**/arvados/v1/config?nocache=*' }, (req) => { - req.reply((res) => { + req.on('response', (res) => { res.body.Workbench.BannerUUID = collectionUUID; }); }); @@ -97,4 +97,4 @@ describe('Banner / tooltip tests', function () { expect(el._tippy).to.be.undefined; }); }); -}); \ No newline at end of file +}); diff --git a/services/workbench2/cypress/e2e/process.cy.js b/services/workbench2/cypress/e2e/process.cy.js index ca13e9f9e0..2a5a62927f 100644 --- a/services/workbench2/cypress/e2e/process.cy.js +++ b/services/workbench2/cypress/e2e/process.cy.js @@ -148,7 +148,7 @@ describe("Process tests", function () { // Fake submitted by another user cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => { - req.reply(res => { + req.on('response', res => { res.body.modified_by_user_uuid = "zzzzz-tpzed-000000000000000"; }); }); @@ -219,7 +219,7 @@ describe("Process tests", function () { // Force container_count for testing let containerCount = 2; cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => { - req.reply(res => { + req.on('response', res => { res.body.container_count = containerCount; }); }); @@ -349,7 +349,7 @@ describe("Process tests", function () { ) { // Fake container uuid cy.intercept({ method: "GET", url: `**/arvados/v1/container_requests/${containerRequest.uuid}` }, req => { - req.reply(res => { + req.on('response', res => { res.body.output_uuid = fakeCrUuid; res.body.priority = 500; res.body.state = "Committed"; @@ -381,7 +381,7 @@ describe("Process tests", function () { ) { // Fake container uuid cy.intercept({ method: "GET", url: `**/arvados/v1/container_requests/${containerRequest.uuid}` }, req => { - req.reply(res => { + req.on('response', res => { res.body.output_uuid = fakeCrLockedUuid; res.body.priority = 500; res.body.state = "Committed"; @@ -413,7 +413,7 @@ describe("Process tests", function () { ) { // Fake container uuid cy.intercept({ method: "GET", url: `**/arvados/v1/container_requests/${containerRequest.uuid}` }, req => { - req.reply(res => { + req.on('response', res => { res.body.output_uuid = fakeCrOnHoldUuid; res.body.priority = 0; res.body.state = "Committed"; @@ -443,7 +443,7 @@ describe("Process tests", function () { describe("Logs panel", function () { it("shows live process logs", function () { cy.intercept({ method: "GET", url: "**/arvados/v1/containers/*" }, req => { - req.reply(res => { + req.on('response', res => { res.body.state = ContainerState.RUNNING; }); }); @@ -1349,7 +1349,7 @@ describe("Process tests", function () { cy.getAll("@testOutputCollection").then(([testOutputCollection]) => { // Add output uuid and inputs to container request cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => { - req.reply(res => { + req.on('response', res => { res.body.output_uuid = testOutputCollection.uuid; res.body.mounts["/var/lib/cwl/cwl.input.json"] = { content: testInputs.map(param => param.input).reduce((acc, val) => Object.assign(acc, val), {}), @@ -1480,7 +1480,7 @@ describe("Process tests", function () { // Add output uuid and inputs to container request cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => { - req.reply(res => { + req.on('response', res => { res.body.output_uuid = fakeOutputUUID; res.body.mounts["/var/lib/cwl/cwl.input.json"] = { content: {}, diff --git a/services/workbench2/cypress/e2e/search.cy.js b/services/workbench2/cypress/e2e/search.cy.js index 1bf2b5c3ef..ba9077ac20 100644 --- a/services/workbench2/cypress/e2e/search.cy.js +++ b/services/workbench2/cypress/e2e/search.cy.js @@ -169,7 +169,7 @@ describe("Search tests", function () { // 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: { @@ -249,7 +249,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], {