Skip to content

Commit 7a39d44

Browse files
committed
Selenium test case for basic tools list functionality.
Exercises some of the work added in #20747.
1 parent 4af4857 commit 7a39d44

File tree

4 files changed

+113
-1
lines changed

4 files changed

+113
-1
lines changed

client/src/components/Panels/ToolPanel.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ initializePanel();
7373
aria-labelledby="toolbox-heading"
7474
class="toolbox-panel"
7575
go-to-all-title="Discover Tools"
76+
go-to-all-data-description="toolbox discover tools"
7677
href="/tools/list">
7778
<template v-slot:activity-panel-header-top>
7879
<PanelViewMenu />

client/src/components/ToolsList/ToolsListCard.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ const {
240240
</GLink>
241241

242242
<!-- eslint-disable-next-line vue/no-v-html -->
243-
<div v-if="showHelp" class="mt-2" v-html="formattedToolHelp"></div>
243+
<div
244+
v-if="showHelp"
245+
data-description="tools list tool help"
246+
class="mt-2"
247+
v-html="formattedToolHelp"></div>
244248
</div>
245249
</template>
246250

client/src/utils/navigation/navigation.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,18 @@ tool_panel:
412412
views_button: '.tool-panel-dropdown'
413413
views_menu_item: '[data-panel-id="${panel_id}"]'
414414
panel_labels: '.tool-panel-label'
415+
discover_tools_link: '[data-description="toolbox discover tools"]'
415416

417+
tools_list:
418+
selectors:
419+
_: '.tools-list'
420+
search_input: '.tools-list [data-description="filter text input"]'
421+
tool_card: '#g-card-content-${tool_id}'
422+
version_button: '#tools-list-${tool_id}'
423+
favorite_tool_button: '#g-card-action-favorite-tool-${tool_id}'
424+
toggle_help: '#g-card-description-${tool_id} .g-link.g-unselectable'
425+
tool_help: '#g-card-content-${tool_id} [data-description="tools list tool help"]'
426+
open_tool_button: '#g-card-action-open-tool-${tool_id}'
416427

417428
multi_history_panel:
418429
selectors:
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
from .framework import (
2+
selenium_test,
3+
SeleniumTestCase,
4+
)
5+
6+
7+
class TestToolDiscoveryViewAnonymous(SeleniumTestCase):
8+
"""Test the Tool Discovery View (rich tools list).
9+
10+
This view provides advanced tool search and discovery features,
11+
moving the advanced search from the tool panel sidebar to a
12+
dedicated center panel view (PR #20747).
13+
14+
TODO: We should add tests for ontology filtering, section filtering,
15+
advanced search, and list vs grid view toggling.
16+
"""
17+
18+
@selenium_test
19+
def test_tool_discovery_landing(self):
20+
"""Test navigation to the tool discovery view."""
21+
# Navigate to home page
22+
self.home()
23+
24+
# Access the tool discovery view via the "Discover Tools" link
25+
tool_panel = self.components.tool_panel
26+
tool_panel.discover_tools_link.wait_for_and_click()
27+
28+
# Verify the tools list view is displayed
29+
tools_list = self.components.tools_list
30+
tools_list._.wait_for_visible()
31+
self.screenshot("tools_list_landing")
32+
33+
tools_list.search_input.wait_for_and_send_keys("filter failed")
34+
35+
# Verify the filtered tool card appears
36+
tools_list.tool_card(tool_id="__FILTER_FAILED_DATASETS__").wait_for_visible()
37+
self.screenshot("tools_list_filtered")
38+
39+
# Click the version button to show version information
40+
tools_list.version_button(tool_id="__FILTER_FAILED_DATASETS__").wait_for_and_click()
41+
self.screenshot("tools_list_show_version")
42+
43+
# Verify favorite button is available (not showing login message)
44+
button = tools_list.favorite_tool_button(tool_id="__FILTER_FAILED_DATASETS__").wait_for_visible()
45+
# When logged in, the title should not be the login prompt
46+
title = button.get_attribute("title")
47+
assert title == "Login or Register to Favorite Tools"
48+
49+
# Verify help is initially hidden
50+
tools_list.tool_help(tool_id="__FILTER_FAILED_DATASETS__").assert_absent()
51+
52+
# Toggle help to show it
53+
tools_list.toggle_help(tool_id="__FILTER_FAILED_DATASETS__").wait_for_and_click()
54+
tools_list.tool_help(tool_id="__FILTER_FAILED_DATASETS__").wait_for_visible()
55+
self.screenshot("tools_list_show_help")
56+
57+
# Toggle help to hide it again
58+
tools_list.toggle_help(tool_id="__FILTER_FAILED_DATASETS__").wait_for_and_click()
59+
tools_list.tool_help(tool_id="__FILTER_FAILED_DATASETS__").wait_for_absent()
60+
61+
# Click the open tool button to navigate to the tool
62+
tools_list.open_tool_button(tool_id="__FILTER_FAILED_DATASETS__").wait_for_and_click()
63+
64+
# Verify we've left the tools list view and the tool form is displayed
65+
tools_list._.wait_for_absent()
66+
self.screenshot("tools_list_navigated_to_tool")
67+
68+
69+
class TestToolDiscoveryViewLoggedIn(SeleniumTestCase):
70+
"""Test tool discovery view features that require login.
71+
72+
Current it just verifies that the favorite tool button does not tell you
73+
to login unlike the anonymous case above. Actual exercise of the favorite
74+
feature would be great.
75+
"""
76+
77+
ensure_registered = True
78+
79+
@selenium_test
80+
def test_favorite_tool_button_when_logged_in(self):
81+
"""Test that the favorite tool button works for logged-in users."""
82+
# Navigate to tool discovery view
83+
self.home()
84+
self.components.tool_panel.discover_tools_link.wait_for_and_click()
85+
86+
# Search for a tool
87+
tools_list = self.components.tools_list
88+
tools_list._.wait_for_visible()
89+
tools_list.search_input.wait_for_and_send_keys("filter failed")
90+
tools_list.tool_card(tool_id="__FILTER_FAILED_DATASETS__").wait_for_visible()
91+
92+
# Verify favorite button is available (not showing login message)
93+
button = tools_list.favorite_tool_button(tool_id="__FILTER_FAILED_DATASETS__").wait_for_visible()
94+
# When logged in, the title should not be the login prompt
95+
title = button.get_attribute("title")
96+
assert title != "Login or Register to Favorite Tools"

0 commit comments

Comments
 (0)