From 3ba401fa4a128ae10e333fd86bbabdec4c87c8ae Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Wed, 7 Jun 2023 15:08:04 -0700 Subject: [PATCH] juggle the enums in schema see https://github.com/galaxyproject/galaxy/pull/15774 for context update page =pdf export selenium test update return type to reflect matches being returned cleanup the test file run make format --- client/src/schema/schema.ts | 8 +------- client/src/utils/navigation/navigation.yml | 5 ++++- lib/galaxy/schema/schema.py | 9 ++------- lib/galaxy/webapps/galaxy/api/pages.py | 2 +- lib/galaxy/webapps/galaxy/services/pages.py | 5 ++++- test/integration_selenium/test_pages_pdf_export.py | 8 +++++--- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/client/src/schema/schema.ts b/client/src/schema/schema.ts index eca110817f2..528cc8ed538 100644 --- a/client/src/schema/schema.ts +++ b/client/src/schema/schema.ts @@ -6058,12 +6058,6 @@ export interface components { */ username: string; }; - /** - * PageSortByEnum - * @description An enumeration. - * @enum {string} - */ - PageSortByEnum: "update_time" | "title" | "username"; /** * PageSummary * @description Base model definition with common configuration used by all derived models. @@ -13044,7 +13038,7 @@ export interface operations { user_id?: string; show_published?: boolean; show_shared?: boolean; - sort_by?: components["schemas"]["PageSortByEnum"]; + sort_by?: "update_time" | "title" | "username"; sort_desc?: boolean; limit?: number; offset?: number; diff --git a/client/src/utils/navigation/navigation.yml b/client/src/utils/navigation/navigation.yml index 0db6cdd5104..db9a01bb3d7 100644 --- a/client/src/utils/navigation/navigation.yml +++ b/client/src/utils/navigation/navigation.yml @@ -485,8 +485,11 @@ history_import: pages: selectors: - create: '.manage-table-actions .action-button' + create: '#page-create' submit: '#submit' + drop: '.page-dropdown' + edit: '.dropdown-item-edit' + view: '.dropdown-item-view' export: '.markdown-pdf-export' dropdown: '[data-page-dropdown*="${id}"]' index_table: "#page-table" diff --git a/lib/galaxy/schema/schema.py b/lib/galaxy/schema/schema.py index 1f22b6844d5..bc2511d170b 100644 --- a/lib/galaxy/schema/schema.py +++ b/lib/galaxy/schema/schema.py @@ -1257,10 +1257,7 @@ class InvocationIndexQueryPayload(Model): offset: Optional[int] = Field(default=0, description="Number of invocations to skip") -class PageSortByEnum(str, Enum): - update_time = "update_time" - title = "title" - username = "username" +PageSortByEnum = Literal["update_time", "title", "username"] class PageIndexQueryPayload(Model): @@ -1268,9 +1265,7 @@ class PageIndexQueryPayload(Model): show_published: Optional[bool] = None show_shared: Optional[bool] = None user_id: Optional[DecodedDatabaseIdField] = None - sort_by: PageSortByEnum = Field( - PageSortByEnum.update_time, title="Sort By", description="Sort pages by this attribute" - ) + sort_by: PageSortByEnum = Field("update_time", title="Sort By", description="Sort pages by this attribute") sort_desc: Optional[bool] = Field(default=False, title="Sort descending", description="Sort in descending order.") search: Optional[str] = Field(default=None, title="Filter text", description="Freetext to search.") limit: Optional[int] = Field(default=100, lt=1000, title="Limit", description="Maximum number of pages to return.") diff --git a/lib/galaxy/webapps/galaxy/api/pages.py b/lib/galaxy/webapps/galaxy/api/pages.py index 01bc1df83f5..22b836b1369 100644 --- a/lib/galaxy/webapps/galaxy/api/pages.py +++ b/lib/galaxy/webapps/galaxy/api/pages.py @@ -61,7 +61,7 @@ ShowSharedQueryParam: bool = Query(default=False, title="Include pages shared wi SortByQueryParam: PageSortByEnum = Query( - default=PageSortByEnum.update_time, + default="update_time", title="Sort attribute", description="Sort page index by this specified attribute on the page model", ) diff --git a/lib/galaxy/webapps/galaxy/services/pages.py b/lib/galaxy/webapps/galaxy/services/pages.py index 3514df795dc..5de61002760 100644 --- a/lib/galaxy/webapps/galaxy/services/pages.py +++ b/lib/galaxy/webapps/galaxy/services/pages.py @@ -1,4 +1,5 @@ import logging +from typing import Tuple from galaxy import exceptions from galaxy.celery.tasks import prepare_pdf_download @@ -56,7 +57,9 @@ class PagesService(ServiceBase): self.shareable_service = ShareableService(self.manager, self.serializer) self.short_term_storage_allocator = short_term_storage_allocator - def index(self, trans, payload: PageIndexQueryPayload, include_total_count: bool = False) -> PageSummaryList: + def index( + self, trans, payload: PageIndexQueryPayload, include_total_count: bool = False + ) -> Tuple[PageSummaryList, int]: """Return a list of Pages viewable by the user :param deleted: Display deleted pages diff --git a/test/integration_selenium/test_pages_pdf_export.py b/test/integration_selenium/test_pages_pdf_export.py index eb291c13efa..6712baef135 100644 --- a/test/integration_selenium/test_pages_pdf_export.py +++ b/test/integration_selenium/test_pages_pdf_export.py @@ -16,8 +16,9 @@ class TestPagesPdfExportSeleniumIntegration(SeleniumIntegrationTestCase): def test_page_pdf_export(self): self.navigate_to_pages() self.screenshot("pages_grid") - name = self.create_page() - self.click_grid_popup_option(name, "Edit content") + self.create_page() + self.components.pages.drop.wait_for_and_click() + self.components.pages.edit.wait_for_and_click() self.components.pages.editor.markdown_editor.wait_for_and_send_keys("moo\n\n\ncow\n\n") self.screenshot("pages_markdown_editor") self.sleep_for(self.wait_types.UX_RENDER) @@ -26,7 +27,8 @@ class TestPagesPdfExportSeleniumIntegration(SeleniumIntegrationTestCase): self.screenshot("pages_markdown_editor_saved") self.sleep_for(self.wait_types.UX_RENDER) self.navigate_to_pages() - self.click_grid_popup_option(name, "View") + self.components.pages.drop.wait_for_and_click() + self.components.pages.view.wait_for_and_click() self.screenshot("pages_view_simple") self.components.pages.export.wait_for_and_click() self.sleep_for(self.wait_types.UX_RENDER)