[ARVADOS] created: f35ca630699460653f03702afec4a57866130421

Git user git at public.curoverse.com
Thu Aug 25 22:36:17 EDT 2016


        at  f35ca630699460653f03702afec4a57866130421 (commit)


commit f35ca630699460653f03702afec4a57866130421
Author: radhika <radhika at curoverse.com>
Date:   Thu Aug 25 22:35:49 2016 -0400

    9043: added tests for various input types

diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index e5bc0bf..981b7cd 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -536,7 +536,7 @@ module ApplicationHelper
                      :id => id
                    }.merge(htmloptions)
     elsif primary_type.is_a? String
-      if ["float", "double", "int", "long"].include? primary_type
+      if ["int", "long"].include? primary_type
         datatype = "number"
       else
         datatype = "text"
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 3edd660..686b63b 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -338,7 +338,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
   [
     ['Two Part Pipeline Template', 'part-one', 'Provide a value for the following'],
-    ['Workflow with input specifications', 'this work has inputs specified', 'This container is uncommitted'],
+    ['Workflow with input specifications', 'this workflow has inputs specified', 'Provide a value for the following'],
   ].each do |template_name, preview_txt, process_txt|
     test "run a process using template #{template_name} from dashboard" do
       visit page_with_token('admin')
diff --git a/apps/workbench/test/integration/container_requests_test.rb b/apps/workbench/test/integration/container_requests_test.rb
index 232f33c..86b8b05 100644
--- a/apps/workbench/test/integration/container_requests_test.rb
+++ b/apps/workbench/test/integration/container_requests_test.rb
@@ -5,22 +5,99 @@ class ContainerRequestsTest < ActionDispatch::IntegrationTest
     need_javascript
   end
 
-  test "enter a float for a number workflow input" do
-    # Poltergeist either does not support the HTML 5 <input
-    # type="number">, or interferes with the associated X-Editable
-    # validation code.  If the input field has type=number (forcing an
-    # integer), this test will yield a false positive under
-    # Poltergeist.  --Brett, 2015-02-05
-    need_selenium "for strict X-Editable input validation"
+  [
+    ['ex_string', 'abc'],
+    ['ex_string_opt', 'abc'],
+    ['ex_int', 12],
+    ['ex_int_opt', 12],
+    ['ex_long', 12],
+    ['ex_double', 12.34],
+    ['ex_double', 'abc', true, 0.0],
+    ['ex_float', 12.34],
+    ['ex_float', 'abc', true, 0.0],
+  ].each do |input_id, input_value, need_refresh, expected|
+    test "set input #{input_id} with #{input_value}" do
+      request_uuid = api_fixture("container_requests", "uncommitted", "uuid")
+      visit page_with_token("active", "/container_requests/#{request_uuid}")
+      selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][#{input_id}]']"
+      find(selector).click
+      find(".editable-input input").set(input_value)
+      find("#editable-submit").click
+      assert_no_selector(".editable-popup")
+      assert_selector(selector, text: input_value)
+      if need_refresh
+        visit page_with_token("active", "/container_requests/#{request_uuid}")
+        assert_selector(selector, text: expected)
+      end
+    end
+  end
+
+  test "select value for boolean input" do
+    request_uuid = api_fixture("container_requests", "uncommitted", "uuid")
+    visit page_with_token("active", "/container_requests/#{request_uuid}")
+    selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][ex_boolean]']"
+    find(selector).click
+    within(".editable-input") do
+      select "true"
+    end
+    find("#editable-submit").click
+    assert_no_selector(".editable-popup")
+    assert_selector(selector, text: "true")
+  end
+
+  test "select value for enum typed input" do
     request_uuid = api_fixture("container_requests", "uncommitted", "uuid")
     visit page_with_token("active", "/container_requests/#{request_uuid}")
-    INPUT_SELECTOR =
-      ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][ex_double]']"
-    find(INPUT_SELECTOR).click
-    find(".editable-input input").set("12.34")
+    selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][ex_enum]']"
+    find(selector).click
+    within(".editable-input") do
+      select "b"    # second value
+    end
     find("#editable-submit").click
     assert_no_selector(".editable-popup")
-    assert_selector(INPUT_SELECTOR, text: "12.34")
+    assert_selector(selector, text: "b")
   end
 
