Dataset collection state UX test case.

This commit is contained in:
John Chilton
2017-11-30 10:02:03 -05:00
parent 0dceb5a553
commit ca09e803ae
10 changed files with 218 additions and 10 deletions
+1 -5
View File
@@ -206,11 +206,7 @@ class ToolsTestCase(api.ApiTestCase):
with self.dataset_populator.test_history() as history_id:
history_id = self.dataset_populator.new_history()
ok_hdca_id = self.dataset_collection_populator.create_list_in_history(history_id, contents=["0", "1", "0", "1"]).json()["id"]
exit_code_inputs = {
"input": {'batch': True, 'values': [{"src": "hdca", "id": ok_hdca_id}]},
}
response = self._run("exit_code_from_file", history_id, exit_code_inputs, assert_ok=False).json()
self.dataset_populator.wait_for_history(history_id, assert_ok=False)
response = self.dataset_populator.run_exit_code_from_file(history_id, ok_hdca_id)
mixed_implicit_collections = response["implicit_collections"]
self.assertEquals(len(mixed_implicit_collections), 1)
+8
View File
@@ -298,6 +298,14 @@ class BaseDatasetPopulator(object):
self.wait_for_history(history_id, assert_ok=True)
return self.run_tool("collection_creates_list", inputs, history_id)
def run_exit_code_from_file(self, history_id, hdca_id):
exit_code_inputs = {
"input": {'batch': True, 'values': [{"src": "hdca", "id": hdca_id}]},
}
response = self.run_tool("exit_code_from_file", exit_code_inputs, history_id, assert_ok=False).json()
self.wait_for_history(history_id, assert_ok=False)
return response
def __history_content_id(self, history_id, wait=True, **kwds):
if wait:
assert_ok = kwds.get("assert_ok", True)
@@ -1,14 +1,16 @@
<tool id="collection_creates_dynamic_nested" name="collection_creates_dynamic_nested" version="0.1.0">
<command>
<command><![CDATA[
echo "A" > oe1_ie1.fq ;
echo "B" > oe1_ie2.fq ;
echo "C" > oe2_ie1.fq ;
echo "D" > oe2_ie2.fq ;
echo "E" > oe3_ie1.fq ;
echo "F" > oe3_ie2.fq
</command>
echo "F" > oe3_ie2.fq ;
sleep '$sleep_time';
]]></command>
<inputs>
<param name="foo" type="text" label="Dummy Parameter" />
<param name="sleep_time" type="integer" label="Sleep Time" value="0" />
</inputs>
<outputs>
<collection name="list_output" type="list:list" label="Duplicate List">
@@ -12,7 +12,7 @@
<param name="foo" type="text" label="Dummy Parameter" />
</inputs>
<outputs>
<collection name="list_output" type="list:list" label="Duplicate List">
<collection name="list_output" type="list:list" label="Failed List">
<!-- Use named regex group to grab pattern
<identifier_0>_<identifier_1>.fq. Here identifier_0 is the list
identifier of the outer list and identifier_1 is the list identifier
+3
View File
@@ -843,6 +843,9 @@ class NavigatesGalaxy(HasDriver):
menu_selection_element = self.wait_for_sizzle_selector_clickable(menu_item_sizzle_selector)
menu_selection_element.click()
def history_panel_click_copy_elements(self):
self.click_history_option("Copy Datasets")
@retry_during_transitions
def histories_click_advanced_search(self):
search_selector = '#standard-search .advanced-search-toggle'
+21
View File
@@ -126,12 +126,33 @@ history_panel:
options_button: '#history-options-button'
options_button_icon: '#history-options-button span.fa-cog'
options_menu: '#history-options-button-menu'
multi_view_button: '#history-view-multi-button'
text:
tooltip_name: 'Click to rename history'
new_name: 'Unnamed history'
new_size: '(empty)'
multi_history_view:
selectors:
_: '.multi-panel-history'
current_label: '.current-label'
create_new_button: '.create-new'
drag_drop_help: '.history-drop-target-help'
history_copy_elements:
selectors:
# Following two don't really work as CSS would only work as jQuery/sizzle I think
# since the page is dynamically generated.
# https://stackoverflow.com/questions/10645552/is-it-possible-to-use-an-input-value-attribute-as-a-css-selector
dataset_checkbox: "input[id='dataset|${id}']"
collection_checkbox: 'input[id="dataset_collection|${id}"]'
new_history_name: '#new_history_name'
copy_button: "input[type='submit']"
done_link: '.donemessage a'
collection_builders:
selectors:
+16 -1
View File
@@ -339,6 +339,14 @@ class SeleniumTestCase(FunctionalTestCase, NavigatesGalaxy, UsesApiTestCaseMixin
with self.main_panel():
self.assert_no_error_message()
@property
def dataset_populator(self):
return SeleniumSessionDatasetPopulator(self)
@property
def dataset_collection_populator(self):
return SeleniumSessionDatasetCollectionPopulator(self)
@property
def workflow_populator(self):
return SeleniumSessionWorkflowPopulator(self)
@@ -465,13 +473,20 @@ class SeleniumSessionGetPostMixin:
"""Mixin for adapting Galaxy testing populators helpers to Selenium session backed bioblend."""
def _get(self, route):
return self.selenium_test_case.api_get(route)
full_url = self.selenium_test_case.build_url("api/" + route, for_selenium=False)
response = requests.get(full_url, cookies=self.selenium_test_case.selenium_to_requests_cookies())
return response
def _post(self, route, data={}):
full_url = self.selenium_test_case.build_url("api/" + route, for_selenium=False)
response = requests.post(full_url, data=data, cookies=self.selenium_test_case.selenium_to_requests_cookies())
return response
def _delete(self, route, data={}):
full_url = self.selenium_test_case.build_url("api/" + route, for_selenium=False)
response = requests.delete(full_url, data=data, cookies=self.selenium_test_case.selenium_to_requests_cookies())
return response
def __url(self, route):
return self._gi.url + "/" + route
@@ -0,0 +1,40 @@
from .framework import (
selenium_test,
SeleniumTestCase
)
class HistoryCopyElementsTestCase(SeleniumTestCase):
ensure_registered = True
@selenium_test
def test_copy_hdca(self):
history_id = self.current_history_id()
input_collection = self.dataset_collection_populator.create_list_in_history(history_id, contents=["0", "1", "0", "1"]).json()
input_hid = input_collection["hid"]
failed_response = self.dataset_populator.run_exit_code_from_file(history_id, input_collection["id"])
failed_collection = failed_response["implicit_collections"][0]
failed_hid = failed_collection["hid"]
self.home()
self.history_panel_wait_for_hid_state(input_hid, "ok")
self.history_panel_wait_for_hid_state(failed_hid, "error")
self.history_panel_click_copy_elements()
with self.main_panel():
self.components.history_copy_elements.collection_checkbox(id=input_collection["id"]).wait_for_and_click()
self.components.history_copy_elements.collection_checkbox(id=failed_collection["id"]).wait_for_and_click()
text_element = self.components.history_copy_elements.new_history_name.wait_for_and_click()
text_element.send_keys("newhistfor_copy_hdca")
self.components.history_copy_elements.copy_button.wait_for_and_click()
self.sleep_for(self.wait_types.UX_TRANSITION)
self.components.history_copy_elements.done_link.wait_for_and_click()
# Okay copied first
self.history_panel_wait_for_hid_state(5, "ok")
# Then 4 datasets and then the failed collection (this was six when coming from the original history)
self.history_panel_wait_for_hid_state(10, "error")
@@ -0,0 +1,24 @@
from .framework import (
selenium_test,
SeleniumTestCase
)
class HistoryMultiViewTestCase(SeleniumTestCase):
ensure_registered = True
@selenium_test
def test_create_new_old_slides_next(self):
history_id = self.current_history_id()
input_collection = self.dataset_collection_populator.create_list_in_history(history_id, contents=["0", "1", "0", "1"]).json()
input_hid = input_collection["hid"]
self.home()
hdca_selector = self.history_panel_wait_for_hid_state(input_hid, "ok")
self.components.history_panel.multi_view_button.wait_for_and_click()
self.components.multi_history_view.create_new_button.wait_for_and_click()
self.components.multi_history_view.drag_drop_help.wait_for_visible()
self.wait_for_visible(hdca_selector)
@@ -0,0 +1,99 @@
import time
from base.api_asserts import assert_status_code_is
from .framework import (
selenium_test,
SeleniumTestCase
)
class HistoryPanelCollectionsTestCase(SeleniumTestCase):
ensure_registered = True
@selenium_test
def test_mapping_collection_states(self):
history_id = self.current_history_id()
input_collection = self.dataset_collection_populator.create_list_in_history(history_id, contents=["0", "1", "0", "1"]).json()
input_hid = input_collection["hid"]
# TODO: okay dataset...
failed_response = self.dataset_populator.run_exit_code_from_file(history_id, input_collection["id"])
failed_hid = failed_response["implicit_collections"][0]["hid"]
running_inputs = {
"input1": {'batch': True, 'values': [{"src": "hdca", "id": input_collection["id"]}]},
"sleep_time": 180,
}
running_response = self.dataset_populator.run_tool(
"cat_data_and_sleep",
running_inputs,
history_id,
assert_ok=False,
)
try:
assert_status_code_is(running_response, 200)
running_hid = running_response.json()["implicit_collections"][0]["hid"]
# sleep really shouldn't be needed :(
time.sleep(1)
self.home()
self.history_panel_wait_for_hid_state(input_hid, "ok")
self.history_panel_wait_for_hid_state(failed_hid, "error")
self.history_panel_wait_for_hid_state(running_hid, "running")
self.screenshot("history_panel_collections_state_mapping")
finally:
for job in running_response.json()["jobs"]:
self.dataset_populator.cancel_job(job["id"])
@selenium_test
def test_output_collection_states(self):
history_id = self.current_history_id()
input_collection = self.dataset_collection_populator.create_list_in_history(history_id, contents=["0", "1", "0", "1"]).json()
ok_inputs = {
"input1": {"src": "hdca", "id": input_collection["id"]}
}
ok_response = self.dataset_populator.run_tool(
"collection_creates_list",
ok_inputs,
history_id
)
ok_hid = ok_response["output_collections"][0]["hid"]
failed_response = self.dataset_populator.run_tool(
"collection_creates_dynamic_nested_fail",
{},
history_id,
)
failed_hid = failed_response["output_collections"][0]["hid"]
running_inputs = {
"sleep_time": 180,
}
running_response = self.dataset_populator.run_tool(
"collection_creates_dynamic_nested",
running_inputs,
history_id,
assert_ok=False,
)
try:
assert_status_code_is(running_response, 200)
running_hid = running_response.json()["output_collections"][0]["hid"]
# sleep really shouldn't be needed :(
time.sleep(1)
self.home()
self.history_panel_wait_for_hid_state(ok_hid, "ok")
self.history_panel_wait_for_hid_state(failed_hid, "error")
self.history_panel_wait_for_hid_state(running_hid, "running")
self.screenshot("history_panel_collections_state")
finally:
for job in running_response.json()["jobs"]:
self.dataset_populator.cancel_job(job["id"])