From b253d4f4dfe80a530c4b01c68c91afd0bc2882ba Mon Sep 17 00:00:00 2001 From: Tal Hilzenrat Date: Wed, 4 Feb 2026 14:32:51 -0500 Subject: [PATCH] refactor downloads test --- cypress/e2e/downloads.cy.js | 50 ++++++++++++++++++++-------------- cypress/views/downloadsPage.js | 32 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 21 deletions(-) create mode 100644 cypress/views/downloadsPage.js diff --git a/cypress/e2e/downloads.cy.js b/cypress/e2e/downloads.cy.js index 6fd9a1b..9437b58 100644 --- a/cypress/e2e/downloads.cy.js +++ b/cypress/e2e/downloads.cy.js @@ -1,23 +1,31 @@ +import { downloadsPage } from '../views/downloadsPage' + describe('Downloads Management', () => { - beforeEach(() => { - cy.login(`${Cypress.env('host')}`, `${Cypress.env('auth')}`, `${Cypress.env('username')}`, `${Cypress.env('password')}`) - }) - it('Should download os flightctl cli for Windows ARM 64', () => { - cy.downloadClifile(`Windows`, `ARM 64`) - }) - it('Should download os flightctl cli for Windows x86_64', () => { - cy.downloadClifile(`Windows`, `x86_64`) - }) - it('Should download os flightctl cli for Linux ARM 64', () => { - cy.downloadClifile(`Linux`, `ARM 64`) - }) - it('Should download os flightctl cli for Linux x86_64', () => { - cy.downloadClifile(`Linux`, `x86_64`) - }) - it('Should download os flightctl cli for macOS ARM 64', () => { - cy.downloadClifile(`Mac`, `ARM 64`) - }) - it('Should download os flightctl cli for macOS x86_64', () => { - cy.downloadClifile(`Mac`, `x86_64`) - }) + beforeEach(() => { + cy.login(`${Cypress.env('host')}`, `${Cypress.env('auth')}`, `${Cypress.env('username')}`, `${Cypress.env('password')}`) + }) + + it.skip('Should download flightctl CLI for Windows ARM 64', () => { + downloadsPage.downloadCliFile('Windows', 'ARM 64') + }) + + it.skip('Should download flightctl CLI for Windows x86_64', () => { + downloadsPage.downloadCliFile('Windows', 'x86_64') + }) + + it.skip('Should download flightctl CLI for Linux ARM 64', () => { + downloadsPage.downloadCliFile('Linux', 'ARM 64') + }) + + it.skip('Should download flightctl CLI for Linux x86_64', () => { + downloadsPage.downloadCliFile('Linux', 'x86_64') + }) + + it.skip('Should download flightctl CLI for macOS ARM 64', () => { + downloadsPage.downloadCliFile('Mac', 'ARM 64') + }) + + it.skip('Should download flightctl CLI for macOS x86_64', () => { + downloadsPage.downloadCliFile('Mac', 'x86_64') + }) }) \ No newline at end of file diff --git a/cypress/views/downloadsPage.js b/cypress/views/downloadsPage.js new file mode 100644 index 0000000..1beb551 --- /dev/null +++ b/cypress/views/downloadsPage.js @@ -0,0 +1,32 @@ +/** + * DownloadsPage object for CLI download operations + */ +export const downloadsPage = { + /** + * Download flightctl CLI for a specific platform and architecture + */ + downloadCliFile: (platform, arch) => { + let filename + if (platform === 'Windows') { + if (arch === 'ARM 64') { + filename = `${platform}-flightctl-arm64.zip` + } else { + filename = `${platform}-flightctl-x86_64.zip` + } + } else { + filename = `${platform}-${arch}-flightctl.tar.gz` + } + + cy.get('[data-test="help-dropdown-toggle"]').click().should('be.visible') + cy.contains('Command Line Tools').click() + cy.log(`Download flightctl for ${platform} for ${arch}`) + cy.get('.co-external-link').contains(`Download flightctl for ${platform} for ${arch}`) + .should('have.attr', 'href').then((href) => { + cy.downloadFile(`${href}`, 'downloads', filename, { timeout: 60000 }) + }) + + let fullpath = `downloads/${filename}` + cy.log(`Downloaded file: ${fullpath}`) + cy.readFile(fullpath).should('exist') + }, +}