Skip to content

Commit c814643

Browse files
Merge pull request galaxyproject#19997 from jmchilton/selenium_workflows_run_collections
2 parents 033053b + a44a2d3 commit c814643

7 files changed

Lines changed: 107 additions & 7 deletions

File tree

client/src/components/Collections/common/CollectionCreator.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ watch(
139139
</div>
140140
</span>
141141
<BTabs v-else v-model="currentTab" fill justified>
142-
<BTab class="collection-creator" :title="localize('Create Collection')">
142+
<BTab
143+
class="collection-creator"
144+
:title="localize('Create Collection')"
145+
:title-link-attributes="{ 'data-description': 'collection create tab build' }">
143146
<div v-if="props.noItems">
144147
<CollectionCreatorNoItemsMessage @click-upload="currentTab = Tabs.upload" />
145148
</div>
@@ -175,7 +178,7 @@ watch(
175178
</div>
176179
</div>
177180
</BTab>
178-
<BTab>
181+
<BTab :title-link-attributes="{ 'data-description': 'collection create tab upload' }">
179182
<template v-slot:title>
180183
<FontAwesomeIcon :icon="faUpload" fixed-width />
181184
<span>{{ localize("Upload Files to Add to Collection") }}</span>

client/src/components/Form/Elements/FormData/FormDataContextButtons.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function createCollectionType(colType: string) {
111111
"
112112
v-b-tooltip.bottom.hover.noninteractive
113113
class="d-flex flex-gapx-1 align-items-center"
114+
data-description="upload"
114115
:title="createTitle"
115116
:pressed="props.workflowTab === 'create'"
116117
@click="clickedTab('create')">

client/src/components/Upload/DefaultBox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ defineExpose({
364364
<div class="upload-wrapper">
365365
<div class="upload-header">
366366
<div v-if="props.emitUploaded && historyItemsStateInfo">
367-
<BAlert show :variant="historyItemsStateInfo.variant">
367+
<BAlert show :variant="historyItemsStateInfo.variant" data-description="upload state alert">
368368
<LoadingSpan v-if="historyItemsStateInfo.spin" :message="historyItemsStateInfo.message" />
369369
<span v-else>{{ historyItemsStateInfo.message }}</span>
370370
</BAlert>

client/src/utils/navigation/navigation.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,33 @@ trs_import:
683683
url_input: "#trs-import-url-input"
684684
url_import_button: "#trs-url-import-button"
685685

686+
# not meant as a stand-alone component - just using for the anchor
687+
upload_mixin:
688+
selectors: &upload_mixin
689+
create_button: '${_} #btn-new'
690+
paste_option: '${_} #upload-row-${n} .upload-source .dropdown-menu .dropdown-item .fa-edit'
691+
paste_content: '${_} #upload-row-${n} .upload-text-content'
692+
row: '${_} #upload-row-${n}'
693+
status: '${_} [data-description="upload state alert"]'
694+
embedded_start_button: '${_} #btn-start'
695+
use_button: '${_} #btn-emit'
696+
686697
workflow_run:
698+
input:
699+
selectors:
700+
_: '[data-label="${label}"]'
701+
upload: '${_} [data-description="upload"]'
702+
collection_tab_build_link: '${_} [data-description="collection create tab build"]'
703+
collection_tab_upload_link: '${_} [data-description="collection create tab upload"]'
704+
# data inputs
705+
<<: *upload_mixin
706+
707+
collection_builder:
708+
selectors:
709+
_: '[data-label="${label}"] .tabs'
710+
create: '${_} .create-collection'
711+
<<: *upload_mixin
712+
687713
selectors:
688714
warning: '[data-description="workflow run warning"]'
689715
run_error: '[data-description="workflow run error"]'
@@ -1154,6 +1180,7 @@ upload:
11541180
paste_option: '#upload-row-${n} .upload-source .dropdown-menu .dropdown-item .fa-edit'
11551181
paste_content: '#upload-row-${n} .upload-text-content'
11561182
row: '#upload-row-${n}'
1183+
status: '[data-description="upload state alert"]'
11571184
rule_dataset_dialog: '[data-description="rules dataset dialog"]'
11581185
rule_dataset_selector:
11591186
selector: '.selection-dialog-modal'

client/src/utils/url.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ export interface UrlDataOptions {
1111
}
1212

1313
export const USER_FILE_PREFIX = "gxuserfiles://";
14+
// TODO: File sources can register custom URI schemes post https://github.com/galaxyproject/galaxy/pull/15497,
15+
// as such this list should probably be calculated on that backend for correctness.
1416
export const URI_PREFIXES = [
17+
"base64://",
1518
"http://",
1619
"https://",
1720
"ftp://",

lib/galaxy/navigation/components.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ def from_dict(name, raw_value):
294294
sub_components = {}
295295

296296
for key, value in raw_value.items():
297+
if key.endswith("mixin"):
298+
continue
297299
if key == "selectors":
298300
base_selector = None
299301
if "_" in value:

lib/galaxy_test/selenium/test_workflow_run.py

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import yaml
55
from selenium.webdriver.common.by import By
6+
from typing_extensions import Literal
67

78
from galaxy_test.base import rules_test_data
89
from galaxy_test.base.workflow_fixtures import (
@@ -17,6 +18,7 @@
1718
WORKFLOW_WITH_CUSTOM_REPORT_1_TEST_DATA,
1819
WORKFLOW_WITH_DATA_TAG_FILTER,
1920
WORKFLOW_WITH_DYNAMIC_OUTPUT_COLLECTION,
21+
WORKFLOW_WITH_MAPPED_OUTPUT_COLLECTION,
2022
WORKFLOW_WITH_OLD_TOOL_VERSION,
2123
WORKFLOW_WITH_RULES_1,
2224
)
@@ -389,16 +391,78 @@ def test_workflow_run_tag_filter(self):
389391
self.dataset_populator.tag_dataset(history_id, dataset["id"], tags=["genomescope_model"])
390392
# Add another possible input that should not be selected
391393
self.dataset_populator.new_dataset(history_id, wait=True)
392-
wf = json.loads(WORKFLOW_WITH_DATA_TAG_FILTER)
393-
wf["name"] = str(uuid4())
394-
workflow_id = self.workflow_populator.create_workflow(wf)
395-
self.workflow_run_with_name(wf["name"])
394+
workflow_id, workflow_name = self._create_workflow_with_unique_name(WORKFLOW_WITH_DATA_TAG_FILTER, "ga")
395+
self.workflow_run_with_name(workflow_name)
396396
self.workflow_run_submit()
397397
self.sleep_for(self.wait_types.HISTORY_POLL)
398398
invocations = self.workflow_populator.workflow_invocations(workflow_id=workflow_id)
399399
invocation = self.workflow_populator.get_invocation(invocations[-1]["id"])
400400
assert invocation["inputs"]["0"]["id"] == dataset["id"]
401401

402+
@selenium_test
403+
@managed_history
404+
def test_upload_dataset_from_workflow_simple(self):
405+
history_id = self.current_history_id()
406+
self._create_and_run_workflow_with_unique_name(WORKFLOW_SIMPLE_CAT_TWICE)
407+
workflow_run = self.components.workflow_run
408+
input = workflow_run.input._(label="input1")
409+
input.upload.wait_for_and_click()
410+
self._upload_hello_world_for_input(input)
411+
self.workflow_run_submit()
412+
self.history_panel_wait_for_hid_ok(2)
413+
content = self.dataset_populator.get_history_dataset_content(history_id, hid=2)
414+
assert content.strip() == "hello world\nhello world"
415+
416+
@selenium_test
417+
@managed_history
418+
def test_upload_list_from_workflow_simple(self):
419+
self._create_and_run_workflow_with_unique_name(WORKFLOW_WITH_MAPPED_OUTPUT_COLLECTION)
420+
workflow_run = self.components.workflow_run
421+
input = workflow_run.input._(label="input1")
422+
input.upload.wait_for_and_click()
423+
input.collection_tab_upload_link.wait_for_and_click()
424+
builder = workflow_run.input.collection_builder._(label="input1")
425+
self._upload_hello_world_for_input(builder, count=2)
426+
input.collection_tab_build_link.wait_for_and_click()
427+
builder.create.wait_for_and_click()
428+
self.workflow_run_submit()
429+
self.history_panel_wait_for_hid_ok(6)
430+
431+
def _upload_hello_world_for_input(self, workflow_input, count=1, from_hid=1):
432+
# assumes fresh history...
433+
workflow_input.create_button.wait_for_and_click()
434+
url = self.dataset_populator.base64_url_for_string("hello world")
435+
content = ""
436+
for _ in range(count):
437+
content += url + "\n"
438+
workflow_input.paste_content(n=0).wait_for_and_send_keys(content)
439+
workflow_input.embedded_start_button.wait_for_and_click()
440+
workflow_input.status.wait_for_present()
441+
for i in range(from_hid, from_hid + count):
442+
self.history_panel_wait_for_hid_ok(i)
443+
workflow_input.use_button.wait_for_and_click()
444+
445+
def _create_and_run_workflow_with_unique_name(
446+
self, workflow_contents: str, format: Literal["ga", "gxformat2"] = "gxformat2"
447+
):
448+
workflow_id, workflow_name = self._create_workflow_with_unique_name(workflow_contents, format)
449+
self.workflow_run_with_name(workflow_name)
450+
return workflow_id, workflow_name
451+
452+
def _create_workflow_with_unique_name(
453+
self, workflow_contents: str, format: Literal["ga", "gxformat2"] = "gxformat2"
454+
):
455+
workflow_name = str(uuid4())
456+
if format == "gxformat2":
457+
wf = yaml.safe_load(workflow_contents)
458+
wf["name"] = workflow_name
459+
workflow_id = self.workflow_populator.upload_yaml_workflow(wf)
460+
else:
461+
wf = json.loads(workflow_contents)
462+
wf["name"] = workflow_name
463+
workflow_id = self.workflow_populator.create_workflow(wf)
464+
return (workflow_id, workflow_name)
465+
402466
def _assert_has_3_lines_after_run(self, hid):
403467
self.workflow_run_wait_for_ok(hid=hid)
404468
history_id = self.current_history_id()

0 commit comments

Comments
 (0)