mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-11-28 20:09:01 +08:00
# Conflicts: # client/src/components/Visualizations/DisplayApplications.vue # lib/galaxy/managers/users.py # lib/galaxy/webapps/galaxy/api/mcp.py # lib/galaxy_test/api/test_framework.py # test/integration/oidc/test_auth_oidc.py
152 lines
6.4 KiB
Python
152 lines
6.4 KiB
Python
from galaxy_test.base.populators import (
|
|
skip_without_datatype,
|
|
skip_without_visualization_plugin,
|
|
)
|
|
from .framework import (
|
|
managed_history,
|
|
selenium_test,
|
|
SeleniumTestCase,
|
|
)
|
|
from .upload_activity_helpers import UsesUploadActivity
|
|
|
|
HG18_DBKEY_TEXT = "Human Mar. 2006 (NCBI36/hg18) (hg18)"
|
|
HG18_TITLE = "Human (hg18)"
|
|
HG38_TITLE = "Human (GRCh38/hg38)"
|
|
|
|
|
|
class TestVisualizationsAnonymous(SeleniumTestCase, UsesUploadActivity):
|
|
@skip_without_datatype("png")
|
|
@skip_without_visualization_plugin("annotate_image")
|
|
@selenium_test
|
|
def test_charts_image_annotate(self):
|
|
hid = 1
|
|
self.upload_context("local-file").stage_local_file(self.get_filename("454Score.png")).start()
|
|
self.history_panel_wait_for_hid_state(hid, state="ok")
|
|
|
|
self.show_dataset_visualization(
|
|
hid, visualization_id="annotate_image", screenshot_name="visualization_plugins_png"
|
|
)
|
|
|
|
with self.visualization_panel():
|
|
self.wait_for_selector("#image-annotate")
|
|
self.screenshot("visualization_plugin_charts_image_annotate")
|
|
|
|
@selenium_test
|
|
@skip_without_visualization_plugin("tabulator")
|
|
def test_charts_tabulator(self):
|
|
hid = 1
|
|
self.upload_context("local-file").stage_local_file(self.get_filename("1.tabular")).start()
|
|
self.history_panel_wait_for_hid_state(hid, state="ok")
|
|
self.show_dataset_visualization(
|
|
hid, visualization_id="tabulator", screenshot_name="visualization_plugins_tabulator"
|
|
)
|
|
|
|
with self.visualization_panel():
|
|
self.wait_for_selector(".tabulator-table")
|
|
self.screenshot("visualization_plugin_tabulator_landing")
|
|
|
|
@selenium_test
|
|
@skip_without_visualization_plugin("h5web")
|
|
def test_charts_h5web(self):
|
|
hid = 1
|
|
self.upload_context("local-file").stage_local_file(self.get_filename("chopper.h5")).start()
|
|
self.history_panel_wait_for_hid_state(hid, state="ok")
|
|
self.show_dataset_visualization(hid, visualization_id="h5web", screenshot_name="visualization_plugins_h5")
|
|
|
|
with self.visualization_panel():
|
|
# Look for the h5web-explorer-tree identifier to verify it loads.
|
|
self.wait_for_selector("#h5web-explorer-tree")
|
|
self.screenshot("visualization_plugin_charts_h5web_landing")
|
|
|
|
|
|
class TestVisualizations(SeleniumTestCase, UsesUploadActivity):
|
|
ensure_registered = True
|
|
|
|
@selenium_test
|
|
@managed_history
|
|
def test_display_application_links(self):
|
|
self.dataset_populator.new_dataset(
|
|
self.current_history_id(), content="chr1\t100\t200\ta\n", file_type="bed", dbkey="hg38", wait=True
|
|
)
|
|
details = self.dataset_populator.get_history_dataset_details(self.current_history_id(), hid=1)
|
|
expected = [
|
|
(app["label"], [link["text"] for link in app["links"]])
|
|
for app in details["display_apps"] + details["display_types"]
|
|
]
|
|
assert ("display at UCSC", ["main"]) in expected
|
|
assert self.dataset_display_applications(1) == expected
|
|
self.screenshot("dataset_display_application_links")
|
|
|
|
@selenium_test
|
|
@managed_history
|
|
def test_no_display_application_links(self):
|
|
self.dataset_populator.new_dataset(
|
|
self.current_history_id(), content="No display applications.\n", file_type="txt", wait=True
|
|
)
|
|
assert self.dataset_display_applications(1) == []
|
|
self.screenshot("dataset_display_application_links_empty")
|
|
|
|
@selenium_test
|
|
@managed_history
|
|
@skip_without_visualization_plugin("igv")
|
|
def test_igv_loads_correct_genome(self):
|
|
hid = 1
|
|
self.upload_context("local-file").stage_local_file(self.get_filename("1.bed")).start()
|
|
self.history_panel_wait_for_hid_state(hid, state="ok")
|
|
self.show_dataset_visualization(hid, visualization_id="igv", screenshot_name="visualization_plugins_igv")
|
|
|
|
with self.visualization_panel():
|
|
self._wait_for_igv_container()
|
|
igv = self.components.igv
|
|
igv.confirm_button.wait_for_and_click()
|
|
igv.expand_button.wait_for_and_click()
|
|
igv.settings_tab.wait_for_and_click()
|
|
igv.selected_genome(title=HG38_TITLE).wait_for_present()
|
|
self.screenshot("visualization_plugin_igv_default_genome")
|
|
|
|
dataset_component = self.history_panel_ensure_showing_item_details(hid)
|
|
dataset_component.dbkey.wait_for_and_click()
|
|
self.edit_dataset_dbkey(HG18_DBKEY_TEXT)
|
|
self.show_dataset_visualization(hid, visualization_id="igv")
|
|
|
|
with self.visualization_panel():
|
|
self._wait_for_igv_container()
|
|
igv = self.components.igv
|
|
igv.confirm_button.assert_absent_or_hidden()
|
|
igv.expand_button.wait_for_and_click()
|
|
igv.settings_tab.wait_for_and_click()
|
|
igv.selected_genome(title=HG18_TITLE).wait_for_present()
|
|
self.screenshot("visualization_plugin_igv_current_genome")
|
|
|
|
igv.name_input.wait_for_and_click()
|
|
igv.name_input.wait_for_and_clear_and_send_keys("igv with hg18")
|
|
|
|
igv.save_button.wait_for_and_click()
|
|
self.sleep_for(self.wait_types.UX_TRANSITION)
|
|
|
|
self.navigate_to_saved_visualizations()
|
|
self.select_grid_operation("igv with hg18", "Open")
|
|
# A saved visualization only mounts its frame once it has loaded; Playwright can't enter a missing frame.
|
|
self.wait_for_selector_visible("iframe#galaxy_visualization")
|
|
|
|
# Saving one's own visualization again updates it rather than making a copy.
|
|
with self.visualization_panel():
|
|
self._wait_for_igv_container()
|
|
igv = self.components.igv
|
|
igv.expand_button.wait_for_and_click()
|
|
igv.save_button.wait_for_and_click()
|
|
self.sleep_for(self.wait_types.UX_TRANSITION)
|
|
|
|
# Clearing the name input can leave its default title in front, so match part of the title.
|
|
saved = [v for v in self.api_get("visualizations") if "igv with hg18" in v["title"]]
|
|
assert len(saved) == 1, saved
|
|
|
|
def _wait_for_igv_container(self):
|
|
igv = self.components.igv
|
|
self.sleep_for(self.wait_types.UX_TRANSITION)
|
|
element = igv.shadow_host.wait_for_present()
|
|
shadow_root = element.shadow_root
|
|
|
|
igv_root_container = self.navigation.igv.selectors._
|
|
shadow_root.find_element(*igv_root_container.component_locator)
|