Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions cypress/e2e/device.cy.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { devicesPage } from '../views/devicesPage'

describe('Device Management', () => {
beforeEach(() => {
cy.login(`${Cypress.env('host')}`, `${Cypress.env('auth')}`, `${Cypress.env('username')}`, `${Cypress.env('password')}`)
})

it('Should approve a device enrollment request', () => {
cy.deviceApproval()
devicesPage.approveDevice()
})
/* it('Should open a terminal on a device', () => {
cy.openTerminal()

/* it('Should open a terminal on a device', () => {
devicesPage.openTerminal()
}) */

it('Should edit a device', () => {
cy.editDevice(`${Cypress.env('image')}`)
devicesPage.editDevice(`${Cypress.env('image')}`)
})

it('Should decommission a device', () => {
//login command is in commands.js
cy.decommissionDevice()
})
})
devicesPage.decommissionDevice()
})
})
50 changes: 29 additions & 21 deletions cypress/e2e/fleet.cy.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import { fleetsPage } from '../views/fleetsPage'
import { repositoriesPage } from '../views/repositoriesPage'

describe('Fleet Management', () => {
beforeEach(() => {
cy.login(`${Cypress.env('host')}`, `${Cypress.env('auth')}`, `${Cypress.env('username')}`, `${Cypress.env('password')}`)
})
it('Should create a fleet', () => {
cy.createFleet(`${Cypress.env('image')}`)
})
/* it('Should edit a fleet', () => {
cy.editFleet(`${Cypress.env('image')}`)
}) */
it('Should delete a fleet', () => {
cy.deleteFleet('test-fleet')
})
it('Should import a fleet', () => {
cy.importFleet()
})
/* it('Should delete an imported fleet', () => {
cy.deleteRepository('test-fleet')
cy.wait(5000)
cy.deleteFleet('basic-nginx-fleet')
}) */
})
beforeEach(() => {
cy.login(`${Cypress.env('host')}`, `${Cypress.env('auth')}`, `${Cypress.env('username')}`, `${Cypress.env('password')}`)
})

it('Should create a fleet', () => {
fleetsPage.createFleet(`${Cypress.env('image')}`)
})

/* it('Should edit a fleet', () => {
fleetsPage.editFleet(`${Cypress.env('image')}`)
}) */

it('Should delete a fleet', () => {
fleetsPage.deleteFleet('test-fleet')
})

it('Should import a fleet', () => {
fleetsPage.importFleet()
})

/* it('Should delete an imported fleet', () => {
repositoriesPage.deleteRepository('test-fleet')
cy.wait(5000)
fleetsPage.deleteFleet('basic-nginx-fleet')
}) */
})
32 changes: 18 additions & 14 deletions cypress/e2e/repository.cy.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { repositoriesPage } from '../views/repositoriesPage'

describe('Repository Management', () => {
beforeEach(() => {
cy.login(`${Cypress.env('host')}`, `${Cypress.env('auth')}`, `${Cypress.env('username')}`, `${Cypress.env('password')}`)
})
/* it('Should create a repository', () => {
cy.createRepository(`${Cypress.env('repository')}`, `${Cypress.env('revision')}`, `${Cypress.env('resource')}`)

}) */
it('Should edit a repository', () => {
cy.editRepository(`${Cypress.env('repository')}`)
})
/* it('Should delete a repository', () => {
cy.deleteRepository(`${Cypress.env('repository')}`)
}) */
})
beforeEach(() => {
cy.login(`${Cypress.env('host')}`, `${Cypress.env('auth')}`, `${Cypress.env('username')}`, `${Cypress.env('password')}`)
})

/* it('Should create a repository', () => {
repositoriesPage.createRepository(`${Cypress.env('repository')}`, `${Cypress.env('revision')}`, `${Cypress.env('resource')}`)
}) */

it('Should edit a repository', () => {
repositoriesPage.editRepository(`${Cypress.env('repository')}`)
})

