1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { ContainerState } from 'models/container';
7 describe('Process tests', function() {
12 // Only set up common users once. These aren't set up as aliases because
13 // aliases are cleaned up after every test. Also it doesn't make sense
14 // to set the same users on beforeEach() over and over again, so we
15 // separate a little from Cypress' 'Best Practices' here.
16 cy.getUser('admin', 'Admin', 'User', true, true)
17 .as('adminUser').then(function() {
18 adminUser = this.adminUser;
21 cy.getUser('user', 'Active', 'User', false, true)
22 .as('activeUser').then(function() {
23 activeUser = this.activeUser;
28 beforeEach(function() {
30 cy.clearLocalStorage();
33 function setupDockerImage(image_name) {
34 // Create a collection that will be used as a docker image for the tests.
35 cy.createCollection(adminUser.token, {
37 manifest_text: ". d21353cfe035e3e384563ee55eadbb2f+67108864 5c77a43e329b9838cbec18ff42790e57+55605760 0:122714624:sha256:d8309758b8fe2c81034ffc8a10c36460b77db7bc5e7b448c4e5b684f9d95a678.tar\n"
38 }).as('dockerImage').then(function(dockerImage) {
39 // Give read permissions to the active user on the docker image.
40 cy.createLink(adminUser.token, {
41 link_class: 'permission',
43 tail_uuid: activeUser.user.uuid,
44 head_uuid: dockerImage.uuid
45 }).as('dockerImagePermission').then(function() {
46 // Set-up docker image collection tags
47 cy.createLink(activeUser.token, {
48 link_class: 'docker_image_repo+tag',
50 head_uuid: dockerImage.uuid,
51 }).as('dockerImageRepoTag');
52 cy.createLink(activeUser.token, {
53 link_class: 'docker_image_hash',
54 name: 'sha256:d8309758b8fe2c81034ffc8a10c36460b77db7bc5e7b448c4e5b684f9d95a678',
55 head_uuid: dockerImage.uuid,
56 }).as('dockerImageHash');
59 return cy.getAll('@dockerImage', '@dockerImageRepoTag', '@dockerImageHash',
60 '@dockerImagePermission').then(function([dockerImage]) {
65 function createContainerRequest(user, name, docker_image, command, reuse = false, state = 'Uncommitted') {
66 return setupDockerImage(docker_image).then(function(dockerImage) {
67 return cy.createContainerRequest(user.token, {
70 container_image: dockerImage.portable_data_hash, // for some reason, docker_image doesn't work here
71 output_path: 'stdout.txt',
73 runtime_constraints: {
89 describe('Details panel', function() {
90 it('shows process details', function() {
91 createContainerRequest(
93 `test_container_request ${Math.floor(Math.random() * 999999)}`,
95 ['echo', 'hello world'],
97 .then(function(containerRequest) {
98 cy.loginAs(activeUser);
99 cy.goToPath(`/processes/${containerRequest.uuid}`);
100 cy.get('[data-cy=process-details]').should('contain', containerRequest.name);
101 cy.get('[data-cy=process-details-attributes-modifiedby-user]').contains(`Active User (${activeUser.user.uuid})`);
102 cy.get('[data-cy=process-details-attributes-runtime-user]').should('not.exist');
105 // Fake submitted by another user
106 cy.intercept({method: 'GET', url: '**/arvados/v1/container_requests/*'}, (req) => {
108 res.body.modified_by_user_uuid = 'zzzzz-tpzed-000000000000000';
112 createContainerRequest(
114 `test_container_request ${Math.floor(Math.random() * 999999)}`,
116 ['echo', 'hello world'],
118 .then(function(containerRequest) {
119 cy.loginAs(activeUser);
120 cy.goToPath(`/processes/${containerRequest.uuid}`);
121 cy.get('[data-cy=process-details]').should('contain', containerRequest.name);
122 cy.get('[data-cy=process-details-attributes-modifiedby-user]').contains(`zzzzz-tpzed-000000000000000`);
123 cy.get('[data-cy=process-details-attributes-runtime-user]').contains(`Active User (${activeUser.user.uuid})`);
127 it('should show runtime status indicators', function() {
128 // Setup running container with runtime_status error & warning messages
129 createContainerRequest(
131 'test_container_request',
133 ['echo', 'hello world'],
135 .as('containerRequest')
136 .then(function(containerRequest) {
137 expect(containerRequest.state).to.equal('Committed');
138 expect(containerRequest.container_uuid).not.to.be.equal('');
140 cy.getContainer(activeUser.token, containerRequest.container_uuid)
141 .then(function(queuedContainer) {
142 expect(queuedContainer.state).to.be.equal('Queued');
144 cy.updateContainer(adminUser.token, containerRequest.container_uuid, {
146 }).then(function(lockedContainer) {
147 expect(lockedContainer.state).to.be.equal('Locked');
149 cy.updateContainer(adminUser.token, lockedContainer.uuid, {
152 error: 'Something went wrong',
153 errorDetail: 'Process exited with status 1',
154 warning: 'Free disk space is low',
157 .as('runningContainer')
158 .then(function(runningContainer) {
159 expect(runningContainer.state).to.be.equal('Running');
160 expect(runningContainer.runtime_status).to.be.deep.equal({
161 'error': 'Something went wrong',
162 'errorDetail': 'Process exited with status 1',
163 'warning': 'Free disk space is low',
168 // Test that the UI shows the error and warning messages
169 cy.getAll('@containerRequest', '@runningContainer').then(function([containerRequest]) {
170 cy.loginAs(activeUser);
171 cy.goToPath(`/processes/${containerRequest.uuid}`);
172 cy.get('[data-cy=process-runtime-status-error]')
173 .should('contain', 'Something went wrong')
174 .and('contain', 'Process exited with status 1');
175 cy.get('[data-cy=process-runtime-status-warning]')
176 .should('contain', 'Free disk space is low')
177 .and('contain', 'No additional warning details available');
181 // Force container_count for testing
182 let containerCount = 2;
183 cy.intercept({method: 'GET', url: '**/arvados/v1/container_requests/*'}, (req) => {
185 res.body.container_count = containerCount;
189 cy.getAll('@containerRequest').then(function([containerRequest]) {
190 cy.goToPath(`/processes/${containerRequest.uuid}`);
191 cy.get('[data-cy=process-runtime-status-retry-warning]', {timeout: 7000})
192 .should('contain', 'Process retried 1 time');
195 cy.getAll('@containerRequest').then(function([containerRequest]) {
197 cy.goToPath(`/processes/${containerRequest.uuid}`);
198 cy.get('[data-cy=process-runtime-status-retry-warning]', {timeout: 7000})
199 .should('contain', 'Process retried 2 times');
203 it('allows copying processes', function() {
204 const crName = 'first_container_request';
205 const copiedCrName = 'copied_container_request';
206 createContainerRequest(
210 ['echo', 'hello world'],
212 .then(function(containerRequest) {
213 cy.loginAs(activeUser);
214 cy.goToPath(`/processes/${containerRequest.uuid}`);
215 cy.get('[data-cy=process-details]').should('contain', crName);
217 cy.get('[data-cy=process-details]').find('button[title="More options"]').click();
218 cy.get('ul[data-cy=context-menu]').contains("Copy and re-run process").click();
221 cy.get('[data-cy=form-dialog]').within(() => {
222 cy.get('input[name=name]').clear().type(copiedCrName);
223 cy.get('[data-cy=projects-tree-home-tree-picker]').click();
224 cy.get('[data-cy=form-submit-btn]').click();
227 cy.get('[data-cy=process-details]').should('contain', copiedCrName);
228 cy.get('[data-cy=process-details]').find('button').contains('Run');
231 const getFakeContainer = (fakeContainerUuid) => ({
232 href: `/containers/${fakeContainerUuid}`,
233 kind: "arvados#container",
234 etag: "ecfosljpnxfari9a8m7e4yv06",
235 uuid: fakeContainerUuid,
236 owner_uuid: "zzzzz-tpzed-000000000000000",
237 created_at: "2023-02-13T15:55:47.308915000Z",
238 modified_by_client_uuid: "zzzzz-ozdt8-q6dzdi1lcc03155",
239 modified_by_user_uuid: "zzzzz-tpzed-000000000000000",
240 modified_at: "2023-02-15T19:12:45.987086000Z",
242 "arvados-cwl-runner",
245 "--project-uuid=zzzzz-j7d0g-yr18k784zplfeza",
246 "/var/lib/cwl/workflow.json#main",
247 "/var/lib/cwl/cwl.input.json",
249 container_image: "4ad7d11381df349e464694762db14e04+303",
250 cwd: "/var/spool/cwl",
254 locked_by_uuid: null,
257 output_path: "/var/spool/cwl",
259 runtime_constraints: {
264 hardware_capability: "",
266 keep_cache_disk: 2147483648,
274 scheduling_parameters: {
279 runtime_user_uuid: "zzzzz-tpzed-vllbpebicy84rd5",
280 runtime_auth_scopes: ["all"],
282 gateway_address: null,
283 interactive_session_started: false,
284 output_storage_classes: ["default"],
285 output_properties: {},
287 subrequests_cost: 0.0,
290 it('shows cancel button when appropriate', function() {
291 // Ignore collection requests
292 cy.intercept({method: 'GET', url: `**/arvados/v1/collections/*`}, {
297 // Uncommitted container
298 const crUncommitted = `Test process ${Math.floor(Math.random() * 999999)}`;
299 createContainerRequest(
303 ['echo', 'hello world'],
304 false, 'Uncommitted')
305 .then(function(containerRequest) {
306 // Navigate to process and verify run / cancel button
307 cy.goToPath(`/processes/${containerRequest.uuid}`);
309 cy.get('[data-cy=process-details]').should('contain', crUncommitted);
310 cy.get('[data-cy=process-run-button]').should('exist');
311 cy.get('[data-cy=process-cancel-button]').should('not.exist');
315 const crQueued = `Test process ${Math.floor(Math.random() * 999999)}`;
316 const fakeCrUuid = 'zzzzz-dz642-000000000000001';
317 createContainerRequest(
321 ['echo', 'hello world'],
323 .then(function(containerRequest) {
324 // Fake container uuid
325 cy.intercept({method: 'GET', url: `**/arvados/v1/container_requests/${containerRequest.uuid}`}, (req) => {
327 res.body.output_uuid = fakeCrUuid;
328 res.body.priority = 500;
329 res.body.state = "Committed";
334 const container = getFakeContainer(fakeCrUuid);
335 cy.intercept({method: 'GET', url: `**/arvados/v1/container/${fakeCrUuid}`}, {
337 body: {...container, state: "Queued", priority: 500}
340 // Navigate to process and verify cancel button
341 cy.goToPath(`/processes/${containerRequest.uuid}`);
343 cy.get('[data-cy=process-details]').should('contain', crQueued);
344 cy.get('[data-cy=process-cancel-button]').contains('Cancel');
348 const crLocked = `Test process ${Math.floor(Math.random() * 999999)}`;
349 const fakeCrLockedUuid = 'zzzzz-dz642-000000000000002';
350 createContainerRequest(
354 ['echo', 'hello world'],
356 .then(function(containerRequest) {
357 // Fake container uuid
358 cy.intercept({method: 'GET', url: `**/arvados/v1/container_requests/${containerRequest.uuid}`}, (req) => {
360 res.body.output_uuid = fakeCrLockedUuid;
361 res.body.priority = 500;
362 res.body.state = "Committed";
367 const container = getFakeContainer(fakeCrLockedUuid);
368 cy.intercept({method: 'GET', url: `**/arvados/v1/container/${fakeCrLockedUuid}`}, {
370 body: {...container, state: "Locked", priority: 500}
373 // Navigate to process and verify cancel button
374 cy.goToPath(`/processes/${containerRequest.uuid}`);
376 cy.get('[data-cy=process-details]').should('contain', crLocked);
377 cy.get('[data-cy=process-cancel-button]').contains('Cancel');
381 const crOnHold = `Test process ${Math.floor(Math.random() * 999999)}`;
382 const fakeCrOnHoldUuid = 'zzzzz-dz642-000000000000003';
383 createContainerRequest(
387 ['echo', 'hello world'],
389 .then(function(containerRequest) {
390 // Fake container uuid
391 cy.intercept({method: 'GET', url: `**/arvados/v1/container_requests/${containerRequest.uuid}`}, (req) => {
393 res.body.output_uuid = fakeCrOnHoldUuid;
394 res.body.priority = 0;
395 res.body.state = "Committed";
400 const container = getFakeContainer(fakeCrOnHoldUuid);
401 cy.intercept({method: 'GET', url: `**/arvados/v1/container/${fakeCrOnHoldUuid}`}, {
403 body: {...container, state: "Queued", priority: 0}
406 // Navigate to process and verify cancel button
407 cy.goToPath(`/processes/${containerRequest.uuid}`);
409 cy.get('[data-cy=process-details]').should('contain', crOnHold);
410 cy.get('[data-cy=process-run-button]').should('exist');
411 cy.get('[data-cy=process-cancel-button]').should('not.exist');
418 describe('Logs panel', function() {
419 it('shows live process logs', function() {
420 cy.intercept({method: 'GET', url: '**/arvados/v1/containers/*'}, (req) => {
422 res.body.state = ContainerState.RUNNING;
426 const crName = 'test_container_request';
427 createContainerRequest(
431 ['echo', 'hello world'],
433 .then(function(containerRequest) {
434 cy.loginAs(activeUser);
435 cy.goToPath(`/processes/${containerRequest.uuid}`);
436 cy.get('[data-cy=process-details]').should('contain', crName);
437 cy.get('[data-cy=process-logs]')
438 .should('contain', 'No logs yet')
439 .and('not.contain', 'hello world');
441 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
442 "2023-07-18T20:14:48.128642814Z hello world"
444 cy.get('[data-cy=process-logs]', {timeout: 7000})
445 .should('not.contain', 'No logs yet')
446 .and('contain', 'hello world');
449 cy.appendLog(adminUser.token, containerRequest.uuid, "stderr.txt", [
450 "2023-07-18T20:14:49.128642814Z hello new line"
452 cy.get('[data-cy=process-logs]', {timeout: 7000})
453 .should('not.contain', 'No logs yet')
454 .and('contain', 'hello new line');
459 it('filters process logs by event type', function() {
460 const nodeInfoLogs = [
462 'Linux compute-99cb150b26149780de44b929577e1aed-19rgca8vobuvc4p 5.4.0-1059-azure #62~18.04.1-Ubuntu SMP Tue Sep 14 17:53:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux',
465 'vendor_id : GenuineIntel',
468 'model name : Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz'
470 const crunchRunLogs = [
471 '2022-03-22T13:56:22.542417997Z using local keepstore process (pid 3733) at http://localhost:46837, writing logs to keepstore.txt in log collection',
472 '2022-03-22T13:56:26.237571754Z crunch-run 2.4.0~dev20220321141729 (go1.17.1) started',
473 '2022-03-22T13:56:26.244704134Z crunch-run process has uid=0(root) gid=0(root) groups=0(root)',
474 '2022-03-22T13:56:26.244862836Z Executing container \'zzzzz-dz642-1wokwvcct9s9du3\' using docker runtime',
475 '2022-03-22T13:56:26.245037738Z Executing on host \'compute-99cb150b26149780de44b929577e1aed-19rgca8vobuvc4p\'',
478 '2022-03-22T13:56:22.542417987Z Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dui nisi, hendrerit porta sapien a, pretium dignissim purus.',
479 '2022-03-22T13:56:22.542417997Z Integer viverra, mauris finibus aliquet ultricies, dui mauris cursus justo, ut venenatis nibh ex eget neque.',
480 '2022-03-22T13:56:22.542418007Z In hac habitasse platea dictumst.',
481 '2022-03-22T13:56:22.542418027Z Fusce fringilla turpis id accumsan faucibus. Donec congue congue ex non posuere. In semper mi quis tristique rhoncus.',
482 '2022-03-22T13:56:22.542418037Z Interdum et malesuada fames ac ante ipsum primis in faucibus.',
483 '2022-03-22T13:56:22.542418047Z Quisque fermentum tortor ex, ut suscipit velit feugiat faucibus.',
484 '2022-03-22T13:56:22.542418057Z Donec vitae porta risus, at luctus nulla. Mauris gravida iaculis ipsum, id sagittis tortor egestas ac.',
485 '2022-03-22T13:56:22.542418067Z Maecenas condimentum volutpat nulla. Integer lacinia maximus risus eu posuere.',
486 '2022-03-22T13:56:22.542418077Z Donec vitae leo id augue gravida bibendum.',
487 '2022-03-22T13:56:22.542418087Z Nam libero libero, pretium ac faucibus elementum, mattis nec ex.',
488 '2022-03-22T13:56:22.542418097Z Nullam id laoreet nibh. Vivamus tellus metus, pretium quis justo ut, bibendum varius metus. Pellentesque vitae accumsan lorem, quis tincidunt augue.',
489 '2022-03-22T13:56:22.542418107Z Aliquam viverra nisi nulla, et efficitur dolor mattis in.',
490 '2022-03-22T13:56:22.542418117Z Sed at enim sit amet nulla tincidunt mattis. Aenean eget aliquet ex, non ultrices ex. Nulla ex tortor, vestibulum aliquam tempor ac, aliquam vel est.',
491 '2022-03-22T13:56:22.542418127Z Fusce auctor faucibus libero id venenatis. Etiam sodales, odio eu cursus efficitur, quam sem blandit ex, quis porttitor enim dui quis lectus. In id tincidunt felis.',
492 '2022-03-22T13:56:22.542418137Z Phasellus non ex quis arcu tempus faucibus molestie in sapien.',
493 '2022-03-22T13:56:22.542418147Z Duis tristique semper dolor, vitae pulvinar risus.',
494 '2022-03-22T13:56:22.542418157Z Aliquam tortor elit, luctus nec tortor eget, porta tristique nulla.',
495 '2022-03-22T13:56:22.542418167Z Nulla eget mollis ipsum.',
498 createContainerRequest(
500 'test_container_request',
502 ['echo', 'hello world'],
504 .then(function(containerRequest) {
505 cy.appendLog(adminUser.token, containerRequest.uuid, "node-info.txt", nodeInfoLogs).as('nodeInfoLogs');
506 cy.appendLog(adminUser.token, containerRequest.uuid, "crunch-run.txt", crunchRunLogs).as('crunchRunLogs');
507 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", stdoutLogs).as('stdoutLogs');
509 cy.getAll('@stdoutLogs', '@nodeInfoLogs', '@crunchRunLogs').then(function() {
510 cy.loginAs(activeUser);
511 cy.goToPath(`/processes/${containerRequest.uuid}`);
512 // Should show main logs by default
513 cy.get('[data-cy=process-logs-filter]', {timeout: 7000}).should('contain', 'Main logs');
514 cy.get('[data-cy=process-logs]')
515 .should('contain', stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
516 .and('not.contain', nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
517 .and('contain', crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
519 cy.get('[data-cy=process-logs-filter]').click();
520 cy.get('body').contains('li', 'All logs').click();
521 cy.get('[data-cy=process-logs]')
522 .should('contain', stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
523 .and('contain', nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
524 .and('contain', crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
525 // Select 'node-info' logs
526 cy.get('[data-cy=process-logs-filter]').click();
527 cy.get('body').contains('li', 'node-info').click();
528 cy.get('[data-cy=process-logs]')
529 .should('not.contain', stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
530 .and('contain', nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
531 .and('not.contain', crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
532 // Select 'stdout' logs
533 cy.get('[data-cy=process-logs-filter]').click();
534 cy.get('body').contains('li', 'stdout').click();
535 cy.get('[data-cy=process-logs]')
536 .should('contain', stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
537 .and('not.contain', nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
538 .and('not.contain', crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
543 it('sorts combined logs', function() {
544 const crName = 'test_container_request';
545 createContainerRequest(
549 ['echo', 'hello world'],
551 .then(function(containerRequest) {
552 cy.appendLog(adminUser.token, containerRequest.uuid, "node-info.txt", [
560 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
561 "2023-07-18T20:14:48.128642814Z first",
562 "2023-07-18T20:14:49.128642814Z third"
565 cy.appendLog(adminUser.token, containerRequest.uuid, "stderr.txt", [
566 "2023-07-18T20:14:48.528642814Z second"
569 cy.loginAs(activeUser);
570 cy.goToPath(`/processes/${containerRequest.uuid}`);
571 cy.get('[data-cy=process-details]').should('contain', crName);
572 cy.get('[data-cy=process-logs]')
573 .should('contain', 'No logs yet');
575 cy.getAll('@node-info', '@stdout', '@stderr').then(() => {
576 // Verify sorted main logs
577 cy.get('[data-cy=process-logs] pre', {timeout: 7000})
578 .eq(0).should('contain', '2023-07-18T20:14:48.128642814Z first');
579 cy.get('[data-cy=process-logs] pre')
580 .eq(1).should('contain', '2023-07-18T20:14:48.528642814Z second');
581 cy.get('[data-cy=process-logs] pre')
582 .eq(2).should('contain', '2023-07-18T20:14:49.128642814Z third');
584 // Switch to All logs
585 cy.get('[data-cy=process-logs-filter]').click();
586 cy.get('body').contains('li', 'All logs').click();
587 // Verify non-sorted lines were preserved
588 cy.get('[data-cy=process-logs] pre')
589 .eq(0).should('contain', '3: nodeinfo 1');
590 cy.get('[data-cy=process-logs] pre')
591 .eq(1).should('contain', '2: nodeinfo 2');
592 cy.get('[data-cy=process-logs] pre')
593 .eq(2).should('contain', '1: nodeinfo 3');
594 cy.get('[data-cy=process-logs] pre')
595 .eq(3).should('contain', '2: nodeinfo 4');
596 cy.get('[data-cy=process-logs] pre')
597 .eq(4).should('contain', '3: nodeinfo 5');
598 // Verify sorted logs
599 cy.get('[data-cy=process-logs] pre')
600 .eq(5).should('contain', '2023-07-18T20:14:48.128642814Z first');
601 cy.get('[data-cy=process-logs] pre')
602 .eq(6).should('contain', '2023-07-18T20:14:48.528642814Z second');
603 cy.get('[data-cy=process-logs] pre')
604 .eq(7).should('contain', '2023-07-18T20:14:49.128642814Z third');
609 it('correctly generates sniplines', function() {
610 const SNIPLINE = `================ ✀ ================ ✀ ========= Some log(s) were skipped ========= ✀ ================ ✀ ================`;
611 const crName = 'test_container_request';
612 createContainerRequest(
616 ['echo', 'hello world'],
618 .then(function(containerRequest) {
620 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
621 'X'.repeat(63999) + '_' +
623 '_' + 'X'.repeat(63999)
626 cy.loginAs(activeUser);
627 cy.goToPath(`/processes/${containerRequest.uuid}`);
628 cy.get('[data-cy=process-details]').should('contain', crName);
629 cy.get('[data-cy=process-logs]')
630 .should('contain', 'No logs yet');
632 // Switch to stdout since lines are unsortable (no timestamp)
633 cy.get('[data-cy=process-logs-filter]').click();
634 cy.get('body').contains('li', 'stdout').click();
636 cy.getAll('@stdout').then(() => {
637 // Verify first 64KB and snipline
638 cy.get('[data-cy=process-logs] pre', {timeout: 7000})
639 .eq(0).should('contain', 'X'.repeat(63999) + '_\n' + SNIPLINE);
641 cy.get('[data-cy=process-logs] pre')
642 .eq(1).should('contain', '_' + 'X'.repeat(63999));
643 // Verify none of the Os got through
644 cy.get('[data-cy=process-logs] pre')
645 .should('not.contain', 'O');
652 describe('I/O panel', function() {
656 "id": "#main/input_file",
657 "label": "Label Description",
662 "basename": "input1.tar",
664 "location": "keep:00000000000000000000000000000000+01/input1.tar",
667 "basename": "input1-2.txt",
669 "location": "keep:00000000000000000000000000000000+01/input1-2.txt"
672 "basename": "input1-3.txt",
674 "location": "keep:00000000000000000000000000000000+01/input1-3.txt"
677 "basename": "input1-4.txt",
679 "location": "keep:00000000000000000000000000000000+01/input1-4.txt"
687 "id": "#main/input_dir",
688 "doc": "Doc Description",
693 "basename": "11111111111111111111111111111111+01",
694 "class": "Directory",
695 "location": "keep:11111111111111111111111111111111+01"
701 "id": "#main/input_bool",
702 "doc": ["Doc desc 1", "Doc desc 2"],
711 "id": "#main/input_int",
720 "id": "#main/input_long",
729 "id": "#main/input_float",
738 "id": "#main/input_double",
747 "id": "#main/input_string",
751 "input_string": "Hello World",
756 "id": "#main/input_file_array",
763 "input_file_array": [
765 "basename": "input2.tar",
767 "location": "keep:00000000000000000000000000000000+02/input2.tar"
770 "basename": "input3.tar",
772 "location": "keep:00000000000000000000000000000000+03/input3.tar",
775 "basename": "input3-2.txt",
777 "location": "keep:00000000000000000000000000000000+03/input3-2.txt"
782 "$import": "import_path"
789 "id": "#main/input_dir_array",
791 "items": "Directory",
798 "basename": "11111111111111111111111111111111+02",
799 "class": "Directory",
800 "location": "keep:11111111111111111111111111111111+02"
803 "basename": "11111111111111111111111111111111+03",
804 "class": "Directory",
805 "location": "keep:11111111111111111111111111111111+03"
808 "$import": "import_path"
815 "id": "#main/input_int_array",
827 "$import": "import_path"
834 "id": "#main/input_long_array",
841 "input_long_array": [
845 "$import": "import_path"
852 "id": "#main/input_float_array",
859 "input_float_array": [
864 "$import": "import_path"
871 "id": "#main/input_double_array",
878 "input_double_array": [
883 "$import": "import_path"
890 "id": "#main/input_string_array",
897 "input_string_array": [
902 "$import": "import_path"
909 "id": "#main/input_bool_include",
913 "input_bool_include": {
914 "$include": "include_path"
920 "id": "#main/input_int_include",
924 "input_int_include": {
925 "$include": "include_path"
931 "id": "#main/input_float_include",
935 "input_float_include": {
936 "$include": "include_path"
942 "id": "#main/input_string_include",
946 "input_string_include": {
947 "$include": "include_path"
953 "id": "#main/input_file_include",
957 "input_file_include": {
958 "$include": "include_path"
964 "id": "#main/input_directory_include",
968 "input_directory_include": {
969 "$include": "include_path"
975 "id": "#main/input_file_url",
980 "basename": "index.html",
982 "location": "http://example.com/index.html"
988 const testOutputs = [
991 "id": "#main/output_file",
992 "label": "Label Description",
997 "basename": "cat.png",
999 "location": "cat.png"
1005 "id": "#main/output_file_with_secondary",
1006 "doc": "Doc Description",
1010 "output_file_with_secondary": {
1011 "basename": "main.dat",
1013 "location": "main.dat",
1016 "basename": "secondary.dat",
1018 "location": "secondary.dat"
1021 "basename": "secondary2.dat",
1023 "location": "secondary2.dat"
1031 "id": "#main/output_dir",
1032 "doc": ["Doc desc 1", "Doc desc 2"],
1037 "basename": "outdir1",
1038 "class": "Directory",
1039 "location": "outdir1"
1045 "id": "#main/output_bool",
1054 "id": "#main/output_int",
1063 "id": "#main/output_long",
1072 "id": "#main/output_float",
1076 "output_float": 100.5
1081 "id": "#main/output_double",
1085 "output_double": 100.3
1090 "id": "#main/output_string",
1094 "output_string": "Hello output"
1099 "id": "#main/output_file_array",
1106 "output_file_array": [
1108 "basename": "output2.tar",
1110 "location": "output2.tar"
1113 "basename": "output3.tar",
1115 "location": "output3.tar"
1122 "id": "#main/output_dir_array",
1124 "items": "Directory",
1129 "output_dir_array": [
1131 "basename": "outdir2",
1132 "class": "Directory",
1133 "location": "outdir2"
1136 "basename": "outdir3",
1137 "class": "Directory",
1138 "location": "outdir3"
1145 "id": "#main/output_int_array",
1152 "output_int_array": [
1161 "id": "#main/output_long_array",
1168 "output_long_array": [
1176 "id": "#main/output_float_array",
1183 "output_float_array": [
1192 "id": "#main/output_double_array",
1199 "output_double_array": [
1208 "id": "#main/output_string_array",
1215 "output_string_array": [
1224 const verifyIOParameter = (name, label, doc, val, collection, multipleRows) => {
1225 cy.get('table tr').contains(name).parents('tr').within(($mainRow) => {
1226 label && cy.contains(label);
1229 cy.get($mainRow).nextUntil('[data-cy="process-io-param"]').as('secondaryRows');
1231 if (Array.isArray(val)) {
1232 val.forEach(v => cy.get('@secondaryRows').contains(v));
1234 cy.get('@secondaryRows').contains(val);
1238 cy.get('@secondaryRows').contains(collection);
1242 if (Array.isArray(val)) {
1243 val.forEach(v => cy.contains(v));
1249 cy.contains(collection);
1257 const verifyIOParameterImage = (name, url) => {
1258 cy.get('table tr').contains(name).parents('tr').within(() => {
1259 cy.get('[alt="Inline Preview"]')
1260 .should('be.visible')
1262 expect($img[0].naturalWidth).to.be.greaterThan(0);
1263 expect($img[0].src).contains(url);
1268 it('displays IO parameters with keep links and previews', function() {
1269 // Create output collection for real files
1270 cy.createCollection(adminUser.token, {
1271 name: `Test collection ${Math.floor(Math.random() * 999999)}`,
1272 owner_uuid: activeUser.user.uuid,
1273 }).then((testOutputCollection) => {
1274 cy.loginAs(activeUser);
1276 cy.goToPath(`/collections/${testOutputCollection.uuid}`);
1278 cy.get('[data-cy=upload-button]').click();
1280 cy.fixture('files/cat.png', 'base64').then(content => {
1281 cy.get('[data-cy=drag-and-drop]').upload(content, 'cat.png');
1282 cy.get('[data-cy=form-submit-btn]').click();
1283 cy.waitForDom().get('[data-cy=form-submit-btn]').should('not.exist');
1284 // Confirm final collection state.
1285 cy.get('[data-cy=collection-files-panel]')
1286 .contains('cat.png').should('exist');
1289 cy.getCollection(activeUser.token, testOutputCollection.uuid).as('testOutputCollection');
1292 // Get updated collection pdh
1293 cy.getAll('@testOutputCollection').then(([testOutputCollection]) => {
1294 // Add output uuid and inputs to container request
1295 cy.intercept({method: 'GET', url: '**/arvados/v1/container_requests/*'}, (req) => {
1296 req.reply((res) => {
1297 res.body.output_uuid = testOutputCollection.uuid;
1298 res.body.mounts["/var/lib/cwl/cwl.input.json"] = {
1299 content: testInputs.map((param) => (param.input)).reduce((acc, val) => (Object.assign(acc, val)), {})
1301 res.body.mounts["/var/lib/cwl/workflow.json"] = {
1305 inputs: testInputs.map((input) => (input.definition)),
1306 outputs: testOutputs.map((output) => (output.definition))
1313 // Stub fake output collection
1314 cy.intercept({method: 'GET', url: `**/arvados/v1/collections/${testOutputCollection.uuid}*`}, {
1317 uuid: testOutputCollection.uuid,
1318 portable_data_hash: testOutputCollection.portable_data_hash,
1322 // Stub fake output json
1323 cy.intercept({method: 'GET', url: '**/c%3Dzzzzz-4zz18-zzzzzzzzzzzzzzz/cwl.output.json'}, {
1325 body: testOutputs.map((param) => (param.output)).reduce((acc, val) => (Object.assign(acc, val)), {})
1328 // Stub webdav response, points to output json
1329 cy.intercept({method: 'PROPFIND', url: '*'}, {
1330 fixture: 'webdav-propfind-outputs.xml',
1334 createContainerRequest(
1336 'test_container_request',
1338 ['echo', 'hello world'],
1340 .as('containerRequest');
1342 cy.getAll('@containerRequest', '@testOutputCollection').then(function([containerRequest, testOutputCollection]) {
1343 cy.goToPath(`/processes/${containerRequest.uuid}`);
1344 cy.get('[data-cy=process-io-card] h6').contains('Inputs')
1345 .parents('[data-cy=process-io-card]').within(() => {
1346 verifyIOParameter('input_file', null, "Label Description", 'input1.tar', '00000000000000000000000000000000+01');
1347 verifyIOParameter('input_file', null, "Label Description", 'input1-2.txt', undefined, true);
1348 verifyIOParameter('input_file', null, "Label Description", 'input1-3.txt', undefined, true);
1349 verifyIOParameter('input_file', null, "Label Description", 'input1-4.txt', undefined, true);
1350 verifyIOParameter('input_dir', null, "Doc Description", '/', '11111111111111111111111111111111+01');
1351 verifyIOParameter('input_bool', null, "Doc desc 1, Doc desc 2", 'true');
1352 verifyIOParameter('input_int', null, null, '1');
1353 verifyIOParameter('input_long', null, null, '1');
1354 verifyIOParameter('input_float', null, null, '1.5');
1355 verifyIOParameter('input_double', null, null, '1.3');
1356 verifyIOParameter('input_string', null, null, 'Hello World');
1357 verifyIOParameter('input_file_array', null, null, 'input2.tar', '00000000000000000000000000000000+02');
1358 verifyIOParameter('input_file_array', null, null, 'input3.tar', undefined, true);
1359 verifyIOParameter('input_file_array', null, null, 'input3-2.txt', undefined, true);
1360 verifyIOParameter('input_file_array', null, null, 'Cannot display value', undefined, true);
1361 verifyIOParameter('input_dir_array', null, null, '/', '11111111111111111111111111111111+02');
1362 verifyIOParameter('input_dir_array', null, null, '/', '11111111111111111111111111111111+03', true);
1363 verifyIOParameter('input_dir_array', null, null, 'Cannot display value', undefined, true);
1364 verifyIOParameter('input_int_array', null, null, ["1", "3", "5", "Cannot display value"]);
1365 verifyIOParameter('input_long_array', null, null, ["10", "20", "Cannot display value"]);
1366 verifyIOParameter('input_float_array', null, null, ["10.2", "10.4", "10.6", "Cannot display value"]);
1367 verifyIOParameter('input_double_array', null, null, ["20.1", "20.2", "20.3", "Cannot display value"]);
1368 verifyIOParameter('input_string_array', null, null, ["Hello", "World", "!", "Cannot display value"]);
1369 verifyIOParameter('input_bool_include', null, null, "Cannot display value");
1370 verifyIOParameter('input_int_include', null, null, "Cannot display value");
1371 verifyIOParameter('input_float_include', null, null, "Cannot display value");
1372 verifyIOParameter('input_string_include', null, null, "Cannot display value");
1373 verifyIOParameter('input_file_include', null, null, "Cannot display value");
1374 verifyIOParameter('input_directory_include', null, null, "Cannot display value");
1375 verifyIOParameter('input_file_url', null, null, "http://example.com/index.html");
1377 cy.get('[data-cy=process-io-card] h6').contains('Outputs')
1378 .parents('[data-cy=process-io-card]').within((ctx) => {
1379 cy.get(ctx).scrollIntoView();
1380 cy.get('[data-cy="io-preview-image-toggle"]').click({waitForAnimations: false});
1381 const outPdh = testOutputCollection.portable_data_hash;
1383 verifyIOParameter('output_file', null, "Label Description", 'cat.png', `${outPdh}`);
1384 verifyIOParameterImage('output_file', `/c=${outPdh}/cat.png`);
1385 verifyIOParameter('output_file_with_secondary', null, "Doc Description", 'main.dat', `${outPdh}`);
1386 verifyIOParameter('output_file_with_secondary', null, "Doc Description", 'secondary.dat', undefined, true);
1387 verifyIOParameter('output_file_with_secondary', null, "Doc Description", 'secondary2.dat', undefined, true);
1388 verifyIOParameter('output_dir', null, "Doc desc 1, Doc desc 2", 'outdir1', `${outPdh}`);
1389 verifyIOParameter('output_bool', null, null, 'true');
1390 verifyIOParameter('output_int', null, null, '1');
1391 verifyIOParameter('output_long', null, null, '1');
1392 verifyIOParameter('output_float', null, null, '100.5');
1393 verifyIOParameter('output_double', null, null, '100.3');
1394 verifyIOParameter('output_string', null, null, 'Hello output');
1395 verifyIOParameter('output_file_array', null, null, 'output2.tar', `${outPdh}`);
1396 verifyIOParameter('output_file_array', null, null, 'output3.tar', undefined, true);
1397 verifyIOParameter('output_dir_array', null, null, 'outdir2', `${outPdh}`);
1398 verifyIOParameter('output_dir_array', null, null, 'outdir3', undefined, true);
1399 verifyIOParameter('output_int_array', null, null, ["10", "11", "12"]);
1400 verifyIOParameter('output_long_array', null, null, ["51", "52"]);
1401 verifyIOParameter('output_float_array', null, null, ["100.2", "100.4", "100.6"]);
1402 verifyIOParameter('output_double_array', null, null, ["100.1", "100.2", "100.3"]);
1403 verifyIOParameter('output_string_array', null, null, ["Hello", "Output", "!"]);
1408 it('displays IO parameters with no value', function() {
1410 const fakeOutputUUID = 'zzzzz-4zz18-abcdefghijklmno';
1411 const fakeOutputPDH = '11111111111111111111111111111111+99/';
1413 cy.loginAs(activeUser);
1415 // Add output uuid and inputs to container request
1416 cy.intercept({method: 'GET', url: '**/arvados/v1/container_requests/*'}, (req) => {
1417 req.reply((res) => {
1418 res.body.output_uuid = fakeOutputUUID;
1419 res.body.mounts["/var/lib/cwl/cwl.input.json"] = {
1422 res.body.mounts["/var/lib/cwl/workflow.json"] = {
1426 inputs: testInputs.map((input) => (input.definition)),
1427 outputs: testOutputs.map((output) => (output.definition))
1434 // Stub fake output collection
1435 cy.intercept({method: 'GET', url: `**/arvados/v1/collections/${fakeOutputUUID}*`}, {
1438 uuid: fakeOutputUUID,
1439 portable_data_hash: fakeOutputPDH,
1443 // Stub fake output json
1444 cy.intercept({method: 'GET', url: `**/c%3D${fakeOutputUUID}/cwl.output.json`}, {
1449 cy.readFile('cypress/fixtures/webdav-propfind-outputs.xml').then((data) => {
1450 // Stub webdav response, points to output json
1451 cy.intercept({method: 'PROPFIND', url: '*'}, {
1453 body: data.replace(/zzzzz-4zz18-zzzzzzzzzzzzzzz/g, fakeOutputUUID)
1457 createContainerRequest(
1459 'test_container_request',
1461 ['echo', 'hello world'],
1463 .as('containerRequest');
1465 cy.getAll('@containerRequest').then(function([containerRequest]) {
1466 cy.goToPath(`/processes/${containerRequest.uuid}`);
1467 cy.get('[data-cy=process-io-card] h6').contains('Inputs')
1468 .parents('[data-cy=process-io-card]').within(() => {
1471 cy.get('tbody tr').each((item) => {
1472 cy.wrap(item).contains('No value');
1475 cy.get('[data-cy=process-io-card] h6').contains('Outputs')
1476 .parents('[data-cy=process-io-card]').within(() => {
1477 cy.get('tbody tr').each((item) => {
1478 cy.wrap(item).contains('No value');