Skip to content

Commit

Permalink
Merge pull request galaxyproject#13504 from jmchilton/export_test_sele
Browse files Browse the repository at this point in the history
Integration end-to-end test for PDF export.
  • Loading branch information
davelopez authored Mar 9, 2022
2 parents cf0ff2e + 72b42f1 commit a0ad316
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 23 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration_selenium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
GALAXY_TEST_SELENIUM_RETRIES: 1
YARN_INSTALL_OPTS: --frozen-lockfile
GALAXY_CONFIG_SQLALCHEMY_WARN_20: '1'
GALAXY_DEPENDENCIES_INSTALL_WEASYPRINT: '1'
concurrency:
group: integration-selenium-${{ github.ref }}
cancel-in-progress: true
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Markdown/Markdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div>
<b-button
v-if="effectiveExportLink"
class="float-right"
class="float-right markdown-pdf-export"
title="Download PDF"
variant="link"
role="button"
Expand All @@ -15,7 +15,7 @@
</b-button>
<b-button
v-if="!readOnly"
class="float-right"
class="float-right markdown-edit"
title="Edit Markdown"
variant="link"
role="button"
Expand Down
26 changes: 26 additions & 0 deletions lib/galaxy/selenium/navigates_galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,11 @@ def navigate_to_invocations(self):
self.click_masthead_user()
self.components.masthead.invocations.wait_for_and_click()

def navigate_to_pages(self):
self.home()
self.click_masthead_user()
self.components.masthead.pages.wait_for_and_click()

def admin_open(self):
self.components.masthead.admin.wait_for_and_click()

Expand Down Expand Up @@ -1265,6 +1270,27 @@ def tool_open(self, tool_id, outer=False):
self.driver.execute_script("arguments[0].scrollIntoView(true);", tool_element)
tool_link.wait_for_and_click()

def create_page_and_edit(self, name=None, slug=None, content_format=None, screenshot_name=None):
name = self.create_page(name=name, slug=slug, content_format=content_format, screenshot_name=screenshot_name)
self.click_grid_popup_option(name, "Edit content")
self.components.pages.editor.wym_iframe.wait_for_visible()
return name

def create_page(self, name=None, slug=None, content_format=None, screenshot_name=None):
self.components.pages.create.wait_for_and_click()
name = name or self._get_random_name(prefix="page")
slug = slug = self._get_random_name(prefix="pageslug")
content_format = content_format or "HTML"
self.tool_set_value("title", name)
self.tool_set_value("slug", slug)
self.tool_set_value("content_format", content_format, expected_type="select")
if screenshot_name:
self.screenshot(screenshot_name)
# Sometimes 'submit' button not yet hooked up?
self.sleep_for(self.wait_types.UX_RENDER)
self.components.pages.submit.wait_for_and_click()
return name

def tool_parameter_div(self, expanded_parameter_id):
return self.components.tool_form.parameter_div(parameter=expanded_parameter_id).wait_for_clickable()

Expand Down
3 changes: 2 additions & 1 deletion lib/galaxy/selenium/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ pages:
selectors:
create: '.manage-table-actions .action-button'
submit: '#submit'
export: '.markdown-pdf-export'
editor:
selectors:
wym_iframe: 'div.wym_iframe iframe'
Expand All @@ -450,7 +451,7 @@ pages:
embed_button: '#embed-galaxy-object'
dataset_selector: '.saved-datasets'
embed_dialog_add_button: '.pages-embed .buttons #button-0'

markdown_editor: '.markdown-textarea'
labels:
embed_dataset: 'Embed Dataset'

Expand Down
21 changes: 1 addition & 20 deletions lib/galaxy_test/selenium/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,7 @@ def test_simple_page_creation_edit_and_view(self):
self.history_panel_wait_for_hid_ok(1)
self.navigate_to_pages()
self.screenshot("pages_grid")

self.components.pages.create.wait_for_and_click()
name = self._get_random_name(prefix="page")
slug = self._get_random_name(prefix="pageslug")
self.tool_set_value("title", name)
self.tool_set_value("slug", slug)
self.tool_set_value("content_format", "HTML", expected_type="select")
self.screenshot("pages_create_form")

# Sometimes 'submit' button not yet hooked up?
self.sleep_for(self.wait_types.UX_RENDER)

self.components.pages.submit.wait_for_and_click()

self.click_grid_popup_option(name, "Edit content")
self.components.pages.editor.wym_iframe.wait_for_visible()
name = self.create_page_and_edit(screenshot_name="pages_create_form")
self.screenshot("pages_editor_new")
self.driver.switch_to.frame(0)
try:
Expand All @@ -58,7 +43,3 @@ def test_simple_page_creation_edit_and_view(self):
self.navigate_to_pages()
self.click_grid_popup_option(name, "View")
self.screenshot("pages_view_simple")

def navigate_to_pages(self):
self.click_masthead_user() # Open masthead menu
self.components.masthead.pages.wait_for_and_click()
33 changes: 33 additions & 0 deletions test/integration_selenium/test_pages_pdf_export.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from .framework import (
selenium_test,
SeleniumIntegrationTestCase,
)


class PagesPdfExportSeleniumIntegrationTestCase(SeleniumIntegrationTestCase):
ensure_registered = True

@classmethod
def handle_galaxy_config_kwds(cls, config):
config["enable_beta_markdown_export"] = True

@selenium_test
def test_page_pdf_export(self):
self.navigate_to_pages()
self.screenshot("pages_grid")
name = self.create_page(
content_format="Markdown",
)
self.click_grid_popup_option(name, "Edit content")
self.components.pages.editor.markdown_editor.wait_for_and_send_keys("moo\n\n\ncow\n\n")
self.screenshot("pages_markdown_editor")
self.sleep_for(self.wait_types.UX_RENDER)
self.screenshot("pages_markdown_editor_content")
self.components.pages.editor.save.wait_for_and_click()
self.screenshot("pages_markdown_editor_saved")
self.sleep_for(self.wait_types.UX_RENDER)
self.navigate_to_pages()
self.click_grid_popup_option(name, "View")
self.screenshot("pages_view_simple")
self.components.pages.export.wait_for_and_click()
self.sleep_for(self.wait_types.UX_RENDER)

0 comments on commit a0ad316

Please sign in to comment.