Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for template provider and support
- Loading branch information
Showing
10 changed files
with
228 additions
and
6 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
frontend/packages/kubevirt-plugin/integration-tests-cypress/cypress-a11y-report.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"numberChecks": "64", | ||
"numberViolations": "0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
...ages/kubevirt-plugin/integration-tests-cypress/tests/vm-template/template-support.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import { virtualization } from '../../view/virtualization'; | ||
import { testName } from '../../support'; | ||
import { wizard } from '../../view/wizard'; | ||
|
||
const TEMPLATE_NAME = 'foo'; | ||
const TEMPLATE_NO_SUPPORT_NAME = 'foo-no-support'; | ||
|
||
describe('test VM template support', () => { | ||
before(() => { | ||
cy.visit(''); | ||
cy.createProject(testName); | ||
}); | ||
|
||
beforeEach(() => { | ||
virtualization.templates.visit(); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.deleteResource({ | ||
kind: 'Template', | ||
metadata: { | ||
name: TEMPLATE_NAME, | ||
namespace: testName, | ||
}, | ||
}); | ||
cy.deleteResource({ | ||
kind: 'Template', | ||
metadata: { | ||
name: TEMPLATE_NO_SUPPORT_NAME, | ||
namespace: testName, | ||
}, | ||
}); | ||
}); | ||
|
||
it('details show user supported template', () => { | ||
wizard.template.open(); | ||
wizard.template.createTemplate(TEMPLATE_NAME, 'bar', true); | ||
virtualization.templates.testProvider(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.testSource(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.testSupport( | ||
TEMPLATE_NAME, | ||
'bar', | ||
Cypress.env('DOWNSTREAM') ? 'Red Hat' : undefined, | ||
); | ||
|
||
wizard.template.open(); | ||
wizard.template.createTemplate(TEMPLATE_NO_SUPPORT_NAME, 'bar', false); | ||
virtualization.templates.testProvider(TEMPLATE_NO_SUPPORT_NAME, 'bar'); | ||
virtualization.templates.testSource(TEMPLATE_NO_SUPPORT_NAME, 'bar'); | ||
virtualization.templates.testSupport( | ||
TEMPLATE_NO_SUPPORT_NAME, | ||
undefined, | ||
Cypress.env('DOWNSTREAM') ? 'Red Hat' : undefined, | ||
); | ||
}); | ||
|
||
if (Cypress.env('DOWNSTREAM')) { | ||
it('shows support modal for community supported template', () => { | ||
virtualization.templates.testSupport('CentOS 7.0+ VM'); | ||
virtualization.templates.clickCreate('CentOS 7.0+ VM'); | ||
cy.get('.ReactModal__Overlay').within(() => { | ||
cy.get('a').should('have.attr', 'href', 'https://www.centos.org'); | ||
cy.byLegacyTestID('modal-cancel-action').click(); | ||
}); | ||
}); | ||
|
||
it('shows no support modal for user supported template based on community supported one', () => { | ||
wizard.template.open(); | ||
wizard.template.createTemplate(TEMPLATE_NAME, 'bar', true, 'CentOS 7 or higher'); | ||
virtualization.templates.testProvider(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.testSource(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.testSupport(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.clickCreate(TEMPLATE_NAME); | ||
cy.get('.ReactModal__Overlay').should('not.exist'); | ||
}); | ||
|
||
it('shows support modal for user template based on community supported one', () => { | ||
wizard.template.open(); | ||
wizard.template.createTemplate(TEMPLATE_NAME, 'bar', false, 'CentOS 7 or higher'); | ||
virtualization.templates.testProvider(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.testSource(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.testSupport(TEMPLATE_NAME); | ||
virtualization.templates.clickCreate(TEMPLATE_NAME); | ||
cy.get('.ReactModal__Overlay').within(() => { | ||
cy.get('a').should('have.attr', 'href', 'https://www.centos.org'); | ||
cy.byLegacyTestID('modal-cancel-action').click(); | ||
}); | ||
}); | ||
|
||
it('shows no support modal for supported template', () => { | ||
virtualization.templates.testSupport('Red Hat Enterprise Linux 8.0+ VM', 'Red Hat'); | ||
virtualization.templates.clickCreate('Red Hat Enterprise Linux 8.0+ VM'); | ||
cy.get('.ReactModal__Overlay').should('not.exist'); | ||
}); | ||
|
||
it('shows no support modal for user supported template', () => { | ||
wizard.template.open(); | ||
wizard.template.createTemplate( | ||
TEMPLATE_NAME, | ||
'bar', | ||
true, | ||
'Red Hat Enterprise Linux 8.0 or higher', | ||
); | ||
virtualization.templates.testProvider(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.testSource(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.testSupport(TEMPLATE_NAME, 'bar', 'Red Hat'); | ||
virtualization.templates.clickCreate(TEMPLATE_NAME); | ||
cy.get('.ReactModal__Overlay').should('not.exist'); | ||
}); | ||
|
||
it('shows support modal for user template with no support', () => { | ||
wizard.template.open(); | ||
wizard.template.createTemplate(TEMPLATE_NAME, 'bar', false, 'CentOS 7 or higher'); | ||
virtualization.templates.testProvider(TEMPLATE_NAME, 'bar'); | ||
virtualization.templates.testSource(TEMPLATE_NAME, 'bar'); | ||
cy.exec( | ||
`kubectl patch template -n ${testName} ${TEMPLATE_NAME} --type=json -p'[{"op": "remove", "path": "/metadata/annotations/template.kubevirt.ui~1parent-support-level"}, {"op": "remove", "path": "/metadata/annotations/template.kubevirt.ui~1parent-provider-url"}]'`, | ||
); | ||
virtualization.templates.testSupport(TEMPLATE_NAME); | ||
virtualization.templates.clickCreate(TEMPLATE_NAME); | ||
cy.get('.ReactModal__Overlay').within(() => { | ||
cy.byTestID('no-support-description').should('exist'); | ||
}); | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
frontend/packages/kubevirt-plugin/integration-tests-cypress/view/wizard.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { ProvisionSource } from '../enums/provisionSource'; | ||
|
||
export const wizard = { | ||
template: { | ||
open: () => { | ||
cy.byLegacyTestID('details-actions').click(); | ||
cy.byLegacyTestID('template-wizard').click(); | ||
}, | ||
createTemplate: ( | ||
name: string, | ||
provider: string, | ||
supported: boolean, | ||
baseOS = 'Red Hat Enterprise Linux 6.0 or higher', | ||
) => { | ||
cy.get('#vm-name').type(name); | ||
cy.get('#template-provider').type(provider); | ||
if (supported) { | ||
cy.get('#template-supported').click(); | ||
cy.get('button') | ||
.contains('Support by template provider') | ||
.click(); | ||
} | ||
cy.get('#operating-system-dropdown').click(); | ||
cy.get('button') | ||
.contains(baseOS) | ||
.click({ force: true }); | ||
cy.get('#image-source-type-dropdown').click(); | ||
cy.get('.pf-c-select__menu') | ||
.contains(ProvisionSource.REGISTRY.getDescription()) | ||
.click(); | ||
cy.get('input[id="provision-source-container"]').type(ProvisionSource.REGISTRY.getSource()); | ||
cy.get('#create-vm-wizard-reviewandcreate-btn').click(); | ||
cy.get('#create-vm-wizard-submit-btn').click(); | ||
cy.byTestID('success-list').click(); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters