mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Progress on Jupyter Notebook Selenium tests
Break big test into two - one of which will occasionally work against usegalaxy.org now.
This commit is contained in:
@@ -269,6 +269,16 @@ published_grids:
|
||||
selectors:
|
||||
search: '#input-free-text-search-filter'
|
||||
|
||||
gies:
|
||||
jupyter:
|
||||
selectors:
|
||||
body: 'body.notebook_app'
|
||||
trusted_notification: '#notification_trusted'
|
||||
|
||||
selectors:
|
||||
spinner: 'img#spinner'
|
||||
iframe: 'body iframe[seamless="seamless"]'
|
||||
|
||||
charts:
|
||||
selectors:
|
||||
visualize_button: '.ui-portlet .button i.fa-line-chart' # without icon - it waits on other buttons that aren't visible, need more specific class
|
||||
|
||||
@@ -16,7 +16,55 @@ class JupyterTestCase(SeleniumTestCase):
|
||||
@flakey
|
||||
@selenium_test
|
||||
@managed_history
|
||||
def test_jupyter_session(self):
|
||||
def test_jupyter_launch(self):
|
||||
self._stage_test_data_and_launch()
|
||||
with self.main_panel():
|
||||
self.components.gies.spinner.wait_for_absent(wait_type=self.wait_types.GIE_SPAWN)
|
||||
viz_iframe = self.components.gies.iframe.wait_for_visible(wait_type=self.wait_types.GIE_SPAWN)
|
||||
try:
|
||||
self.driver.switch_to.frame(viz_iframe)
|
||||
self.components.gies.jupyter.body.wait_for_visible()
|
||||
trusted_element = self.components.gies.jupyter.trusted_notification.wait_for_visible()
|
||||
assert trusted_element.text == "Trusted"
|
||||
finally:
|
||||
self.driver.switch_to.default_content()
|
||||
|
||||
@flakey
|
||||
@selenium_test
|
||||
@managed_history
|
||||
def test_jupyter_interaction(self):
|
||||
self._stage_test_data_and_launch()
|
||||
with self.main_panel():
|
||||
self.components.gies.spinner.wait_for_absent(wait_type=self.wait_types.GIE_SPAWN)
|
||||
viz_iframe = self.components.gies.iframe.wait_for_visible(wait_type=self.wait_types.GIE_SPAWN)
|
||||
try:
|
||||
self.driver.switch_to.frame(viz_iframe)
|
||||
self.components.gies.jupyter.body.wait_for_visible()
|
||||
self.wait_for_selector("ul.nav")
|
||||
li_links = self.driver.find_elements_by_css_selector("ul.nav li.dropdown a.dropdown-toggle")
|
||||
cell_li = None
|
||||
found_li_texts = []
|
||||
for li_link in li_links:
|
||||
li_text = li_link.text
|
||||
found_li_texts.append(li_text)
|
||||
if li_link.text == "Cell":
|
||||
cell_li = li_link
|
||||
break
|
||||
if cell_li is None:
|
||||
raise Exception("Failed to find 'Cell' drop down menu, found menu options %s" % found_li_texts)
|
||||
cell_li.click()
|
||||
self.wait_for_and_click_selector("ul#cell_menu li#run_all_cells")
|
||||
finally:
|
||||
self.driver.switch_to.default_content()
|
||||
|
||||
self.sleep_for(wait_type=self.wait_types.JOB_COMPLETION)
|
||||
self.history_panel_refresh_click()
|
||||
|
||||
# Re-running notebook should publish two new things to the history.
|
||||
self.history_panel_wait_for_hid_ok(3)
|
||||
self.history_panel_wait_for_hid_ok(4)
|
||||
|
||||
def _stage_test_data_and_launch(self):
|
||||
self.perform_upload(self.get_filename("1.txt"))
|
||||
self.perform_upload(self.get_filename("selenium-test-notebook.ipynb"))
|
||||
self.wait_for_history()
|
||||
@@ -24,26 +72,6 @@ class JupyterTestCase(SeleniumTestCase):
|
||||
self.history_panel_item_click_visualization_menu(2)
|
||||
self.ensure_visualization_available(2, JUPYTER_VISUALIZATION_NAME)
|
||||
self.history_panel_item_click_visualization(2, JUPYTER_VISUALIZATION_NAME)
|
||||
with self.main_panel():
|
||||
viz_iframe = self.wait_for_selector("body iframe", wait_type=self.wait_types.GIE_SPAWN)
|
||||
try:
|
||||
self.driver.switch_to.frame(viz_iframe)
|
||||
self.wait_for_selector("ul.nav")
|
||||
lis = self.driver.find_elements_by_css_selector("ul.nav li.dropdown")
|
||||
cell_li = None
|
||||
for li in lis:
|
||||
if li.text == "Cell":
|
||||
cell_li = li
|
||||
break
|
||||
cell_li.click()
|
||||
self.wait_for_and_click_selector("ul#cell_menu li#run_all_cells")
|
||||
finally:
|
||||
self.driver.switch_to.default_content()
|
||||
|
||||
# TODO: wait on something in the notebook instead of sleeping so long.
|
||||
self.sleep_for(wait_type=self.wait_types.JOB_COMPLETION)
|
||||
self.history_panel_refresh_click()
|
||||
|
||||
# Re-running notebook should publish two new things to the history.
|
||||
self.history_panel_wait_for_hid_ok(3)
|
||||
self.history_panel_wait_for_hid_ok(4)
|
||||
# Wait for the link to update the content to main panel, without this sleep I think
|
||||
# sometimes Selenium is waiting in the previous page (presumably Galaxy's welcome).
|
||||
self.sleep_for(wait_type=self.wait_types.UX_TRANSITION)
|
||||
|
||||
Reference in New Issue
Block a user