-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8554 from metalice/connect-to-vm-using-ssh-cypres…
…s-tests Test vm ssh connect - cypress
- Loading branch information
Showing
7 changed files
with
184 additions
and
1 deletion.
There are no files selected for viewing
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
3 changes: 3 additions & 0 deletions
3
frontend/packages/kubevirt-plugin/integration-tests-cypress/fixtures/ssh.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,3 @@ | ||
{ | ||
"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPnp0CoHQoTOMg44Z8smEmi/Vrvt7FuBK6bDy5XpY/1g random@random" | ||
} |
54 changes: 54 additions & 0 deletions
54
...bevirt-plugin/integration-tests-cypress/tests/ssh/ssh-advanced-wizard-testing.includes.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,54 @@ | ||
export default ({ vmName }) => | ||
describe('ID (CNV-5971) Test if ssh service is present in advanced wizard', () => { | ||
it('should navigate to advanced wizard', () => { | ||
cy.get('[data-test=nav]') | ||
.filter('[href$=virtualization]') | ||
.then((link) => cy.visit(link.attr('href'))); | ||
cy.byLegacyTestID('item-create').click(); | ||
cy.byLegacyTestID('vm-wizard').click(); | ||
cy.get('.kv-select-template__tile') | ||
.eq(1) | ||
.click(); | ||
cy.byLegacyTestID('wizard-next') | ||
.as('nextButton') | ||
.click(); | ||
cy.byTestID('SupportModal').within(() => { | ||
cy.get('[id=confirm-action]').click(); | ||
}); | ||
cy.get('[id=image-source-type-dropdown]').click(); | ||
cy.contains('Import via Registry (creates PVC)').click(); | ||
cy.get('[id=provision-source-container').type('kubevirt/fedora-cloud-container-disk-demo'); | ||
cy.get('@nextButton').click(); | ||
cy.get('[id=vm-name]') | ||
.clear() | ||
.type(`${vmName}-advanced-wizard`); | ||
cy.byLegacyTestID('wizard-customize').click(); | ||
cy.get('.pf-c-wizard__nav-link') | ||
.filter(':contains("Advanced")') | ||
.click(); | ||
}); | ||
|
||
it('should open ssh accordion', () => { | ||
cy.get('[id=ssh]').click(); | ||
}); | ||
|
||
it('checking expose service is checked', () => { | ||
cy.get('[id=ssh-service-checkbox]').should('be.checked'); | ||
}); | ||
|
||
it('should continue to create vm', () => { | ||
cy.get('[id=create-vm-wizard-reviewandcreate-btn]').click(); | ||
cy.get('[id=create-vm-wizard-submit-btn]').click(); | ||
cy.byLegacyTestID('kubevirt-wizard-success-result').should('be.visible'); | ||
}); | ||
|
||
it('should navigate to services', () => { | ||
cy.get('[data-test=nav]') | ||
.filter('[href$=services]') | ||
.then((link) => cy.visit(link.attr('href'))); | ||
}); | ||
|
||
it('checking vm ssh service is present', () => { | ||
cy.byLegacyTestID(`${vmName}-advanced-wizard-ssh-service`).should('be.exist'); | ||
}); | ||
}); |
85 changes: 85 additions & 0 deletions
85
...es/kubevirt-plugin/integration-tests-cypress/tests/ssh/ssh-simple-wizard-test.includes.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,85 @@ | ||
export default ({ vmName }) => | ||
describe('ID (CNV-5970) Test creating a vm using simple wizard and adding an ssh key', () => { | ||
it('starting to create a vm', () => { | ||
cy.get('[data-test=nav]') | ||
.filter('[href$=virtualization]') | ||
.then((link) => cy.visit(link.attr('href'))); | ||
cy.byLegacyTestID('item-create').click(); | ||
cy.byLegacyTestID('vm-wizard').click(); | ||
cy.get('.kv-select-template__tile') | ||
.eq(1) | ||
.click(); | ||
cy.byLegacyTestID('wizard-next') | ||
.as('nextButton') | ||
.click(); | ||
cy.byTestID('SupportModal').within(() => { | ||
cy.get('[id=confirm-action]').click(); | ||
}); | ||
cy.get('[id=image-source-type-dropdown]').click(); | ||
cy.contains('Import via Registry (creates PVC)').click(); | ||
cy.get('[id=provision-source-container').type('kubevirt/fedora-cloud-container-disk-demo'); | ||
cy.get('@nextButton').click(); | ||
cy.get('[id=vm-name]') | ||
.clear() | ||
.type(vmName); | ||
}); | ||
|
||
it('checking if ssh keys message is visible', () => { | ||
cy.byTestID('SSHCreateService-info-message').should('be.visible'); | ||
}); | ||
|
||
it('should open authorized keys component', () => { | ||
cy.get('.SSHWizard-authorized-key').click(); | ||
}); | ||
|
||
it('checking no restore button', () => { | ||
cy.get('.SSHFormKey-restore-button').should('not.exist'); | ||
}); | ||
|
||
it('checking no identity label', () => { | ||
cy.get('.SSHFormKey-helperText-success').should('not.exist'); | ||
cy.get('.SSHFormKey-helperText-error').should('not.exist'); | ||
}); | ||
|
||
it('should add an ssh key', () => { | ||
cy.fixture('ssh').then((ssh) => { | ||
cy.get('.SSHFormKey-input-field').type(ssh?.key); | ||
}); | ||
}); | ||
|
||
it('checking identity of key is correct', () => { | ||
cy.get('.SSHFormKey-helperText-success').should('be.visible'); | ||
}); | ||
|
||
it('checking remember ssh key is not checked', () => { | ||
cy.get('[id=ssh-service-checkbox]') | ||
.first() | ||
.should('not.be.checked'); | ||
}); | ||
|
||
it('should check remember ssh key', () => { | ||
cy.get('[id=ssh-service-checkbox]') | ||
.first() | ||
.check(); | ||
}); | ||
|
||
it('checking if ssh helper modal exist', () => { | ||
cy.get('.SSHPopover-button').click(); | ||
cy.byTestID('SSHPopover').should('be.visible'); | ||
}); | ||
|
||
it('checking if expose ssh service is checked by default', () => { | ||
cy.get('[id=ssh-service-checkbox]') | ||
.eq(1) | ||
.should('be.checked'); | ||
}); | ||
|
||
it('checking if ssh keys message is not visible', () => { | ||
cy.byTestID('SSHCreateService-info-message').should('not.exist'); | ||
}); | ||
|
||
it('should create a vm', () => { | ||
cy.byLegacyTestID('wizard-next').click(); | ||
cy.byLegacyTestID('kubevirt-wizard-success-result').should('be.visible'); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
frontend/packages/kubevirt-plugin/integration-tests-cypress/tests/ssh/ssh.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,29 @@ | ||
import { testName } from '../../support'; | ||
import sshAdvancedWizardTesting from './ssh-advanced-wizard-testing.includes'; | ||
// import sshSecretTesting from './ssh-secret-testing.includes'; | ||
// import sshServiceTesting from './ssh-service-testing.includes'; | ||
import sshSimpleWizardTest from './ssh-simple-wizard-test.includes'; | ||
|
||
// import sshVMDetailsPageTesting from './ssh-vm-details-page-testing.includes'; | ||
|
||
describe('Connect to a VM using SSH testing', () => { | ||
const sshTestingFunctions = [ | ||
sshAdvancedWizardTesting, | ||
sshSimpleWizardTest, | ||
// sshSecretTesting, | ||
// sshServiceTesting, | ||
// sshVMDetailsPageTesting, | ||
]; | ||
before(() => { | ||
cy.login(); | ||
cy.visit(''); | ||
cy.createProject(testName); | ||
}); | ||
|
||
sshTestingFunctions.forEach((fn) => fn({ vmName: `${testName}-vm` })); | ||
|
||
after(() => { | ||
cy.deleteProject(testName); | ||
cy.visit(''); | ||
}); | ||
}); |
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