-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
190 additions
and
2 deletions.
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
96 changes: 96 additions & 0 deletions
96
frontend/packages/kubevirt-plugin/integration-tests/tests/vmi.actions.scenario.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,96 @@ | ||
import { browser, ExpectedConditions as until } from 'protractor'; | ||
import { testName } from '@console/internal-integration-tests/protractor.conf'; | ||
import { | ||
resourceRows, | ||
resourceRowsPresent, | ||
isLoaded, | ||
textFilter, | ||
} from '@console/internal-integration-tests/views/crud.view'; | ||
import { | ||
addLeakableResource, | ||
createResource, | ||
removeLeakedResources, | ||
removeLeakableResource, | ||
waitForCount, | ||
} from '@console/shared/src/test-utils/utils'; | ||
import { getVMIManifest } from './utils/mocks'; | ||
import { fillInput } from './utils/utils'; | ||
import { | ||
PAGE_LOAD_TIMEOUT_SECS, | ||
VMI_ACTION, | ||
TAB, | ||
VM_IMPORT_TIMEOUT_SECS, | ||
VM_STATUS, | ||
} from './utils/consts'; | ||
import { VirtualMachine } from './models/virtualMachine'; | ||
|
||
const waitForVM = async ( | ||
manifest: any, | ||
status: VM_STATUS, | ||
resourcesSet: Set<string>, | ||
kind?: 'virtualmachines' | 'virtualmachineinstances', | ||
) => { | ||
const vm = new VirtualMachine(manifest.metadata, kind || 'virtualmachines'); | ||
|
||
createResource(manifest); | ||
addLeakableResource(resourcesSet, manifest); | ||
await vm.waitForStatus(status); | ||
|
||
return vm; | ||
}; | ||
|
||
const waitForVMDelete = async (vm: VirtualMachine) => { | ||
await vm.navigateToListView(); | ||
await isLoaded(); | ||
|
||
await fillInput(textFilter, vm.name); | ||
await resourceRowsPresent(); | ||
|
||
await browser.wait(until.and(waitForCount(resourceRows, 0)), PAGE_LOAD_TIMEOUT_SECS); | ||
}; | ||
|
||
describe('Test VMI actions', () => { | ||
const leakedResources = new Set<string>(); | ||
|
||
afterAll(async () => { | ||
removeLeakedResources(leakedResources); | ||
}); | ||
|
||
describe('Test VMI list view kebab dropdown', () => { | ||
let vm: VirtualMachine; | ||
let testVM: any; | ||
|
||
beforeAll(async () => { | ||
testVM = getVMIManifest('Container', testName, `vm-list-actions-${testName}`); | ||
vm = await waitForVM(testVM, VM_STATUS.Running, leakedResources, 'virtualmachineinstances'); | ||
}, VM_IMPORT_TIMEOUT_SECS); | ||
|
||
it('Deletes VMI', async () => { | ||
await vm.navigateToListView(); | ||
await isLoaded(); | ||
|
||
await vm.listViewAction(VMI_ACTION.Delete, false); | ||
removeLeakableResource(leakedResources, testVM); | ||
await waitForVMDelete(vm); | ||
}); | ||
}); | ||
|
||
describe('Test VMI detail view actions dropdown', () => { | ||
let vm: VirtualMachine; | ||
let testVM: any; | ||
|
||
beforeAll(async () => { | ||
testVM = getVMIManifest('Container', testName, `vm-detail-actions-${testName}`); | ||
vm = await waitForVM(testVM, VM_STATUS.Running, leakedResources, 'virtualmachineinstances'); | ||
}, VM_IMPORT_TIMEOUT_SECS); | ||
|
||
it('Deletes VM', async () => { | ||
await vm.navigateToTab(TAB.Details); | ||
await isLoaded(); | ||
|
||
await vm.action(VMI_ACTION.Delete, false); | ||
removeLeakableResource(leakedResources, testVM); | ||
await waitForVMDelete(vm); | ||
}); | ||
}); | ||
}); |
74 changes: 74 additions & 0 deletions
74
frontend/packages/kubevirt-plugin/integration-tests/tests/vmi.dashboard.scenario.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,74 @@ | ||
import { testName } from '@console/internal-integration-tests/protractor.conf'; | ||
import { | ||
addLeakableResource, | ||
removeLeakedResources, | ||
createResource, | ||
} from '@console/shared/src/test-utils/utils'; | ||
import { VirtualMachineInstanceModel } from '../../src/models'; | ||
import { | ||
vmDetailsName, | ||
vmDetailsNamespace, | ||
vmDetailsNode, | ||
vmDetailsIPAddress, | ||
vmStatus, | ||
vmInventoryNICs, | ||
vmInventoryDisks, | ||
} from '../views/dashboard.view'; | ||
import { getVMIManifest } from './utils/mocks'; | ||
import { VirtualMachine } from './models/virtualMachine'; | ||
import { VM_STATUS, NOT_AVAILABLE } from './utils/consts'; | ||
|
||
const waitForVM = async ( | ||
manifest: any, | ||
status: VM_STATUS, | ||
resourcesSet: Set<string>, | ||
kind?: 'virtualmachines' | 'virtualmachineinstances', | ||
) => { | ||
const vm = new VirtualMachine(manifest.metadata, kind || 'virtualmachines'); | ||
|
||
createResource(manifest); | ||
addLeakableResource(resourcesSet, manifest); | ||
await vm.waitForStatus(status); | ||
|
||
return vm; | ||
}; | ||
|
||
describe('Test VMI dashboard', () => { | ||
const leakedResources = new Set<string>(); | ||
const testVM = getVMIManifest('Container', testName); | ||
|
||
let vm: VirtualMachine; | ||
|
||
afterAll(async () => { | ||
removeLeakedResources(leakedResources); | ||
}); | ||
|
||
beforeAll(async () => { | ||
vm = await waitForVM(testVM, VM_STATUS.Running, leakedResources, 'virtualmachineinstances'); | ||
await vm.navigateToDashboard(); | ||
}); | ||
|
||
it('Inventory card', async () => { | ||
expect(vmInventoryNICs.getText()).toEqual('1 NIC'); | ||
expect(vmInventoryNICs.$('a').getAttribute('href')).toMatch( | ||
new RegExp(`.*/k8s/ns/${vm.namespace}/${VirtualMachineInstanceModel.plural}/${vm.name}/nics`), | ||
); | ||
expect(vmInventoryDisks.getText()).toEqual('1 Disk'); | ||
expect(vmInventoryDisks.$('a').getAttribute('href')).toMatch( | ||
new RegExp( | ||
`.*/k8s/ns/${vm.namespace}/${VirtualMachineInstanceModel.plural}/${vm.name}/disks`, | ||
), | ||
); | ||
}); | ||
|
||
it('Status card', async () => { | ||
expect(vmStatus.getText()).toEqual(VM_STATUS.Running); | ||
}); | ||
|
||
it('Details card', async () => { | ||
expect(vmDetailsName.getText()).toEqual(vm.name); | ||
expect(vmDetailsNamespace.getText()).toEqual(vm.namespace); | ||
expect(vmDetailsNode.getText()).not.toEqual(NOT_AVAILABLE); | ||
expect(vmDetailsIPAddress.getText()).not.toEqual(NOT_AVAILABLE); | ||
}); | ||
}); |