|
| 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