Skip to content

Commit

Permalink
Merge pull request #16222 from jmchilton/history_link_testing
Browse files Browse the repository at this point in the history
Selenium test for page history links.
  • Loading branch information
dannon authored Jun 16, 2023
2 parents 256822d + 3cf1f25 commit c60f72b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
8 changes: 7 additions & 1 deletion client/src/components/Markdown/Elements/HistoryLink.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<template>
<div>
<b-link v-if="showLink" @click="onClick">Click to Import History: {{ name }}.</b-link>
<b-link
v-if="showLink"
data-description="history import link"
:data-history-id="args.history_id"
@click="onClick"
>Click to Import History: {{ name }}.</b-link
>
<div v-if="imported" class="text-success">
<font-awesome-icon icon="check" class="mr-1" />
<span>Successfully Imported History: {{ name }}!</span>
Expand Down
6 changes: 6 additions & 0 deletions client/src/utils/navigation/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,19 @@ pages:
save: '#save-button'
embed_dataset: '.toolTitle .title-link[data-tool-id="history_dataset_embedded"]'
embed_workflow_display: '.toolTitle .title-link[data-tool-id="workflow_display"]'
history_link: '.toolTitle .title-link[data-tool-id="history_link"]'
dataset_selector:
type: xpath
selector: '//span[text() = "1: 1.fasta"]'
workflow_selection: .selection-dialog-modal [role="row"][data-pk="${id}"]
history_selection: .selection-dialog-modal [role="row"][data-pk="${id}"]
embed_dialog_add_button: '.pages-embed .buttons #button-0'
markdown_editor: '.markdown-textarea'

view:
selectors:
history_link: '[data-description="history import link"][data-history-id="${history_id}"]'

login:
selectors:
form: 'form#login'
Expand Down
4 changes: 4 additions & 0 deletions lib/galaxy/selenium/navigates_galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ def current_history(self) -> Dict[str, Any]:
def current_history_id(self) -> str:
return self.current_history()["id"]

def current_history_publish(self):
self.click_history_option_sharing()
self.make_accessible_and_publishable()

def latest_history_item(self):
history_contents = self.history_contents()
assert len(history_contents) > 0
Expand Down
10 changes: 3 additions & 7 deletions lib/galaxy_test/selenium/test_histories_published.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ def create_history(self, name):
self.home()
self.history_panel_create_new_with_name(name)

def publish_current_history(self):
self.click_history_option_sharing()
self.make_accessible_and_publishable()

def _login(self):
self.home()
self.submit_login(self.user1_email, retries=3)
Expand All @@ -135,17 +131,17 @@ def setup_shared_state(self):

self.create_history(self.history1_name)
self.history_panel_add_tags(self.history1_tags)
self.publish_current_history()
self.current_history_publish()

self.create_history(self.history3_name)
self.history_panel_add_tags(self.history3_tags)
self.set_history_annotation(self.history3_annot)
self.publish_current_history()
self.current_history_publish()

self.logout_if_needed()

self.register(self.user2_email)

self.create_history(self.history2_name)
self.history_panel_add_tags(self.history2_tags)
self.publish_current_history()
self.current_history_publish()
22 changes: 22 additions & 0 deletions lib/galaxy_test/selenium/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,28 @@ def test_workflow_problem_display(self):
editor.save.wait_for_and_click()
self.page_open_with_name(name, "page_view_with_workflow_problems")

@selenium_test
@managed_history
def test_history_links(self):
new_history_name = self._get_random_name()
self.history_panel_rename(new_history_name)
self.current_history_publish()
history_id = self.current_history_id()
self.navigate_to_pages()
name = self.create_page_and_edit()
editor = self._page_editor
editor.history_link.wait_for_and_click()
editor.history_selection(id=history_id).wait_for_and_click()
self.sleep_for(self.wait_types.UX_RENDER)
editor.save.wait_for_and_click()
self.page_open_with_name(name, "page_view_with_history_link")
view = self.components.pages.view
view.history_link(history_id=history_id).wait_for_and_click()
self.sleep_for(self.wait_types.UX_RENDER)
self.navigate_to_histories_page()
history_names = self.histories_get_history_names()
assert f"Copy of '{new_history_name}'" in history_names

@property
def _page_editor(self):
return self.components.pages.editor

0 comments on commit c60f72b

Please sign in to comment.