Skip to content

Commit

Permalink
Add selenium test for dataset datatype auto-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Oct 18, 2024
1 parent 40910d2 commit d1e69c1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ onMounted(async () => {
v-if="
(!datasetAttributes['conversion_disable'] || !datasetAttributes['datatype_disable']) &&
!datasetAttributes['metadata_disable']
">
"
title-link-class="dataset-edit-datatype-tab">
<template v-slot:title>
<FontAwesomeIcon :icon="faDatabase" class="mr-1" />
{{ localize("Datatypes") }}
Expand Down Expand Up @@ -168,7 +169,9 @@ onMounted(async () => {
{{ localize("Save") }}
</BButton>

<BButton @click="submit('datatype', 'datatype_detect')">
<BButton
id="dataset-attributes-autodetect-datatype"
@click="submit('datatype', 'datatype_detect')">
<FontAwesomeIcon :icon="faRedo" class="mr-1" />
{{ localize("Auto-detect") }}
</BButton>
Expand Down
3 changes: 3 additions & 0 deletions client/src/utils/navigation/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ edit_dataset_attributes:
name_input: '[aria-labelledby="dataset-attributes-heading"] input#name'
info_input: '[aria-labelledby="dataset-attributes-heading"] textarea#info'
annotation_input: '[aria-labelledby="dataset-attributes-heading"] textarea#annotation'
datatypes_tab: '.dataset-edit-datatype-tab'
datatype_dropdown: ' #datatype .multiselect'
save_button: '#dataset-attributes-default-save'
auto_detect_datatype_button: '#dataset-attributes-autodetect-datatype'
alert: '.dataset-attributes-alert'

dbkey_dropdown_results:
Expand Down
30 changes: 30 additions & 0 deletions lib/galaxy_test/selenium/test_dataset_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,33 @@ def test_history_dataset_update_annotation_and_info(self):

assert annotation_component.wait_for_value() == TEST_ANNOTATION
assert info_component.wait_for_value() == TEST_INFO

@selenium_test
@managed_history
def test_history_dataset_auto_detect_datatype(self):
expected_datatype = "txt"
provided_datatype = "tabular"
history_entry = self.perform_single_upload(self.get_filename("1.txt"), ext=provided_datatype)
hid = history_entry.hid
self.wait_for_history()
self.history_panel_wait_for_hid_ok(hid)
self.history_panel_item_edit(hid=hid)
edit_dataset_attributes = self.components.edit_dataset_attributes
datatypes_tab = edit_dataset_attributes.datatypes_tab
datatype_component = edit_dataset_attributes.datatype_dropdown
datatypes_tab.wait_for_and_click()
assert datatype_component.wait_for_text() == provided_datatype

# click auto detect datatype button
edit_dataset_attributes.auto_detect_datatype_button.wait_for_and_click()
edit_dataset_attributes.alert.wait_for_visible()

assert edit_dataset_attributes.alert.has_class("alert-success")

# reopen and check that datatype is updated
self.home()
self.history_panel_wait_for_hid_ok(hid)
self.history_panel_item_edit(hid=hid)
datatypes_tab.wait_for_and_click()

assert datatype_component.wait_for_text() == expected_datatype

0 comments on commit d1e69c1

Please sign in to comment.