Skip to content

Commit

Permalink
Delete OS version and channel in e2e UI tests (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
juadk authored Dec 1, 2022
1 parent 6f323f5 commit f475425
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/unit_tests/machine_registration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Machine registration testing', () => {
cy.get('.outlet > header').contains('Registration Endpoints');
cy.get('body').then(($body) => {
if (!$body.text().includes('There are no rows to show.')) {
cy.deleteAllMachReg();
cy.deleteAllResources();
};
});
});
Expand Down
19 changes: 18 additions & 1 deletion cypress/e2e/unit_tests/upgrade.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('Upgrade tests', () => {

// Click on the Elemental's icon
elemental.accessElementalMenu();

});

it('Create an OS Version Channels', () => {
Expand Down Expand Up @@ -48,6 +47,24 @@ describe('Upgrade tests', () => {
cy.contains('Active teal-5.3');
});

it('Delete OS Versions', () => {
cy.get('.nav').contains('Advanced').click();
cy.get('.nav').contains('OS Versions').click();
cy.contains('teal-5.2').parent().parent().click();
cy.clickButton('Delete');
cy.confirmDelete();
cy.contains('teal-5.2').should('not.exist');
});

it('Delete OS Versions Channels', () => {
cy.get('.nav').contains('Advanced').click();
cy.get('.nav').contains('OS Version Channels').click();
cy.deleteAllResources();
cy.get('.nav').contains('Advanced').click();
cy.get('.nav').contains('OS Versions').click();
cy.contains('There are no rows to show');
});

it('Upgrade one node with OS Image Upgrades', () => {
// Create ManagedOSImage resource
cy.get('.nav').contains('Advanced').click();
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare global {
getDetail(name: string, type: string, namespace?: string): Chainable<Element>;
createMachReg(machRegName: string, namespace?: string, checkLabels?: boolean, checkAnnotations?: boolean, customCloudConfig?: string, checkDefaultCloudConfig?: boolean): Chainable<Element>;
deleteMachReg(machRegName: string): Chainable<Element>;
deleteAllMachReg():Chainable<Element>;
deleteAllResources():Chainable<Element>;
addMachRegLabel(labelName: string, labelValue: string):Chainable<Element>;
checkMachRegLabel(machRegName: string, labelName: string, labelValue: string):Chainable<Element>;
checkMachRegAnnotation(machRegName: string, annotationName: string, annotationValue: string):Chainable<Element>;
Expand Down
16 changes: 8 additions & 8 deletions cypress/support/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ Cypress.Commands.add('addHelmRepo', ({repoName, repoUrl, repoType}) => {
cy.clickButton('Create');
});

// Delete all resources from a page
Cypress.Commands.add('deleteAllResources', () => {
cy.get('[width="30"] > .checkbox-outer-container').click();
cy.clickButton('Delete');
cy.confirmDelete();
cy.contains('There are no rows to show');
});

// Machine registration functions

// Create a machine registration
Expand Down Expand Up @@ -278,14 +286,6 @@ Cypress.Commands.add('deleteMachReg', ({machRegName}) => {
cy.contains(machRegName).should('not.exist')
});

// Delete all machine registrations
Cypress.Commands.add('deleteAllMachReg', () => {
cy.get('[width="30"] > .checkbox-outer-container').click();
cy.clickButton('Delete');
cy.confirmDelete();
cy.contains('There are no rows to show');
});

// Machine Inventory functions

// Import machine inventory
Expand Down

0 comments on commit f475425

Please sign in to comment.