+  [
+    ['directory_type'],
+    ['file_type'],
+  ].each do |type|
+    test "select input for #{type}" do
+      request_uuid = api_fixture("container_requests", "uncommitted-with-directory-input", "uuid")
+      visit page_with_token("active", "/container_requests/#{request_uuid}")
+      assert_text 'Provide a value for the following parameter'
+      click_link 'Choose'
+      within('.modal-dialog') do
+        wait_for_ajax
+        collection = api_fixture('collections', 'collection_with_one_property', 'uuid')
+        find("div[data-object-uuid=#{collection}]").click
+        if type == 'ex_file'
+          wait_for_ajax
+          find('.preview-selectable', text: 'bar').click
+        end
+        find('button', text: 'OK').click
+      end
+      page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
+      assert_text 'This workflow does not need any further inputs'
+      click_link "Run"
+      wait_for_ajax
+      assert_text 'This container is committed'
+    end
+  end
+
+  test "Run button enabled once all required inputs are provided" do
+    request_uuid = api_fixture("container_requests", "uncommitted-with-required-and-optional-inputs", "uuid")
+    visit page_with_token("active", "/container_requests/#{request_uuid}")
+    assert_text 'Provide a value for the following parameter'
+
+    selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][int_required]']"
+    find(selector).click
+    find(".editable-input input").set(2016)
+    find("#editable-submit").click
+
+    page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
+    click_link "Run"
+    wait_for_ajax
+    assert_text 'This container is committed'
+  end
 end
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index 626bd50..e5877ac 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -740,7 +740,7 @@ class ProjectsTest < ActionDispatch::IntegrationTest
 
   [
     ['Two Part Pipeline Template', 'part-one', 'Provide a value for the following'],
-    ['Workflow with input specifications', 'this work has inputs specified', 'This container is uncommitted'],
+    ['Workflow with input specifications', 'this workflow has inputs specified', 'Provide a value for the following'],
   ].each do |template_name, preview_txt, process_txt|
     test "run a process using template #{template_name} in a project" do
       project = api_fixture('groups')['aproject']
diff --git a/services/api/test/fixtures/container_requests.yml b/services/api/test/fixtures/container_requests.yml
index 1e5bb7b..64b11fe 100644
--- a/services/api/test/fixtures/container_requests.yml
+++ b/services/api/test/fixtures/container_requests.yml
@@ -454,6 +454,160 @@ uncommitted_ready_to_run:
     ram: 256000000
     API: true
 
