-
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.
Merge pull request #5188 from glekner/test-affinity
Bug 1834734: add integration test for affinity modal
- Loading branch information
Showing
4 changed files
with
81 additions
and
0 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
57 changes: 57 additions & 0 deletions
57
frontend/packages/kubevirt-plugin/integration-tests/tests/vm.detail.affinity.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,57 @@ | ||
import { browser, ExpectedConditions as until } from 'protractor'; | ||
import { testName } from '@console/internal-integration-tests/protractor.conf'; | ||
import { createResource, deleteResource, click } from '@console/shared/src/test-utils/utils'; | ||
import * as editAffinityView from '../views/editAffinityView'; | ||
import * as virtualMachineView from '../views/virtualMachine.view'; | ||
import { VM_CREATE_AND_EDIT_TIMEOUT_SECS } from './utils/consts'; | ||
import { VirtualMachine } from './models/virtualMachine'; | ||
import { getVMManifest } from './utils/mocks'; | ||
import { getRandStr } from './utils/utils'; | ||
|
||
describe('KubeVirt VM detail - edit Affinity', () => { | ||
const testVM = getVMManifest('Container', testName, `affinity-vm-${getRandStr(5)}`); | ||
const vm = new VirtualMachine(testVM.metadata); | ||
|
||
beforeAll(async () => { | ||
createResource(testVM); | ||
}); | ||
|
||
afterAll(() => { | ||
deleteResource(testVM); | ||
}); | ||
|
||
it( | ||
'ID(CNV-4159) Adds an Affinity, then removes it', | ||
async () => { | ||
await vm.navigateToDetail(); | ||
await vm.modalEditAffinity(); | ||
await click(editAffinityView.addAffinityBtn); | ||
await editAffinityView.affinityKeyInputByID(0).sendKeys('key'); | ||
await click(editAffinityView.valuesSelectElement); | ||
await editAffinityView.valuesSelectElement.sendKeys('affinity-value'); | ||
await click(editAffinityView.createValueBtn); | ||
await click(editAffinityView.editSubmitBtn); | ||
await click(editAffinityView.submitBtn); | ||
|
||
await browser.wait( | ||
until.textToBePresentInElement( | ||
virtualMachineView.vmDetailAffinity(vm.namespace, vm.name), | ||
'1 Affinity rules', | ||
), | ||
); | ||
|
||
await vm.modalEditAffinity(); | ||
await click(editAffinityView.kebab); | ||
await click(editAffinityView.kebabDelete); | ||
await click(editAffinityView.submitBtn); | ||
|
||
await browser.wait( | ||
until.textToBePresentInElement( | ||
virtualMachineView.vmDetailAffinity(vm.namespace, vm.name), | ||
'0 Affinity rules', | ||
), | ||
); | ||
}, | ||
VM_CREATE_AND_EDIT_TIMEOUT_SECS, | ||
); | ||
}); |
13 changes: 13 additions & 0 deletions
13
frontend/packages/kubevirt-plugin/integration-tests/views/editAffinityView.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,13 @@ | ||
import { $ } from 'protractor'; | ||
|
||
export const modalTitle = $('[data-test-id="modal-title"]'); | ||
export const addAffinityBtn = $('#add-affinity-btn'); | ||
export const submitBtn = $('#affinity-submit'); | ||
export const editSubmitBtn = $('#affinity-edit-submit'); | ||
export const valuesSelectElement = $('.pf-c-select__toggle-typeahead'); | ||
export const createValueBtn = $('#affinity-value-0'); | ||
export const kebab = $('[data-test-id="kebab-button"]'); | ||
export const kebabDelete = $('[data-test-action="Delete"]'); | ||
export const affinityKeyInputByID = (id) => $(`#affinity-${id}-key-input`); | ||
export const affinityValuesSelectByID = (id) => $(`#affinity-${id}-values-select`); | ||
export const deleteBtnByID = (id) => $(`#affinity-${id}-delete-btn`); |
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