/* it('Should delete a repository', () => {
repositoriesPage.deleteRepository(`${Cypress.env('repository')}`)
}) */
})
237 changes: 0 additions & 237 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,177 +24,6 @@ Cypress.Commands.add('login', (url=`${Cypress.env('host')}`, auth=`${Cypress.env
//cy.get('button.pf-v5-c-menu__item').contains('All Clusters').click()
})

// Command to select organization if the selection page appears
Cypress.Commands.add('selectOrganizationIfNeeded', (orgName = 'Default', maxRetries = 5, retryDelay = 1000) => {
const checkForOrgSelection = (attempt = 1) => {
cy.log(`Checking for organization selection page (attempt ${attempt}/${maxRetries})`)

// Wait for page to stabilize
cy.wait(retryDelay)

cy.get('body').then(($body) => {
if ($body.text().includes('Select Organization')) {
cy.log(`Organization selection page detected, selecting ${orgName}`)
// Click on the organization name to select it
cy.contains(orgName).click()
// Click the Continue button
cy.contains('button', 'Continue').click()
// Wait for the page to load after selection
cy.get('.pf-v5-c-page', { timeout: 30000 }).should('exist')
} else if (attempt < maxRetries) {
// Retry if we haven't reached max attempts
cy.log(`Organization selection not found yet, retrying...`)
checkForOrgSelection(attempt + 1)
} else {
cy.log('No organization selection page detected after all retries, continuing...')
}
})
}

checkForOrgSelection()
})

Cypress.Commands.add('deviceApproval', () => {
cy.get('#nav-toggle').should('exist')
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Devices').click()
cy.selectOrganizationIfNeeded('Default')
cy.get('h2.pf-v5-c-title.pf-m-3xl').contains('Devices pending approval')
cy.get('[data-label="Approve"] > .pf-v5-c-button').should('exist')
cy.get('[data-label="Approve"] > .pf-v5-c-button').should('be.visible')
cy.get('[data-label="Approve"] > .pf-v5-c-button').click()
cy.get('#rich-validation-field-deviceAlias').should('be.visible')
cy.get('#rich-validation-field-deviceAlias').type('test-device')
cy.get('#rich-validation-field-deviceAlias').should('have.value', 'test-device')
cy.get('.pf-v5-c-form__actions > .pf-m-primary').should('be.visible')
cy.get('.pf-v5-c-form__actions > .pf-m-primary').click()
cy.get('[data-label="Device status"]', { timeout: 50000 }).should('contain', 'Online')
})
Cypress.Commands.add('editDevice', (img=`${Cypress.env('image')}`) => {
cy.get('#nav-toggle').should('exist')
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Devices').click()
cy.selectOrganizationIfNeeded('Default')
cy.get('a > .fctl-resource-link__text').contains('test-device')
cy.get('.pf-v5-c-table__action > .pf-v5-c-menu-toggle').click()
cy.wait(1000)
cy.contains('Edit device configurations').click()
cy.wait(1000)
cy.get('#rich-validation-field-deviceAlias').should('be.visible')
cy.get('#rich-validation-field-deviceAlias').should('have.value', 'test-device')
cy.get('#rich-validation-field-deviceAlias').clear()
cy.get('#rich-validation-field-deviceAlias').type('test-device-edited')
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('#textfield-osImage').should('be.visible')
cy.get('#textfield-osImage').clear()
cy.get('#textfield-osImage').type(img)
cy.get('#textfield-osImage').should('have.value', `${img}`)
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('.pf-v5-c-title > .pf-v5-l-grid > .pf-m-6-col-on-md', { timeout: 50000 }).should('contain', 'test-device-edited')
})
Cypress.Commands.add('decommissionDevice', () => {
cy.get('#nav-toggle').should('exist')
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Devices').click()
cy.selectOrganizationIfNeeded('Default')
cy.get('.pf-v5-c-table__tbody > .pf-v5-c-table__tr > .pf-v5-c-table__check > label > input').should('be.visible')
cy.get('.pf-v5-c-table__tbody > .pf-v5-c-table__tr > .pf-v5-c-table__check > label > input').click()
cy.get('#devices-toolbar > :nth-child(1) > .pf-v5-c-toolbar__content-section > :nth-child(3) > .pf-v5-c-button').should('be.visible')
cy.get('#devices-toolbar > :nth-child(1) > .pf-v5-c-toolbar__content-section > :nth-child(3) > .pf-v5-c-button').click()
cy.get('.pf-m-danger').should('be.visible')
cy.get('.pf-m-danger').click()
cy.get('.pf-v5-c-table__thead > .pf-v5-c-table__tr > .pf-v5-c-table__check > label > input').should('be.visible')
cy.get('.pf-v5-c-table__thead > .pf-v5-c-table__tr > .pf-v5-c-table__check > label > input').click()
cy.get('.pf-v5-c-toolbar__group > :nth-child(3) > .pf-v5-c-button').should('be.visible')
cy.get('.pf-v5-c-toolbar__group > :nth-child(3) > .pf-v5-c-button').click()
cy.get('.pf-m-danger').should('be.visible')
cy.get('.pf-m-danger').click()
cy.get('.pf-v5-c-switch__toggle').should('be.visible')
cy.get('.pf-v5-c-switch__toggle').click()

})
Cypress.Commands.add('createFleet', (img = `${Cypress.env('image')}`, fleetname = `${Cypress.env('fleetname')}`) => {
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Fleets').click()
cy.selectOrganizationIfNeeded('Default')
cy.get(':nth-child(2) > .pf-v5-l-split > :nth-child(1) > .pf-v5-c-button').should('exist')
cy.get(':nth-child(2) > .pf-v5-l-split > :nth-child(1) > .pf-v5-c-button').should('be.visible')
cy.get(':nth-child(2) > .pf-v5-l-split > :nth-child(1) > .pf-v5-c-button').click()
cy.get('#rich-validation-field-name').should('be.visible')
cy.get('#rich-validation-field-name').type(fleetname)
cy.get('#rich-validation-field-name').should('have.value', 'test-fleet')
cy.get('.pf-v5-l-stack__item > .pf-v5-c-label-group > .pf-v5-c-label-group__main > .pf-v5-c-label-group__list').click()
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('#textfield-osImage').should('be.visible')
cy.get('#textfield-osImage').type(img)
cy.get('#textfield-osImage').should('have.value', img)
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
//cy.get('.pf-v5-c-description-list__text > .pf-v5-l-flex', { timeout: 50000 }).should('contain', 'Valid')
})
Cypress.Commands.add('editFleet', (fleetname = `${Cypress.env('fleetname')}`,img1 = `${Cypress.env('newimage')}`) => {
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Fleets').click()
cy.selectOrganizationIfNeeded('Default')
cy.get('[data-label="Name"]').contains(fleetname)
cy.get('.pf-v5-c-table__action > .pf-v5-c-menu-toggle').click()
cy.get('td.pf-v5-c-table__td').then($cells => cy.wrap($cells.eq(-1)))
cy.get('.pf-v5-c-table__action > .pf-v5-c-menu-toggle').should('be.visible')
// cy.get('.pf-v5-c-table__action > .pf-v5-c-menu-toggle').click()
cy.get('[data-ouia-component-id="OUIA-Generated-DropdownItem-2"] > .pf-v5-c-menu__item > .pf-v5-c-menu__item-main > .pf-v5-c-menu__item-text').click()
cy.get(':nth-child(1) > .pf-v5-c-form__group-label > .pf-v5-c-form__label > .pf-v5-c-form__label-text').should('contain', 'Fleet name')
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('#textfield-osImage').should('be.visible')
cy.get('#textfield-osImage').clear()
cy.get('#textfield-osImage').type(img1)
cy.get('#textfield-osImage').should('have.value', img1)
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('.pf-v5-c-title').should('contain', fleetname)
})
Cypress.Commands.add('deleteFleet', (fleetname = `${Cypress.env('fleetname')}`) => {
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Fleets').click()
cy.selectOrganizationIfNeeded('Default')
cy.get('[data-label="Name"]').contains(fleetname)
cy.get('.pf-v5-c-table__tbody > .pf-v5-c-table__tr > .pf-v5-c-table__check > label > input').click()
cy.get('button.pf-v5-c-button.pf-m-secondary').contains('Delete fleets').should('be.visible')
cy.get('button.pf-v5-c-button.pf-m-secondary').contains('Delete fleets').click()
cy.get('.pf-m-danger').should('be.visible')
cy.get('.pf-m-danger').click()
})
Cypress.Commands.add('importFleet', (repo = `${Cypress.env('repository')}`, fleetname = `${Cypress.env('fleetname')}`, resource = `${Cypress.env('resource')}`, resourcename = `${Cypress.env('resourcename')}`, revision = `${Cypress.env('revision')}`) => {
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Fleets').click()
cy.selectOrganizationIfNeeded('Default')
cy.get(':nth-child(2) > .pf-v5-l-split > :nth-child(2) > .pf-v5-c-button').should('exist')
cy.get(':nth-child(2) > .pf-v5-l-split > :nth-child(2) > .pf-v5-c-button').should('be.visible')
cy.get(':nth-child(2) > .pf-v5-l-split > :nth-child(2) > .pf-v5-c-button').click()
cy.get('#rich-validation-field-name').type(fleetname)
cy.get('#textfield-url').type(repo)
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('#rich-validation-field-resourceSyncs\\[0\\]\\.name').clear()
cy.get('#rich-validation-field-resourceSyncs\\[0\\]\\.name').type('test-resource')
cy.get('#textfield-resourceSyncs\\[0\\]\\.targetRevision').clear()
cy.get('#textfield-resourceSyncs\\[0\\]\\.targetRevision').type(revision)
cy.get('#textfield-resourceSyncs\\[0\\]\\.path').clear()
cy.get('#textfield-resourceSyncs\\[0\\]\\.path').type(resourcename)
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').should('be.visible')
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('.pf-v5-c-wizard__footer > .pf-m-primary').click()
cy.get('td[data-label="Status"]', { timeout: 1000000 }).should('contain', 'Valid')
})
Cypress.Commands.add('downloadClifile', (platform = `${Cypress.env('platform')}`, arch = `${Cypress.env('arch')}`) => {
let filename
if (platform === 'Windows') {
Expand All @@ -216,70 +45,4 @@ Cypress.Commands.add('downloadClifile', (platform = `${Cypress.env('platform')}`
let fullpath = `downloads/${filename}`
cy.log(`Downloaded file: ${fullpath}`)
cy.readFile(fullpath).should('exist')
})
Cypress.Commands.add('createRepository', (reponame = `${Cypress.env('repositoryname')}`,repo = `${Cypress.env('repository')}`,revision = `${Cypress.env('revision')}`, resource = `${Cypress.env('resource')}`) => {
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Repositories').click()
cy.selectOrganizationIfNeeded('Default')
cy.get('.pf-v5-c-toolbar__content-section > :nth-child(2) > .pf-v5-c-button').should('be.visible')
cy.get('.pf-v5-c-toolbar__content-section > :nth-child(2) > .pf-v5-c-button').click()
cy.get('#rich-validation-field-name').should('be.visible')
cy.get('#rich-validation-field-name').type('test-repository')
cy.get('#rich-validation-field-name').should('have.value', 'test-repository')
cy.get('#use-resource-syncs').should('be.visible')
cy.get('#textfield-url').type(repo)
cy.get('#textfield-url').should('have.value', repo)
cy.get('.pf-v5-c-form__section').should('be.visible')
cy.contains('Resource sync name').type('test-resource')
cy.get('#textfield-resourceSyncs\\[0\\]\\.targetRevision').type(revision)
cy.get('#textfield-resourceSyncs\\[0\\]\\.path').type(resource)
cy.get('.pf-v5-c-form__actions > .pf-m-primary').click()
cy.get('.pf-v5-c-description-list__text > .pf-v5-l-flex > :nth-child(2)', { timeout: 100000 }).should('contain', 'Accessible')
})
Cypress.Commands.add('editRepository',(reponame = `${Cypress.env('repositoryname')}`,newyaml = `${Cypress.env('newyaml')}`, resourcename = `${Cypress.env('resourcename')}`, revision = `${Cypress.env('revision')}`) => {
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Repositories').click()
cy.selectOrganizationIfNeeded('Default')

cy.contains(reponame).should('be.visible')
cy.get('.pf-v5-c-table__action').click()
cy.get('[data-ouia-component-id="OUIA-Generated-DropdownItem-1"] > .pf-v5-c-menu__item > .pf-v5-c-menu__item-main > .pf-v5-c-menu__item-text').contains('Edit repository').click()
cy.get('.pf-v5-c-check__body > .pf-m-link').click()
cy.get('#rich-validation-field-resourceSyncs\\[1\\]\\.name').should('be.visible')
cy.get('#rich-validation-field-resourceSyncs\\[1\\]\\.name').clear()
cy.get('#rich-validation-field-resourceSyncs\\[1\\]\\.name').type('test-resource1')
cy.get('#rich-validation-field-resourceSyncs\\[1\\]\\.name').should('have.value', 'test-resource1')
//cy.get('#textfield-resourceSyncs\\[0\\]\\.targetRevision').clear()
cy.get('#textfield-resourceSyncs\\[1\\]\\.targetRevision').type(revision)
cy.get('#textfield-resourceSyncs\\[1\\]\\.path').clear()
cy.get('#textfield-resourceSyncs\\[1\\]\\.path').type(newyaml)
cy.get('.pf-v5-c-form__actions > .pf-m-primary').click()
cy.get('.pf-v5-c-description-list__text > .pf-v5-l-flex > :nth-child(2)', { timeout: 100000 }).should('contain', 'Accessible')
})
Cypress.Commands.add('deleteRepository',(reponame = `${Cypress.env('repositoryname')}`) => {
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Repositories').click()
cy.get('[data-label="Name"]').should('contain', reponame)
cy.get('.pf-v5-c-table__tbody > .pf-v5-c-table__tr > .pf-v5-c-table__check > label > input').should('be.visible')
cy.get('.pf-v5-c-table__tbody > .pf-v5-c-table__tr > .pf-v5-c-table__check > label > input').click()
cy.contains('Delete repositories').should('be.visible')
cy.contains('Delete repositories').click()
cy.get('.pf-m-danger').should('be.visible')
cy.get('.pf-m-danger').click()
})
Cypress.Commands.add('openTerminal', () => {
cy.get('#nav-toggle').click()
cy.contains('Edge Management').click()
cy.contains('Devices').click()
cy.get('a > .fctl-resource-link__text').contains('test-device').should('be.visible')
cy.get('a > .fctl-resource-link__text').click()
cy.contains('Terminal').should('be.visible')
cy.contains('Terminal').click()
cy.get('.pf-v5-l-bullseye', { timeout: 50000 }).should('be.visible')
cy.get('.pf-v5-l-bullseye').click()


})
Loading