+uncommitted-with-directory-input:
+  uuid: zzzzz-xvhdp-cr4uncommitted2
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  name: uncommitted with directory input
+  created_at: 2016-01-11 11:11:11.111111111 Z
+  updated_at: 2016-01-11 11:11:11.111111111 Z
+  modified_at: 2016-01-11 11:11:11.111111111 Z
+  modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  command: ["arvados-cwl-runner", "--local", "--api=containers",
+            "/var/lib/cwl/workflow.json", "/var/lib/cwl/cwl.input.json"]
+  output_path: "/var/spool/cwl"
+  cwd: "/var/spool/cwl"
+  priority: 1
+  state: Uncommitted
+  container_image: fa3c1a9cb6783f85f2ecda037e07b8c3+167
+  mounts: {
+        "/var/lib/cwl/workflow.json": {
+            "kind": "json",
+            "content": {
+                "cwlVersion": "v1.0",
+                "class": "CommandLineTool",
+                "baseCommand": ["echo"],
+                "inputs": [
+                    {
+                        "type": "Directory",
+                        "id": "directory_type",
+                        "inputBinding": {"position": 1}
+                    }
+                ],
+                "outputs": []
+            }
+        },
+        "/var/lib/cwl/cwl.input.json": {
+            "kind": "json",
+            "content": {}
+        },
+        "stdout": {
+            "kind": "file",
+            "path": "/var/spool/cwl/cwl.output.json"
+        },
+        "/var/spool/cwl": {
+            "kind": "collection",
+            "writable": true
+        }
+    }
+  runtime_constraints:
+    vcpus: 1
+    ram: 256000000
+    API: true
+
+uncommitted-with-file-input:
+  uuid: zzzzz-xvhdp-cr4uncommittedf
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  name: uncommitted with directory input
+  created_at: 2016-01-11 11:11:11.111111111 Z
+  updated_at: 2016-01-11 11:11:11.111111111 Z
+  modified_at: 2016-01-11 11:11:11.111111111 Z
+  modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  command: ["arvados-cwl-runner", "--local", "--api=containers",
+            "/var/lib/cwl/workflow.json", "/var/lib/cwl/cwl.input.json"]
+  output_path: "/var/spool/cwl"
+  cwd: "/var/spool/cwl"
+  priority: 1
+  state: Uncommitted
+  container_image: fa3c1a9cb6783f85f2ecda037e07b8c3+167
+  mounts: {
+        "/var/lib/cwl/workflow.json": {
+            "kind": "json",
+            "content": {
+                "cwlVersion": "v1.0",
+                "class": "CommandLineTool",
+                "baseCommand": ["echo"],
+                "inputs": [
+                    {
+                        "type": "File",
+                        "id": "file_type",
+                        "inputBinding": {"position": 1}
+                    }
+                ],
+                "outputs": []
+            }
+        },
+        "/var/lib/cwl/cwl.input.json": {
+            "kind": "json",
+            "content": {}
+        },
+        "stdout": {
+            "kind": "file",
+            "path": "/var/spool/cwl/cwl.output.json"
+        },
+        "/var/spool/cwl": {
+            "kind": "collection",
+            "writable": true
+        }
+    }
+  runtime_constraints:
+    vcpus: 1
+    ram: 256000000
+    API: true
+
+uncommitted-with-required-and-optional-inputs:
+  uuid: zzzzz-xvhdp-cr4uncommitted3
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  name: uncommitted with required and optional inputs
+  created_at: 2016-01-11 11:11:11.111111111 Z
+  updated_at: 2016-01-11 11:11:11.111111111 Z
+  modified_at: 2016-01-11 11:11:11.111111111 Z
+  modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  command: ["arvados-cwl-runner", "--local", "--api=containers",
+            "/var/lib/cwl/workflow.json", "/var/lib/cwl/cwl.input.json"]
+  output_path: "/var/spool/cwl"
+  cwd: "/var/spool/cwl"
+  priority: 1
+  state: Uncommitted
+  container_image: fa3c1a9cb6783f85f2ecda037e07b8c3+167
+  mounts: {
+        "/var/lib/cwl/workflow.json": {
+            "kind": "json",
+            "content": {
+                "cwlVersion": "v1.0",
+                "class": "CommandLineTool",
+                "baseCommand": ["echo"],
+                "inputs": [
+                    {
+                        "type": "int",
+                        "id": "int_required",
+                        "inputBinding": {"position": 1}
+                    },
+                    {
+                        "type": ["null", "int"],
+                        "id": "int_optional",
+                        "inputBinding": {"position": 1}
+                    }
+                ],
+                "outputs": []
+            }
+        },
+        "/var/lib/cwl/cwl.input.json": {
+            "kind": "json",
+            "content": {}
+        },
+        "stdout": {
+            "kind": "file",
+            "path": "/var/spool/cwl/cwl.output.json"
+        },
+        "/var/spool/cwl": {
+            "kind": "collection",
+            "writable": true
+        }
+    }
+  runtime_constraints:
+    vcpus: 1
+    ram: 256000000
+    API: true
 
 # Test Helper trims the rest of the file
 
diff --git a/services/api/test/fixtures/workflows.yml b/services/api/test/fixtures/workflows.yml
index 8e32409..87a343d 100644
--- a/services/api/test/fixtures/workflows.yml
+++ b/services/api/test/fixtures/workflows.yml
@@ -2,7 +2,7 @@ workflow_with_workflow_yml:
   uuid: zzzzz-7fd4e-validworkfloyml
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   name: Valid workflow with name and desc
-  description: this work has a valid workflow yaml
+  description: this workflow has a valid workflow yaml
   workflow: "name: foo\ndesc: bar"
   created_at: 2016-08-15 12:00:00
 
@@ -23,7 +23,7 @@ workflow_with_input_specifications:
   uuid: zzzzz-7fd4e-validwithinputs
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   name: Workflow with input specifications
-  description: this work has inputs specified
+  description: this workflow has inputs specified
   created_at: <%= 1.minute.ago.to_s(:db) %>
   workflow:
     cwlVersion: v1.0

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list