From b334ada5137efaaaa24ed93ce97a03b7838c924a Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 24 Oct 2022 14:37:18 -0400 Subject: [PATCH] 16073: Remove buggy waits in cypress and try to streamline output details fetching Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- cypress/integration/process.spec.js | 4 +--- src/views/process-panel/process-panel-root.tsx | 15 +++++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cypress/integration/process.spec.js b/cypress/integration/process.spec.js index 38d90830..84c786bd 100644 --- a/cypress/integration/process.spec.js +++ b/cypress/integration/process.spec.js @@ -869,8 +869,6 @@ describe('Process tests', function() { cy.goToPath(`/processes/${containerRequest.uuid}`); cy.get('[data-cy=process-io-card] h6').contains('Inputs') .parents('[data-cy=process-io-card]').within(() => { - cy.wait(2000); - cy.waitForDom(); verifyIOParameter('input_file', null, "Label Description", 'input1.tar', '00000000000000000000000000000000+01'); verifyIOParameter('input_file', null, "Label Description", 'input1-2.txt', undefined, true); verifyIOParameter('input_file', null, "Label Description", 'input1-3.txt', undefined, true); @@ -896,7 +894,7 @@ describe('Process tests', function() { cy.get('[data-cy=process-io-card] h6').contains('Outputs') .parents('[data-cy=process-io-card]').within((ctx) => { cy.get(ctx).scrollIntoView(); - cy.waitForDom().get('[data-cy="io-preview-image-toggle"]').click(); + cy.get('[data-cy="io-preview-image-toggle"]').click(); const outPdh = testOutputCollection.portable_data_hash; verifyIOParameter('output_file', null, "Label Description", 'cat.png', `${outPdh}`); diff --git a/src/views/process-panel/process-panel-root.tsx b/src/views/process-panel/process-panel-root.tsx index 6217181c..c2267ec0 100644 --- a/src/views/process-panel/process-panel-root.tsx +++ b/src/views/process-panel/process-panel-root.tsx @@ -99,17 +99,24 @@ export const ProcessPanelRoot = withStyles(styles)( } }, [containerRequest, fetchOutputs]); - // Format raw output into ProcessIOParameter[] when it changes + // Fetch outputDefinitons from mounts whenever containerRequest is updated React.useEffect(() => { - if (outputDetails !== undefined && outputDetails.rawOutputs && containerRequest) { + if (containerRequest && containerRequest.mounts) { const newOutputDefinitions = getOutputParameters(containerRequest); - // Avoid setting output definitions back to [] when mounts briefly go missing + // Avoid setting output definitions to [] when mounts briefly go missing if (newOutputDefinitions.length) { setOutputDefinitions(newOutputDefinitions); } + } + }, [containerRequest]); + + // Format raw output into ProcessIOParameter[] when it changes + React.useEffect(() => { + if (outputDetails !== undefined && outputDetails.rawOutputs) { + // Update processed outputs as long as outputDetails is loaded (or failed to load with {} rawOutputs) setProcessedOutputs(formatOutputData(outputDefinitions, outputDetails.rawOutputs, outputDetails.pdh, auth)); } - }, [outputDetails, auth, containerRequest, outputDefinitions]); + }, [outputDetails, auth, outputDefinitions]); // Fetch raw inputs and format into ProcessIOParameter[] // Can be sync because inputs are either already in containerRequest mounts or props -- 2.30.2