Commit 3ccdb11c authored by John Davis's avatar John Davis
Browse files

Add selenium tests for uploads

We are not verifying item body for test-pasted and test-pasted-url
because that makes those 2 tests flaky.
parent a2fe7453
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -882,6 +882,11 @@ gies:
    iframe: 'body iframe[seamless="seamless"]'

upload:
  composite:
    selectors:
      table: 'div#composite table.upload-table'
      close: 'div#composite div.upload-buttons button'

  selectors:
    tab: '#tab-title-link-${tab}'
    ftp_add: '#btn-ftp'
+20 −1
Original line number Diff line number Diff line
"""A mixing that extends a HasDriver class with Galaxy-specific utilities.
"""A mixin that extends a HasDriver class with Galaxy-specific utilities.

Implementer must provide a self.build_url method to target Galaxy.
"""
@@ -742,6 +742,25 @@ class NavigatesGalaxy(HasDriver):

        self.wait_for_and_click_selector("button#btn-close")

    def perform_upload_of_composite_dataset_pasted_data(self, ext, paste_content):
        self.home()
        self.upload_start_click()
        self.components.upload.tab(tab="composite").wait_for_and_click()
        self.upload_set_footer_extension(ext, tab_id="composite")

        table = self.components.upload.composite.table().wait_for_visible()
        source_select_buttons = table.find_elements_by_css_selector("div.dropdown button.btn")
        paste_buttons = table.find_elements_by_css_selector(".upload-source .dropdown-menu .dropdown-item .fa-edit")
        textareas = table.find_elements_by_css_selector("div.upload-text-column textarea.upload-text-content")

        for i in range(len(paste_content)):
            source_select_buttons[i].click()
            paste_buttons[i].click()
            textareas[i].send_keys(paste_content[i])

        self.upload_start(tab_id="composite")
        self.components.upload.composite.close.wait_for_and_click()

    def upload_list(self, test_paths, name="test", ext=None, genome=None, hide_source_items=True):
        self._collection_upload_start(test_paths, ext, genome, "List")
        if not hide_source_items:
+45 −0
Original line number Diff line number Diff line
@@ -11,6 +11,51 @@ from .framework import (


class UploadsTestCase(SeleniumTestCase, UsesHistoryItemAssertions):
    @selenium_test
    def test_upload_file(self):
        self.perform_upload(self.get_filename("1.sam"))

        self.history_panel_wait_for_hid_ok(1)
        history_count = len(self.history_contents())
        assert history_count == 1, "Incorrect number of items in history - expected 1, found %d" % history_count

        self.history_panel_click_item_title(hid=1, wait=True)
        self.assert_item_summary_includes(1, "28 lines")

    @selenium_test
    def test_upload_pasted_content(self):
        pasted_content = "this is pasted"
        self.perform_upload_of_pasted_content(pasted_content)

        self.history_panel_wait_for_hid_ok(1)
        history_count = len(self.history_contents())
        assert history_count == 1, "Incorrect number of items in history - expected 1, found %d" % history_count

    @selenium_test
    def test_upload_pasted_url_content(self):
        pasted_content = "https://raw.githubusercontent.com/galaxyproject/galaxy/dev/LICENSE.txt"
        self.perform_upload_of_pasted_content(pasted_content)

        self.history_panel_wait_for_hid_ok(1)
        history_count = len(self.history_contents())
        assert history_count == 1, "Incorrect number of items in history - expected 1, found %d" % history_count

    @selenium_test
    def test_upload_composite_dataset_pasted_data(self):
        paste_content = ["a", "b", "c"]
        self.perform_upload_of_composite_dataset_pasted_data("velvet", paste_content)

        self.history_panel_wait_for_hid_ok(1)
        history_count = len(self.history_contents())
        assert history_count == 1, "Incorrect number of items in history - expected 1, found %d" % history_count

        self.history_panel_click_item_title(hid=1, wait=True)
        self.history_panel_item_view_dataset_details(1)
        param_values = self.driver.find_elements_by_css_selector("#tool-parameters td.tool-parameter-value")
        request_json = param_values[1].text
        for data in paste_content:
            assert f'"paste_content": "{data}"' in request_json

    @selenium_test
    def test_upload_simplest(self):
        self.perform_upload(self.get_filename("1.sam"))