From: Peter Amstutz Date: Mon, 27 Feb 2023 16:38:34 +0000 (-0500) Subject: 19482: Tests should be passing now X-Git-Tag: 2.6.0~6^2~7 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/0bad690b76b7852ae5e1f70cb9b1dea71daa7917 19482: Tests should be passing now Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/cypress/integration/workflow.spec.js b/cypress/integration/workflow.spec.js index 3315284c..e1fa20a8 100644 --- a/cypress/integration/workflow.spec.js +++ b/cypress/integration/workflow.spec.js @@ -43,7 +43,7 @@ describe('Registered workflow panel tests', function() { }); }); - it('shows workflow details', function() { + it('should handle malformed run', function() { cy.createResource(activeUser.token, "workflows", {workflow: { name: "Test wf", definition: JSON.stringify({ @@ -51,49 +51,9 @@ describe('Registered workflow panel tests', function() { $graph: [ { "class": "Workflow", - "hints": [ - { - "class": "DockerRequirement", - "dockerPull": "python:2-slim" - } - ], "id": "#main", - "inputs": [ - { - "id": "#main/file1", - "type": "File" - }, - { - "id": "#main/numbering", - "type": [ - "null", - "boolean" - ] - }, - { - "default": { - "basename": "args.py", - "class": "File", - "location": "keep:de738550734533c5027997c87dc5488e+53/args.py", - "nameext": ".py", - "nameroot": "args", - "size": 179 - }, - "id": "#main/args.py", - "type": "File" - } - ], - "outputs": [ - { - "id": "#main/args", - "outputSource": "#main/step/args", - "type": { - "items": "string", - "name": "_:b0adccc1-502d-476f-8a5b-c8ef7119e2dc", - "type": "array" - } - } - ], + "inputs": [], + "outputs": [], "requirements": [ { "class": "SubworkflowFeatureRequirement" @@ -102,27 +62,14 @@ describe('Registered workflow panel tests', function() { "steps": [ { "id": "#main/cat1-testcli.cwl (v1.2.0-109-g9b091ed)", - "in": [ - { - "id": "#main/step/file1", - "source": "#main/file1" - }, - { - "id": "#main/step/numbering", - "source": "#main/numbering" - }, - { - "id": "#main/step/args.py", - "source": "#main/args.py" - } - ], + "in": [], "label": "cat1-testcli.cwl (v1.2.0-109-g9b091ed)", "out": [ { "id": "#main/step/args" } ], - "run": "keep:6b2f3b54194acf69476f22ae52c8ceaf+62/cat1-testcli.cwl" + "run": `keep:undefined/bar` } ] } @@ -137,18 +84,154 @@ describe('Registered workflow panel tests', function() { "http://arvados.org/cwl#gitPath": "tests/cat1-testcli.cwl", "http://arvados.org/cwl#gitStatus": "" }) - }}).then(function() { - cy.createCollection(adminUser.token, { - name: `Test collection ${Math.floor(Math.random() * 999999)}`, - owner_uuid: activeUser.user.uuid, - manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n" - }) + }}).then(function(workflowResource) { + cy.loginAs(activeUser); + cy.goToPath(`/workflows/${workflowResource.uuid}`); + cy.get('[data-cy=registered-workflow-info-panel]').should('contain', workflowResource.name); + cy.get('[data-cy=workflow-details-attributes-modifiedby-user]').contains(`Active User (${activeUser.user.uuid})`); + }); + }); + + const verifyIOParameter = (name, label, doc, val, collection) => { + cy.get('table tr').contains(name).parents('tr').within(($mainRow) => { + label && cy.contains(label); + + if (val) { + if (Array.isArray(val)) { + val.forEach(v => cy.contains(v)); + } else { + cy.contains(val); + } + } + if (collection) { + cy.contains(collection); + } + }); + }; + + it('shows workflow details', function() { + cy.createCollection(adminUser.token, { + name: `Test collection ${Math.floor(Math.random() * 999999)}`, + owner_uuid: activeUser.user.uuid, + manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n" }) - .then(function(workflowResource) { - cy.loginAs(activeUser); - cy.goToPath(`/workflows/${workflowResource.uuid}`); - cy.get('[data-cy=registered-workflow-info-panel]').should('contain', workflowResource.name); - cy.get('[data-cy=workflow-details-attributes-modifiedby-user]').contains(`Active User (${activeUser.user.uuid})`); + .then(function(collectionResource) { + cy.createResource(activeUser.token, "workflows", {workflow: { + name: "Test wf", + definition: JSON.stringify({ + cwlVersion: "v1.2", + $graph: [ + { + "class": "Workflow", + "hints": [ + { + "class": "DockerRequirement", + "dockerPull": "python:2-slim" + } + ], + "id": "#main", + "inputs": [ + { + "id": "#main/file1", + "type": "File" + }, + { + "id": "#main/numbering", + "type": [ + "null", + "boolean" + ] + }, + { + "default": { + "basename": "args.py", + "class": "File", + "location": "keep:de738550734533c5027997c87dc5488e+53/args.py", + "nameext": ".py", + "nameroot": "args", + "size": 179 + }, + "id": "#main/args.py", + "type": "File" + } + ], + "outputs": [ + { + "id": "#main/args", + "outputSource": "#main/step/args", + "type": { + "items": "string", + "name": "_:b0adccc1-502d-476f-8a5b-c8ef7119e2dc", + "type": "array" + } + } + ], + "requirements": [ + { + "class": "SubworkflowFeatureRequirement" + } + ], + "steps": [ + { + "id": "#main/cat1-testcli.cwl (v1.2.0-109-g9b091ed)", + "in": [ + { + "id": "#main/step/file1", + "source": "#main/file1" + }, + { + "id": "#main/step/numbering", + "source": "#main/numbering" + }, + { + "id": "#main/step/args.py", + "source": "#main/args.py" + } + ], + "label": "cat1-testcli.cwl (v1.2.0-109-g9b091ed)", + "out": [ + { + "id": "#main/step/args" + } + ], + "run": `keep:${collectionResource.portable_data_hash}/bar` + } + ] + } + ], + "cwlVersion": "v1.2", + "http://arvados.org/cwl#gitBranch": "1.2.1_proposed", + "http://arvados.org/cwl#gitCommit": "9b091ed7e0bef98b3312e9478c52b89ba25792de", + "http://arvados.org/cwl#gitCommitter": "GitHub ", + "http://arvados.org/cwl#gitDate": "Sun, 11 Sep 2022 21:24:42 +0200", + "http://arvados.org/cwl#gitDescribe": "v1.2.0-109-g9b091ed", + "http://arvados.org/cwl#gitOrigin": "git@github.com:common-workflow-language/cwl-v1.2", + "http://arvados.org/cwl#gitPath": "tests/cat1-testcli.cwl", + "http://arvados.org/cwl#gitStatus": "" + }) + }}).then(function(workflowResource) { + cy.loginAs(activeUser); + cy.goToPath(`/workflows/${workflowResource.uuid}`); + cy.get('[data-cy=registered-workflow-info-panel]').should('contain', workflowResource.name); + cy.get('[data-cy=workflow-details-attributes-modifiedby-user]').contains(`Active User (${activeUser.user.uuid})`); + cy.get('[data-cy=registered-workflow-info-panel') + .should('contain', 'gitCommit: 9b091ed7e0bef98b3312e9478c52b89ba25792de') + + cy.get('[data-cy=process-io-card] h6').contains('Inputs') + .parents('[data-cy=process-io-card]').within(() => { + verifyIOParameter('file1', null, '', '', ''); + verifyIOParameter('numbering', null, '', '', ''); + verifyIOParameter('args.py', null, '', 'args.py', 'de738550734533c5027997c87dc5488e+53'); + }); + cy.get('[data-cy=process-io-card] h6').contains('Outputs') + .parents('[data-cy=process-io-card]').within(() => { + verifyIOParameter('args', null, '', '', ''); + }); + cy.get('[data-cy=collection-files-panel]').within(() => { + cy.get('[data-cy=collection-files-right-panel]', { timeout: 5000 }) + .should('contain', 'bar'); + }); + }); }); }); }); diff --git a/src/views-components/details-panel/workflow-details.tsx b/src/views-components/details-panel/workflow-details.tsx index d9575cd8..15ddbfe0 100644 --- a/src/views-components/details-panel/workflow-details.tsx +++ b/src/views-components/details-panel/workflow-details.tsx @@ -97,7 +97,10 @@ export const getRegisteredWorkflowPanelData = (item: WorkflowResource, auth: Aut if (wf) { const REGEX = /keep:([0-9a-f]{32}\+\d+)\/.*/; if (wf["steps"]) { - workflowCollection = wf["steps"][0].run.match(REGEX)[1]; + const pdh = wf["steps"][0].run.match(REGEX); + if (pdh) { + workflowCollection = pdh[1]; + } } }