diff --git a/client/src/components/Common/ExportRecordDetails.vue b/client/src/components/Common/ExportRecordDetails.vue index c96613f149aa..5b9ab02b3b51 100644 --- a/client/src/components/Common/ExportRecordDetails.vue +++ b/client/src/components/Common/ExportRecordDetails.vue @@ -1,24 +1,24 @@ diff --git a/client/src/components/Common/ExportRecordTable.vue b/client/src/components/Common/ExportRecordTable.vue index ae5713010261..9c5799dda0e7 100644 --- a/client/src/components/Common/ExportRecordTable.vue +++ b/client/src/components/Common/ExportRecordTable.vue @@ -1,5 +1,4 @@ diff --git a/client/src/components/Common/models/exportRecordModel.ts b/client/src/components/Common/models/exportRecordModel.ts index f828e488ec2b..72eefc61a7be 100644 --- a/client/src/components/Common/models/exportRecordModel.ts +++ b/client/src/components/Common/models/exportRecordModel.ts @@ -9,10 +9,10 @@ import type { } from "@/api"; export interface ExportParams { - readonly modelStoreFormat: ModelStoreFormat; - readonly includeFiles: boolean; - readonly includeDeleted: boolean; - readonly includeHidden: boolean; + modelStoreFormat: ModelStoreFormat; + includeFiles: boolean; + includeDeleted: boolean; + includeHidden: boolean; } export interface ExportRecord { @@ -30,7 +30,7 @@ export interface ExportRecord { readonly isStsDownload: boolean; readonly canDownload: boolean; readonly modelStoreFormat: ModelStoreFormat; - readonly exportParams?: ExportParams; + readonly exportParams?: Readonly; readonly duration?: number | null; readonly canExpire: boolean; readonly isPermanent: boolean; diff --git a/client/src/components/History/Export/ExportOptions.vue b/client/src/components/History/Export/ExportOptions.vue deleted file mode 100644 index 8b03d8533bc5..000000000000 --- a/client/src/components/History/Export/ExportOptions.vue +++ /dev/null @@ -1,81 +0,0 @@ - - - diff --git a/client/src/components/History/Export/HistoryExport.test.ts b/client/src/components/History/Export/HistoryExport.test.ts index b7422671ccad..cf5bb2333b5e 100644 --- a/client/src/components/History/Export/HistoryExport.test.ts +++ b/client/src/components/History/Export/HistoryExport.test.ts @@ -7,7 +7,6 @@ import { setActivePinia } from "pinia"; import type { HistorySummary } from "@/api"; import { useServerMock } from "@/api/client/__mocks__"; import { fetchHistoryExportRecords } from "@/api/histories.export"; -import type { BrowsableFilesSourcePlugin } from "@/api/remoteFiles"; import { EXPIRED_STS_DOWNLOAD_RECORD, FILE_SOURCE_STORE_RECORD, @@ -39,24 +38,12 @@ const FAKE_HISTORY: HistorySummary = { url: FAKE_HISTORY_URL, }; -const REMOTE_FILES_API_RESPONSE: BrowsableFilesSourcePlugin[] = [ - { - id: "test-posix-source", - type: "posix", - label: "TestSource", - doc: "For testing", - writable: true, - browsable: true, - requires_roles: undefined, - requires_groups: undefined, - supports: { - pagination: false, - search: false, - sorting: false, - }, - uri_root: "gxfiles://test-posix-source", - }, -]; +const selectors = { + historyName: "#history-name", + latestExportRecord: "#latest-export-record", + showPreviousExportRecordsButton: "#show-old-records-button", + fatalErrorAlert: "#fatal-error-alert", +} as const; async function mountHistoryExport() { const pinia = createTestingPinia({ stubActions: false }); @@ -81,10 +68,6 @@ describe("HistoryExport.vue", () => { if (historyId === FAKE_HISTORY_ID) { return response(200).json(FAKE_HISTORY); } - }), - - http.get("/api/remote_files/plugins", ({ response }) => { - return response(200).json([]); }) ); }); @@ -92,22 +75,16 @@ describe("HistoryExport.vue", () => { it("should render the history name", async () => { const wrapper = await mountHistoryExport(); - expect(wrapper.find("#history-name").text()).toBe(FAKE_HISTORY.name); + expect(wrapper.find(selectors.historyName).text()).toBe(FAKE_HISTORY.name); }); - it("should render export options", async () => { + it("should not display the latest export record if there is no export record", async () => { const wrapper = await mountHistoryExport(); - expect(wrapper.find("#history-export-options").exists()).toBe(true); + expect(wrapper.find(selectors.latestExportRecord).exists()).toBe(false); }); - it("should display a message indicating there are no exports where there are none", async () => { - const wrapper = await mountHistoryExport(); - - expect(wrapper.find("#no-export-records-alert").exists()).toBe(true); - }); - - it("should render previous records when there is more than one record", async () => { + it("should display the previous records button when there is more than one record", async () => { mockFetchExportRecords.mockResolvedValue([ RECENT_STS_DOWNLOAD_RECORD, FILE_SOURCE_STORE_RECORD, @@ -115,79 +92,14 @@ describe("HistoryExport.vue", () => { ]); const wrapper = await mountHistoryExport(); - expect(wrapper.find("#previous-export-records").exists()).toBe(true); + expect(wrapper.find(selectors.showPreviousExportRecordsButton).exists()).toBe(true); }); - it("should not render previous records when there is one or less records", async () => { + it("should not display the previous records button when there is one or less records", async () => { mockFetchExportRecords.mockResolvedValue([RECENT_STS_DOWNLOAD_RECORD]); const wrapper = await mountHistoryExport(); - expect(wrapper.find("#previous-export-records").exists()).toBe(false); - }); - - it("should display file sources tab if there are available", async () => { - server.use( - http.get("/api/remote_files/plugins", ({ response }) => response(200).json(REMOTE_FILES_API_RESPONSE)) - ); - - const wrapper = await mountHistoryExport(); - - expect(wrapper.find("#direct-download-tab").exists()).toBe(true); - expect(wrapper.find("#file-source-tab").exists()).toBe(true); - }); - - it("should not display file sources tab if there are no file sources available", async () => { - const wrapper = await mountHistoryExport(); - - expect(wrapper.find("#direct-download-tab").exists()).toBe(true); - expect(wrapper.find("#file-source-tab").exists()).toBe(false); - }); - - it("should display the ZENODO tab if the Zenodo plugin is available", async () => { - const zenodoPlugin: BrowsableFilesSourcePlugin = { - id: "zenodo", - type: "rdm", - label: "Zenodo", - doc: "For testing", - writable: true, - browsable: true, - supports: { - pagination: false, - search: false, - sorting: false, - }, - uri_root: "zenodo://", - }; - server.use(http.get("/api/remote_files/plugins", ({ response }) => response(200).json([zenodoPlugin]))); - - const wrapper = await mountHistoryExport(); - - expect(wrapper.find("#zenodo-file-source-tab").exists()).toBe(true); - }); - - it("should display the ZENODO tab if the user has a user-defined Zenodo file source", async () => { - const userZenodoPlugin: BrowsableFilesSourcePlugin = { - id: "998c5bba-b18f-4223-9c93-0f36fa2fdae8", - type: "zenodo", - label: "ZENODO", - doc: "My integration with Zenodo", - browsable: true, - writable: true, - requires_roles: null, - requires_groups: null, - url: "https://zenodo.org/", - supports: { - pagination: true, - search: true, - sorting: false, - }, - uri_root: "gxuserfiles://998c5bba-b18f-4223-9c93-0f36fa2fdae8", - }; - server.use(http.get("/api/remote_files/plugins", ({ response }) => response(200).json([userZenodoPlugin]))); - - const wrapper = await mountHistoryExport(); - - expect(wrapper.find("#zenodo-file-source-tab").exists()).toBe(true); + expect(wrapper.find(selectors.showPreviousExportRecordsButton).exists()).toBe(false); }); it("should not display a fatal error alert if the history is found and loaded", async () => { @@ -195,11 +107,8 @@ describe("HistoryExport.vue", () => { const wrapper = await mountHistoryExport(); - expect(wrapper.find("#fatal-error-alert").exists()).toBe(false); - - expect(wrapper.find("#history-name").exists()).toBe(true); - expect(wrapper.find("#history-export-options").exists()).toBe(true); - expect(wrapper.find("#direct-download-tab").exists()).toBe(true); + expect(wrapper.find(selectors.fatalErrorAlert).exists()).toBe(false); + expect(wrapper.find(selectors.historyName).exists()).toBe(true); }); it("should not render the UI and display a fatal error message if the history cannot be found or loaded", async () => { @@ -217,10 +126,7 @@ describe("HistoryExport.vue", () => { const wrapper = await mountHistoryExport(); - expect(wrapper.find("#fatal-error-alert").exists()).toBe(true); - - expect(wrapper.find("#history-name").exists()).toBe(false); - expect(wrapper.find("#history-export-options").exists()).toBe(false); - expect(wrapper.find("#direct-download-tab").exists()).toBe(false); + expect(wrapper.find(selectors.fatalErrorAlert).exists()).toBe(true); + expect(wrapper.find(selectors.historyName).exists()).toBe(false); }); }); diff --git a/client/src/components/History/Export/HistoryExport.vue b/client/src/components/History/Export/HistoryExport.vue index 8d0333c49c52..af336f18d336 100644 --- a/client/src/components/History/Export/HistoryExport.vue +++ b/client/src/components/History/Export/HistoryExport.vue @@ -1,8 +1,7 @@ - + + + + + diff --git a/client/src/components/History/Export/HistoryExportWizard.test.ts b/client/src/components/History/Export/HistoryExportWizard.test.ts new file mode 100644 index 000000000000..4bdd86336bc4 --- /dev/null +++ b/client/src/components/History/Export/HistoryExportWizard.test.ts @@ -0,0 +1,436 @@ +import { createTestingPinia } from "@pinia/testing"; +import { getLocalVue } from "@tests/jest/helpers"; +import { mount } from "@vue/test-utils"; +import flushPromises from "flush-promises"; +import { setActivePinia } from "pinia"; + +import { useServerMock } from "@/api/client/__mocks__"; +import type { BrowsableFilesSourcePlugin } from "@/api/remoteFiles"; + +import HistoryExportWizard from "./HistoryExportWizard.vue"; + +const localVue = getLocalVue(true); + +const FAKE_HISTORY_ID = "fake-history-id"; +const FAKE_HISTORY_NAME = "Test History"; + +const REMOTE_FILES_API_RESPONSE: BrowsableFilesSourcePlugin[] = [ + { + id: "test-posix-source", + type: "posix", + label: "TestSource", + doc: "For testing", + writable: true, + browsable: true, + requires_roles: undefined, + requires_groups: undefined, + supports: { + pagination: false, + search: false, + sorting: false, + }, + uri_root: "gxfiles://test-posix-source", + }, +]; + +const ZENODO_PLUGIN: BrowsableFilesSourcePlugin = { + id: "zenodo", + type: "rdm", + label: "Zenodo", + doc: "For testing", + writable: true, + browsable: true, + supports: { + pagination: false, + search: false, + sorting: false, + }, + uri_root: "zenodo://", +}; + +const USER_ZENODO_PLUGIN: BrowsableFilesSourcePlugin = { + id: "998c5bba-b18f-4223-9c93-0f36fa2fdae8", + type: "zenodo", + label: "My Zenodo", + doc: "My integration with Zenodo", + browsable: true, + writable: true, + requires_roles: null, + requires_groups: null, + url: "https://zenodo.org/", + supports: { + pagination: true, + search: true, + sorting: false, + }, + uri_root: "gxuserfiles://998c5bba-b18f-4223-9c93-0f36fa2fdae8", +}; + +const selectors = { + wizard: ".history-export-wizard", + formatCard: "[data-history-export-format]", + destinationCard: "[data-history-export-destination]", + directoryInput: "#directory", + fileNameInput: "#exported-file-name", + includeFilesCheckbox: 'input[type="checkbox"]', + submitButton: ".go-next-btn", + nextButton: ".go-next-btn", + previousButton: ".go-back-btn", + errorAlert: ".alert-danger", +} as const; + +interface MountOptions { + historyId?: string; + historyName?: string; + isBusy?: boolean; +} + +async function mountHistoryExportWizard(options: MountOptions = {}) { + const { historyId = FAKE_HISTORY_ID, historyName = FAKE_HISTORY_NAME, isBusy = false } = options; + + const pinia = createTestingPinia({ stubActions: false }); + setActivePinia(pinia); + + const wrapper = mount(HistoryExportWizard as object, { + propsData: { + historyId, + historyName, + isBusy, + }, + localVue, + pinia, + }); + + await flushPromises(); + return wrapper; +} + +const { server, http } = useServerMock(); + +describe("HistoryExportWizard.vue", () => { + beforeEach(() => { + server.use( + http.get("/api/remote_files/plugins", ({ response }) => { + return response(200).json([]); + }) + ); + }); + + describe("Component Initialization", () => { + it("should start with format selection step", async () => { + const wrapper = await mountHistoryExportWizard(); + + expect(wrapper.find(selectors.formatCard).exists()).toBe(true); + }); + + it("should display available export formats", async () => { + const wrapper = await mountHistoryExportWizard(); + + const formatCards = wrapper.findAll(selectors.formatCard); + expect(formatCards.length).toBe(2); + }); + }); + + describe("Format Selection", () => { + it("should display format options", async () => { + const formats = [ + { id: "rocrate.zip", label: "RO-Crate" }, + { id: "tar.gz", label: "Compressed TGZ" }, + ]; + const wrapper = await mountHistoryExportWizard(); + + const formatCards = wrapper.findAll(selectors.formatCard); + expect(formatCards.length).toBe(formats.length); + for (const format of formats) { + const card = wrapper.find(`[data-history-export-format="${format.id}"]`); + expect(card.exists()).toBe(true); + expect(card.text()).toContain(format.label); + } + }); + }); + + describe("Destination Selection", () => { + it("should show download destination by default", async () => { + const wrapper = await mountHistoryExportWizard(); + + // Navigate to destination step + const nextButtonAfterFormat = wrapper.find(selectors.nextButton); + if (nextButtonAfterFormat.exists()) { + await nextButtonAfterFormat.trigger("click"); + } + + const downloadCard = wrapper.find('[data-history-export-destination="download"]'); + expect(downloadCard.exists()).toBe(true); + }); + + it("should show remote source destination when file sources are available", async () => { + server.use( + http.get("/api/remote_files/plugins", ({ response }) => { + return response(200).json(REMOTE_FILES_API_RESPONSE); + }) + ); + + const wrapper = await mountHistoryExportWizard(); + + // Navigate to destination step + const nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + const remoteCard = wrapper.find('[data-history-export-destination="remote-source"]'); + expect(remoteCard.exists()).toBe(true); + }); + + it("should show Zenodo destination when Zenodo plugin is available", async () => { + server.use( + http.get("/api/remote_files/plugins", ({ response }) => { + return response(200).json([ZENODO_PLUGIN]); + }) + ); + + const wrapper = await mountHistoryExportWizard(); + + // Navigate to destination step + const nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + const zenodoCard = wrapper.find('[data-history-export-destination="zenodo-repository"]'); + expect(zenodoCard.exists()).toBe(true); + }); + + it("should prioritize user-defined Zenodo over default Zenodo", async () => { + server.use( + http.get("/api/remote_files/plugins", ({ response }) => { + return response(200).json([ZENODO_PLUGIN, USER_ZENODO_PLUGIN]); + }) + ); + + const wrapper = await mountHistoryExportWizard(); + + // Navigate to destination step + const nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + const zenodoCard = wrapper.find('[data-history-export-destination="zenodo-repository"]'); + if (zenodoCard.exists()) { + // Should show user-defined Zenodo label + expect(zenodoCard.text()).toContain("My Zenodo"); + } + }); + }); + + describe("Remote Source Setup", () => { + it("should show directory input when remote source is selected", async () => { + server.use( + http.get("/api/remote_files/plugins", ({ response }) => { + return response(200).json(REMOTE_FILES_API_RESPONSE); + }) + ); + + const wrapper = await mountHistoryExportWizard(); + + // Navigate to destination step + let nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Select remote source + const remoteCard = wrapper.find('[data-history-export-destination="remote-source"]'); + if (remoteCard.exists()) { + await remoteCard.trigger("click"); + } + + // Navigate to setup step + nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Check that the setup step is rendered with directory selection + expect(wrapper.text()).toContain("Select a 'repository' to export history to."); + }); + }); + + describe("Export Summary", () => { + it("should display default file name placeholder", async () => { + // Set up a remote file source to show file name input + server.use( + http.get("/api/remote_files/plugins", ({ response }) => { + return response(200).json(REMOTE_FILES_API_RESPONSE); + }) + ); + + const wrapper = await mountHistoryExportWizard(); + + // Navigate through wizard steps to final step + // Step 1: Select destination + let nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Step 2: Select remote source to require file name + const remoteCard = wrapper.find('[data-history-export-destination="remote-source"]'); + if (remoteCard.exists()) { + await remoteCard.trigger("click"); + } + + // Step 3: Navigate to setup step + nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Simulate selecting a directory by triggering the input + const directoryInput = wrapper.find('input[placeholder="Click to select directory"]'); + if (directoryInput.exists()) { + await directoryInput.setValue("gxfiles://test-remote-source/test-directory"); + } + + // Step 4: Navigate to final step + nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Check if the file name input has the expected placeholder text + const fileNameInput = wrapper.find(selectors.fileNameInput); + expect(fileNameInput.exists()).toBe(true); + expect(fileNameInput.attributes("placeholder")).toContain(FAKE_HISTORY_NAME); + }); + }); + + describe("Event Handling", () => { + it("should emit onExport event when export is triggered", async () => { + const wrapper = await mountHistoryExportWizard(); + + // Navigate through wizard steps to final step + // Step 1: Select destination + let nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Step 2: Select download destination to skip setup steps + const downloadCard = wrapper.find('[data-history-export-destination="download"]'); + if (downloadCard.exists()) { + await downloadCard.trigger("click"); + } + + // Step 3: Navigate to final step + nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + const exportButton = wrapper.find(selectors.submitButton); + await exportButton.trigger("click"); + + expect(wrapper.emitted("onExport")).toBeTruthy(); + }); + }); + + describe("Validation", () => { + it("should validate remote source selection", async () => { + server.use( + http.get("/api/remote_files/plugins", ({ response }) => { + return response(200).json(REMOTE_FILES_API_RESPONSE); + }) + ); + + const wrapper = await mountHistoryExportWizard(); + + // Navigate to destination step + let nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Navigate to remote source setup + const remoteCard = wrapper.find('[data-history-export-destination="remote-source"]'); + if (remoteCard.exists()) { + await remoteCard.trigger("click"); + } + + // Navigate to setup step + nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Check for directory input presence + const directoryInput = wrapper.find(selectors.directoryInput); + expect(directoryInput.exists() || wrapper.text().includes("Select a 'repository'")).toBe(true); + }); + }); + + describe("Step Navigation", () => { + it("should show setup steps for remote source selection", async () => { + server.use( + http.get("/api/remote_files/plugins", ({ response }) => { + return response(200).json(REMOTE_FILES_API_RESPONSE); + }) + ); + + const wrapper = await mountHistoryExportWizard(); + + // Navigate to destination step + let nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Select remote source + const remoteCard = wrapper.find('[data-history-export-destination="remote-source"]'); + if (remoteCard.exists()) { + await remoteCard.trigger("click"); + } + + // Navigate to setup step + nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Should show setup for remote source + expect(wrapper.find(selectors.directoryInput).exists()).toBe(true); + }); + + it("should show Zenodo setup when Zenodo is selected", async () => { + server.use( + http.get("/api/remote_files/plugins", ({ response }) => { + return response(200).json([ZENODO_PLUGIN]); + }) + ); + + const wrapper = await mountHistoryExportWizard(); + + // Navigate to destination step + let nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Select Zenodo + const zenodoCard = wrapper.find('[data-history-export-destination="zenodo-repository"]'); + if (zenodoCard.exists()) { + await zenodoCard.trigger("click"); + } + + // Navigate to setup step + nextButton = wrapper.find(selectors.nextButton); + if (nextButton.exists()) { + await nextButton.trigger("click"); + } + + // Should show Zenodo-specific setup + expect(wrapper.text().includes("Zenodo") || wrapper.text().includes("draft record")).toBe(true); + }); + }); +}); diff --git a/client/src/components/History/Export/HistoryExportWizard.vue b/client/src/components/History/Export/HistoryExportWizard.vue new file mode 100644 index 000000000000..5b7a12e3f2c0 --- /dev/null +++ b/client/src/components/History/Export/HistoryExportWizard.vue @@ -0,0 +1,396 @@ + + + + + diff --git a/client/src/components/History/Export/types.ts b/client/src/components/History/Export/types.ts new file mode 100644 index 000000000000..ebbefdba9ec5 --- /dev/null +++ b/client/src/components/History/Export/types.ts @@ -0,0 +1,9 @@ +import type { ExportParams } from "@/components/Common/models/exportRecordModel"; + +export type HistoryExportDestination = "download" | "remote-source" | "rdm-repository" | "zenodo-repository"; + +export interface HistoryExportData extends ExportParams { + destination: HistoryExportDestination; + remoteUri: string; + outputFileName: string; +} diff --git a/client/src/utils/navigation/navigation.yml b/client/src/utils/navigation/navigation.yml index 7c7f1922308b..449b14c9e878 100644 --- a/client/src/utils/navigation/navigation.yml +++ b/client/src/utils/navigation/navigation.yml @@ -521,25 +521,25 @@ history_export: history_export_tasks: selectors: - direct_download: '.gen-direct-download-btn' - file_source_tab: '.tab-export-to-file' - remote_file_name_input: '#file-source-tab #name' - toggle_options_link: '#toggle-options-link' - export_format_selector: '#format-selector' - select_format: - type: xpath - selector: '//select[@id="format-selector"]/option[@value="${format}"]' + history_export_wizard: '.history-export-wizard' + next_button: '.go-next-btn' + back_button: '.go-back-btn' + export_button: '.go-next-btn.btn-primary' + select_format: '[data-history-export-format="${format}"]' + select_destination: '[data-history-export-destination="${destination}"]' + exported_file_name: '#exported-file-name' last_export_record: selectors: details: '.export-record-details' - preparing_export: '.export-record-details .loading-icon' export_format: '.record-archive-format' up_to_date_icon: '.record-up-to-date-icon' outdated_icon: '.record-outdated-icon' - expiration_warning_icon: '.record-expiration-warning-icon' - download_btn: '.record-download-btn' - reimport_btn: '.record-reimport-btn' + preparing_export_badge: '#g-card-badge-in-progress-latest-export-record' + download_ready_badge: '#g-card-badge-ready-to-download-latest-export-record' + expiration_warning_badge: '#g-card-badge-expires-soon-latest-export-record' + download_btn: '#g-card-action-download-latest-export-record' + reimport_btn: '#g-card-action-reimport-latest-export-record' history_import: selectors: diff --git a/test/integration_selenium/test_history_import_export_ftp.py b/test/integration_selenium/test_history_import_export_ftp.py index be0749714db7..aa2727a2f95c 100644 --- a/test/integration_selenium/test_history_import_export_ftp.py +++ b/test/integration_selenium/test_history_import_export_ftp.py @@ -102,22 +102,42 @@ def test_history_export_tracking(self): # Export to direct download link export_format = "rocrate.zip" + destination = "download" history_export_tasks = self.components.history_export_tasks - history_export_tasks.direct_download.wait_for_and_click() + # Select export format + history_export_tasks.select_format(format=export_format).wait_for_and_click() + history_export_tasks.next_button.wait_for_and_click() + # Select destination + history_export_tasks.select_destination(destination=destination).wait_for_and_click() + history_export_tasks.next_button.wait_for_and_click() + # Confirm export + history_export_tasks.export_button.wait_for_and_click() self._verify_last_export_record(expected_format=export_format, is_download=True) # Change export format export_format = "tar.gz" - history_export_tasks.toggle_options_link.wait_for_and_click() - history_export_tasks.export_format_selector.wait_for_visible() + destination = "remote-source" history_export_tasks.select_format(format=export_format).wait_for_and_click() - history_export_tasks.toggle_options_link.wait_for_and_click() + history_export_tasks.next_button.wait_for_and_click() + # Select destination + history_export_tasks.select_destination(destination=destination).wait_for_and_click() + history_export_tasks.next_button.wait_for_and_click() - # Export to FTP file source - history_export_tasks.file_source_tab.wait_for_present() - history_export_tasks.file_source_tab.wait_for_and_click() - self._export_to_ftp_with_filename("my_export.tar.gz") + # Select FTP file source + self.components.history_export.directory_input.wait_for_and_click() + self.components.files_dialog.ftp_label.wait_for_and_click() + self.components.upload.file_dialog_ok.wait_for_and_click() + + # Go to Summary step + history_export_tasks.next_button.wait_for_and_click() + + # Set filename + filename = "my_export.tar.gz" + history_export_tasks.exported_file_name.wait_for_and_send_keys(filename) + + # Confirm export + history_export_tasks.export_button.wait_for_and_click() self._verify_last_export_record(expected_format=export_format) @@ -125,8 +145,8 @@ def _verify_last_export_record( self, expected_format: str, expect_up_to_date: bool = True, is_download: bool = False ): last_export_record = self.components.last_export_record - last_export_record.preparing_export.wait_for_visible() - last_export_record.preparing_export.wait_for_absent(wait_type=self.wait_types.DATABASE_OPERATION) + last_export_record.preparing_export_badge.wait_for_visible() + last_export_record.preparing_export_badge.wait_for_absent(wait_type=self.wait_types.DATABASE_OPERATION) last_export_record.details.wait_for_visible() format_element = last_export_record.export_format.wait_for_visible() @@ -138,7 +158,7 @@ def _verify_last_export_record( last_export_record.outdated_icon.wait_for_visible() if is_download: - last_export_record.expiration_warning_icon.wait_for_visible() + last_export_record.expiration_warning_badge.wait_for_visible() last_export_record.download_btn.wait_for_visible() else: last_export_record.reimport_btn.wait_for_visible()