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
+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"])