From 375b62ff04f750923e43b073259d126d0258fbfe Mon Sep 17 00:00:00 2001 From: chalapkoStanislav Date: Mon, 25 Nov 2024 10:44:42 +0200 Subject: [PATCH] feature(download_file): Updated file download tests --- pages/dashboard/dashboard-page.js | 19 +++----- tests/dashboard/dashboard-files.spec.js | 47 ++----------------- .../panels-features-main-menu.spec.js | 9 +--- 3 files changed, 11 insertions(+), 64 deletions(-) diff --git a/pages/dashboard/dashboard-page.js b/pages/dashboard/dashboard-page.js index fe499f2e..d8be1140 100644 --- a/pages/dashboard/dashboard-page.js +++ b/pages/dashboard/dashboard-page.js @@ -47,7 +47,6 @@ exports.DashboardPage = class DashboardPage extends BasePage { .getByRole('button', { name: 'New File 1' }) .locator(`div[class*="dashboard_grid__library"]`); this.downloadFilePenpotMenuItem = page.getByTestId('download-binary-file'); - this.downloadFileStandardMenuItem = page.getByTestId('download-standard-file'); this.dashboardSection = page.locator('[class="main_ui_dashboard__dashboard"]'); this.downloadFileTickIcon = page.locator('svg[class="icon-tick"]'); this.downloadFileCloseButton = page @@ -350,25 +349,19 @@ exports.DashboardPage = class DashboardPage extends BasePage { await expect(this.sharedLibraryIcon).not.toBeVisible(); } - async downloadFileViaRightClick(isStandardFile = true) { + async downloadFileViaRightClick() { await this.fileTile.click({ button: 'right' }); - if (isStandardFile) { - await this.downloadFileStandardMenuItem.click(); - } else { - await this.downloadFilePenpotMenuItem.click(); - } + await this.downloadFilePenpotMenuItem.click(); + await this.page.waitForEvent('download'); await expect(this.downloadFileTickIcon).toBeVisible(); await this.downloadFileCloseButton.click(); } - async downloadFileViaOptionsIcon(isStandardFile = true) { + async downloadFileViaOptionsIcon() { await this.clickOnFileOptions(); - if (isStandardFile) { - await this.downloadFileStandardMenuItem.click(); - } else { - await this.downloadFilePenpotMenuItem.click(); - } + await this.downloadFilePenpotMenuItem.click(); + await this.page.waitForEvent('download'); await expect(this.downloadFileTickIcon).toBeVisible(); await this.downloadFileCloseButton.click(); diff --git a/tests/dashboard/dashboard-files.spec.js b/tests/dashboard/dashboard-files.spec.js index 635f706a..61952bb0 100644 --- a/tests/dashboard/dashboard-files.spec.js +++ b/tests/dashboard/dashboard-files.spec.js @@ -142,18 +142,7 @@ mainTest( ); mainTest( - qase(67, 'DA-13 Download Penpot file in Drafts via right click'), - async ({ page }) => { - const dashboardPage = new DashboardPage(page); - const mainPage = new MainPage(page); - await dashboardPage.createFileViaPlaceholder(); - await mainPage.clickPencilBoxButton(); - await dashboardPage.downloadFileViaRightClick(false); - }, -); - -mainTest( - qase(69, 'DA-15 Download standard file in Drafts via right click'), + qase(1913, 'Download Penpot file (.penpot) (in Drafts) via right click'), async ({ page }) => { const dashboardPage = new DashboardPage(page); const mainPage = new MainPage(page); @@ -330,35 +319,7 @@ mainTest( ); mainTest( - qase(1121, 'DA-35-1 Download Penpot file in Project via right click'), - async ({ page }) => { - const dashboardPage = new DashboardPage(page); - const mainPage = new MainPage(page); - await dashboardPage.clickAddProjectButton(); - await dashboardPage.setProjectName('Test Project'); - await dashboardPage.isProjectTitleDisplayed('Test Project'); - await dashboardPage.createFileViaPlaceholder(); - await mainPage.clickPencilBoxButton(); - await dashboardPage.downloadFileViaRightClick(false); - }, -); - -mainTest( - qase(1121, 'DA-35-2 Download Penpot file in Project via Options icon'), - async ({ page }) => { - const dashboardPage = new DashboardPage(page); - const mainPage = new MainPage(page); - await dashboardPage.clickAddProjectButton(); - await dashboardPage.setProjectName('Test Project'); - await dashboardPage.isProjectTitleDisplayed('Test Project'); - await dashboardPage.createFileViaPlaceholder(); - await mainPage.clickPencilBoxButton(); - await dashboardPage.downloadFileViaOptionsIcon(false); - }, -); - -mainTest( - qase(1122, 'DA-36-1 Download standard file in Project via right click'), + qase(1121, 'Download Penpot file (.penpot) (in project) via right click'), async ({ page }) => { const dashboardPage = new DashboardPage(page); const mainPage = new MainPage(page); @@ -372,7 +333,7 @@ mainTest( ); mainTest( - qase(1122, 'DA-36-2 Download standard file in Project via Options icon'), + qase(1121, 'Download Penpot file (.penpot) (in project) via Options icon'), async ({ page }) => { const dashboardPage = new DashboardPage(page); const mainPage = new MainPage(page); @@ -381,7 +342,7 @@ mainTest( await dashboardPage.isProjectTitleDisplayed('Test Project'); await dashboardPage.createFileViaPlaceholder(); await mainPage.clickPencilBoxButton(); - await dashboardPage.downloadFileViaOptionsIcon(); + await dashboardPage.downloadFileViaOptionsIcon(false); }, ); diff --git a/tests/panels-features/panels-features-main-menu.spec.js b/tests/panels-features/panels-features-main-menu.spec.js index 848827be..0b470c3e 100644 --- a/tests/panels-features/panels-features-main-menu.spec.js +++ b/tests/panels-features/panels-features-main-menu.spec.js @@ -196,20 +196,13 @@ mainTest( }, ); -mainTest(qase(829, 'PF-111 Download penpot file .penpot'), async ({ page }) => { +mainTest(qase(1911, 'Download Penpot file (.penpot)'), async ({ page }) => { const mainPage = new MainPage(page); await mainPage.clickMainMenuButton(); await mainPage.clickFileMainMenuItem(); await mainPage.downloadPenpotFileViaMenu(); }); -mainTest(qase(830, 'PF-112 Download standard file .svg+.json'), async ({ page }) => { - const mainPage = new MainPage(page); - await mainPage.clickMainMenuButton(); - await mainPage.clickFileMainMenuItem(); - await mainPage.downloadStandardFileViaMenu(); -}); - mainTest(qase(831, 'PF-113 Add/Remove as shared library'), async ({ page }) => { const mainPage = new MainPage(page); const assetsPanelPage = new AssetsPanelPage(page);