Skip to content

Commit

Permalink
Fix selenium tests, and tours
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Aug 10, 2023
1 parent 44a7c2d commit 308b23a
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 45 deletions.
4 changes: 2 additions & 2 deletions client/src/components/Popper/Popper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<div v-if="arrow" class="popper-arrow" data-popper-arrow />
<div v-if="title" class="popper-header px-2 py-1 rounded-top d-flex justify-content-between">
<span class="px-1">{{ title }}</span>
<span class="align-items-center cursor-pointer">
<FontAwesomeIcon icon="fa-times-circle" @click="visible = false" />
<span class="popper-close align-items-center cursor-pointer" @click="visible = false">
<FontAwesomeIcon icon="fa-times-circle" />
</span>
</div>
<slot />
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/Upload/Default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ function eventAnnounce(index, file) {
const uploadModel = {
...defaultModel,
id: index,
dbKey: dbKey.value,
extension: extension.value,
fileData: file,
fileMode: file.mode || "local",
fileName: file.name,
Expand Down Expand Up @@ -304,6 +306,7 @@ function updateExtension(newExtension) {
/** Update reference dataset for all entries */
function updateDbKey(newDbKey) {
dbKey.value = newDbKey;
uploadValues.value.forEach((model) => {
if (model.status === "init" && model.dbKey === props.defaultDbKey) {
model.dbKey = newDbKey;
Expand Down Expand Up @@ -381,13 +384,15 @@ defineExpose({
<span v-if="isCollection" class="upload-footer-title">Collection:</span>
<UploadSettingsSelect
v-if="isCollection"
class="upload-footer-collection-type"
:value="collectionType"
:disabled="isRunning"
:options="COLLECTION_TYPES"
placeholder="Select Type"
@input="updateCollectionType" />
<span class="upload-footer-title">Type (set all):</span>
<UploadSettingsSelect
class="upload-footer-extension"
:value="extension"
:disabled="isRunning"
:options="listExtensions"
Expand All @@ -396,6 +401,7 @@ defineExpose({
<UploadExtensionDetails :extension="extension" :list-extensions="listExtensions" />
<span class="upload-footer-title">Reference (set all):</span>
<UploadSettingsSelect
class="upload-footer-genome"
:value="dbKey"
:disabled="isRunning"
:options="listDbKeys"
Expand Down
3 changes: 3 additions & 0 deletions client/src/components/Upload/DefaultRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function removeUpload() {
</div>
<UploadSettingsSelect
v-if="listExtensions !== null"
class="upload-extension"
:value="extension"
:disabled="isDisabled"
:options="listExtensions"
Expand All @@ -135,12 +136,14 @@ function removeUpload() {
:list-extensions="listExtensions" />
<UploadSettingsSelect
v-if="listDbKeys !== null"
class="upload-genome"
:value="dbKey"
:disabled="isDisabled"
:options="listDbKeys"
placeholder="Select Reference"
@input="inputDbKey" />
<UploadSettings
class="upload-settings"
:deferred="deferred"
:disabled="isDisabled"
:to-posix-lines="toPosixLines"
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Upload/RulesInput.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("RulesInput", () => {
it("rendering and reset", async () => {
const wrapper = getWrapper();
expect(wrapper.find("#btn-reset").classes()).toEqual(expect.arrayContaining(["disabled"]));
const textInput = wrapper.find(".upload-text-area");
const textInput = wrapper.find(".upload-rule-source-content");
expect(textInput.element.value).toBe("");
await textInput.setValue("a b c d");
expect(textInput.element.value).toBe("a b c d");
Expand Down
11 changes: 7 additions & 4 deletions client/src/components/Upload/RulesInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const props = defineProps({
},
});
const emit = defineEmits(["dismiss"]);
const dataType = ref("datasets");
const errorMessage = ref(null);
const ftpFiles = ref([]);
Expand All @@ -59,6 +61,7 @@ function eventBuild() {
entry.elements = uris.value;
}
Galaxy.currHistoryPanel.buildCollection("rules", entry, null, true);
emit("dismiss");
}
function eventReset() {
Expand Down Expand Up @@ -123,20 +126,20 @@ function inputRemote() {
<div v-localize class="upload-header">Insert tabular source data to extract collection files and metadata.</div>
<textarea
v-model="sourceContent"
class="upload-box upload-text-area"
class="upload-box upload-rule-source-content"
placeholder="Insert tabular source data here."
:disabled="isDisabled" />
<FontAwesomeIcon v-if="isDisabled" class="upload-text-lock" icon="fa-lock" />
<div class="upload-footer text-center">
<span class="upload-footer-title">Upload type:</span>
<UploadSettingsSelect v-model="dataType" :options="RULES_TYPES" />
<UploadSettingsSelect v-model="dataType" class="rule-data-type" :options="RULES_TYPES" />
</div>
<div class="upload-buttons d-flex justify-content-end">
<BButton @click="inputPaste">
<FontAwesomeIcon icon="fa-edit" />
<span v-localize>Paste data</span>
</BButton>
<BButton @click="inputDialog">
<BButton data-description="rules dataset dialog" @click="inputDialog">
<FontAwesomeIcon icon="fa-file" />
<span v-localize>Choose dataset</span>
</BButton>
Expand Down Expand Up @@ -167,7 +170,7 @@ function inputRemote() {
</template>

<style scoped>
.upload-text-area {
.upload-rule-source-content {
resize: none;
}
.upload-text-lock {
Expand Down
7 changes: 5 additions & 2 deletions client/src/components/Upload/UploadSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,22 @@ const emit = defineEmits(["input"]);
<template v-slot:reference>
<FontAwesomeIcon class="cursor-pointer" icon="fa-cog" />
</template>
<div class="upload-settings px-2 py-2 no-highlight">
<div class="upload-settings-content px-2 py-2 no-highlight">
<table class="upload-settings-table grid">
<tbody>
<UploadSettingsOption
class="upload-space-to-tab"
title="Convert spaces to tabs"
:value="spaceToTab"
@click="emit('input', 'spaceToTab')" />
<UploadSettingsOption
class="upload-to-posix-lines"
title="Use POSIX standard"
:value="toPosixLines"
@click="emit('input', 'toPosixLines')" />
<UploadSettingsOption
v-if="deferred !== null"
class="upload-deferred"
title="Defer dataset resolution"
:value="deferred"
@click="emit('input', 'deferred')" />
Expand All @@ -60,7 +63,7 @@ const emit = defineEmits(["input"]);

<style lang="scss">
@import "theme/blue.scss";
.upload-settings {
.upload-settings-content {
position: relative;
.upload-settings-cover {
background: $white;
Expand Down
13 changes: 8 additions & 5 deletions client/src/utils/navigation/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ edit_collection_attributes:
data_value:
type: xpath
selector: '//span[contains(text(), "${data_change}")]'
genome_select_search: ".database-dropdown input.multiselect__input"
genome_select_search: '.database-dropdown input.multiselect__input'
datatype_select_search: '.datatype-dropdown input.multiselect__input'
save_dbkey_btn: '.save-dbkey-edit'
save_datatype_btn: '.save-datatype-edit'
Expand Down Expand Up @@ -1038,16 +1038,19 @@ upload:
ftp_items: '.upload-ftp-row'
ftp_close: '.popover-header .popover-close'
row: '#upload-row-${n}'
settings_button: '#upload-row-${n} .upload-settings'
settings_button: '#upload-row-${n} .upload-settings span'
title: '#upload-row-${n} .upload-title'
paste_content: '#upload-row-${n} .upload-text-content'
settings: '.upload-settings-table'
setting_space_to_tab: '.upload-space-to-tab'
setting_deferred: '.upload-deferred'
start: '#activity-upload'
start_uploading: '.upload-start'
close: '.upload-close'
start_uploading: '#btn-start'
create: '#btn-new'
close: '#btn-close'
rule_source_content: 'textarea.upload-rule-source-content'
rule_select_data_type: '.rule-data-type'
rule_select_input_type: '.rule-select-type'
rule_dataset_dialog: '[data-description="rules dataset dialog"]'
rule_dataset_selector:
selector: '.selection-dialog-modal'
rule_dataset_selector_row:
Expand Down
2 changes: 1 addition & 1 deletion config/plugins/tours/core.deferred.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ steps:
postclick: true

- title: Close Settings
element: .popover-close
element: .popper-close
postclick: true

- title: Start Upload
Expand Down
24 changes: 11 additions & 13 deletions config/plugins/tours/core.windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ steps:
intro: "First, we will upload some tabular data into our new history."
postclick: true

- element: "#btn-new"
- component: upload.create
intro: "We will be using the paste feature to create a new dataset."
postclick: true

- element: "#upload-row-0 .upload-title"
- component: upload.title(n=0)
intro: "Giving the dataset a name"
textinsert: First Dataset

- element: "#upload-row-0 .upload-text-content"
- component: upload.paste_content(n=0)
intro: "...and paste content into the text area field."
textinsert: |
1 0.039 0.000
Expand All @@ -36,25 +36,23 @@ steps:
7 0.000 0.000
8 0.000 0.000
- element: ".upload-settings"
- component: upload.settings_button(n=0)
intro: "Now, we may further configure the upload content."
postclick: true

- element: ".upload-space_to_tab"
- component: upload.setting_space_to_tab
intro: "...by specifying that all spaces in our table should be converted into tabs."
postclick:
- ".upload-space_to_tab"
- ".popover-close"
postclick: true

- element: "#btn-new"
- component: upload.create
intro: "We will create another dataset, so that we can try the Window Manager on multiple datasets."
postclick: true

- element: "#upload-row-1 .upload-title"
- component: upload.title(n=1)
intro: "Giving the second dataset a name"
textinsert: Second Dataset

- element: "#upload-row-1 .upload-text-content"
- component: upload.paste_content(n=1)
intro: "...and paste content into the text area field again."
textinsert: |
1 0.069 0.000
Expand All @@ -63,11 +61,11 @@ steps:
4 0.420 0.000
5 0.190 0.000
- element: "#btn-start"
- component: upload.start_uploading
intro: "Upload the data into your Galaxy history."
postclick: true

- element: "#btn-close"
- component: upload.close
intro: "Hit the close button to close the upload dialog."
postclick: true

Expand Down
21 changes: 10 additions & 11 deletions lib/galaxy/selenium/navigates_galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,11 +779,11 @@ def _perform_upload(

if ext is not None:
self.wait_for_selector_visible(".upload-extension")
self.select2_set_value(".upload-extension", ext)
self.select_set_value(".upload-extension", ext)

if genome is not None:
self.wait_for_selector_visible(".upload-genome")
self.select2_set_value(".upload-genome", genome)
self.select_set_value(".upload-genome", genome)

if deferred is not None:
upload = self.components.upload
Expand Down Expand Up @@ -879,19 +879,19 @@ def upload_set_footer_extension(self, ext, tab_id="regular"):
if ext is not None:
selector = f"div#{tab_id} .upload-footer-extension"
self.wait_for_selector_visible(selector)
self.select2_set_value(selector, ext)
self.select_set_value(selector, ext)

@retry_during_transitions
def upload_set_footer_genome(self, genome, tab_id="regular"):
if genome is not None:
selector = f"div#{tab_id} .upload-footer-genome"
self.wait_for_selector_visible(selector)
self.select2_set_value(selector, genome)
self.select_set_value(selector, genome)

@retry_during_transitions
def upload_set_collection_type(self, collection_type):
self.wait_for_selector_visible(".upload-footer-collection-type")
self.select2_set_value(".upload-footer-collection-type", collection_type)
self.select_set_value(".upload-footer-collection-type", collection_type)

def upload_start(self, tab_id="regular"):
self.wait_for_and_click_selector(f"div#{tab_id} button#btn-start")
Expand Down Expand Up @@ -932,15 +932,14 @@ def upload_rule_start(self):
def upload_rule_build(self):
self.upload_build(tab="rule-based")

def upload_rule_set_data_type(self, type_description):
def upload_rule_dataset_dialog(self):
upload = self.components.upload
data_type_element = upload.rule_select_data_type.wait_for_visible()
self.select2_set_value(data_type_element, type_description)
upload.rule_dataset_dialog.wait_for_and_click()

def upload_rule_set_input_type(self, input_description):
def upload_rule_set_data_type(self, type_description):
upload = self.components.upload
input_type_element = upload.rule_select_input_type.wait_for_visible()
self.select2_set_value(input_type_element, input_description)
data_type_element = upload.rule_select_data_type.wait_for_visible()
self.select_set_value(data_type_element, type_description)

def upload_rule_set_dataset(self, row=1):
upload = self.components.upload
Expand Down
11 changes: 5 additions & 6 deletions lib/galaxy_test/selenium/test_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,8 @@ def test_rules_example_2_list(self):
self.history_panel_wait_for_hid_ok(1)
self.upload_rule_start()
self.upload_rule_set_data_type("Collection")
self.upload_rule_set_input_type("History Dataset")
self.upload_rule_dataset_dialog()
self.upload_rule_set_dataset(1)
self._wait_for_upload_modal()
self.screenshot("rules_example_2_1_inputs")
self.upload_rule_build()
rule_builder = self.components.rule_builder
Expand All @@ -250,7 +249,7 @@ def test_rules_example_3_list_pairs(self):
self.history_panel_wait_for_hid_ok(1)
self.upload_rule_start()
self.upload_rule_set_data_type("Collection")
self.upload_rule_set_input_type("History Dataset")
self.upload_rule_dataset_dialog()
self.upload_rule_set_dataset(1)
self._wait_for_upload_modal()
self.screenshot("rules_example_3_1_inputs")
Expand Down Expand Up @@ -361,7 +360,7 @@ def test_rules_example_6_nested_lists(self):
self.history_panel_wait_for_hid_ok(1)
self.upload_rule_start()
self.upload_rule_set_data_type("Collection")
self.upload_rule_set_input_type("History Dataset")
self.upload_rule_dataset_dialog()
self.upload_rule_set_dataset(1)

self._wait_for_upload_modal()
Expand Down Expand Up @@ -439,7 +438,7 @@ def test_rules_deferred_list(self):
self.history_panel_wait_for_hid_ok(1)
self.upload_rule_start()
self.upload_rule_set_data_type("Collection")
self.upload_rule_set_input_type("History Dataset")
self.upload_rule_dataset_dialog()
self.upload_rule_set_dataset(1)

self._wait_for_upload_modal()
Expand Down Expand Up @@ -493,7 +492,7 @@ def _setup_uniprot_example(self):
self.history_panel_wait_for_hid_ok(1)
self.upload_rule_start()
self.upload_rule_set_data_type("Collection")
self.upload_rule_set_input_type("History Dataset")
self.upload_rule_dataset_dialog()
self.upload_rule_set_dataset(1)

# @selenium_test
Expand Down

0 comments on commit 308b23a

Please sign in to comment.