-
Notifications
You must be signed in to change notification settings - Fork 11
Added tests for vm list/detail vm view actions (start, stop, restart, delete) #163
Conversation
208ce97
to
97fc678
Compare
97fc678
to
544367d
Compare
/** | ||
* Performs action for VM via list view kebab menu. | ||
*/ | ||
export const listViewAction = (name: string) => (action: string) => rowForName(name).$$('.co-kebab__button').first().click() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be possible to extract common functionality from listViewAction and detailViewAction? And also, extracting the kebap into a variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Couldn't find a way to extract the kebab element, for some reason when I had
export const $('.co-kebab__dropdown');
before the action function, the element was undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coulnd't we just pass a function, something like getActionsDropdown()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, we can't. Such function would have to be implemented by ElementFinder, which is what rowForName(name) returns.
But maybe just defining the string could be OK?
Like:
const listKebabDropdown = '.co-kebab__dropdown';
rowForName(name).$(listKebabDropdown)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this work or am I missing something?
listViewAction = (name) => {
getActionsDropdown = () => rowForName(name).$$('.co-kebab__button').first();
getActionsDropdownMenu = () => rowForName(name).$(listViewKebabDropdown);
return selectDropdownItem(getActionsDropdown, getActionsDropdownMenu);
}
selectDropdownItem = (getActionsDropdown, getActionsDropdownMenu) => (action) =>
.
. common functionality (calls getActionsDropdown and getActionsDropdownMenu)
.
and detailViewAction
implemented with the same mechanism
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, I'm volunteering on QE Camp. Yes, this approach will work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
frontend/integration-tests/tests/kubevirt/vm.actions.scenario.ts
Outdated
Show resolved
Hide resolved
frontend/integration-tests/tests/kubevirt/vm.actions.scenario.ts
Outdated
Show resolved
Hide resolved
I'd suggest to have simple tests along with reusable utilities. As for
As for utilities:
Following the existing convention, every created k8s object (regardless if created via UI workflow or via |
544367d
to
3d0ebaa
Compare
abdaaf9
to
ff15532
Compare
I have refactored the VM provision tests, now there are 3 specs for each provision source. Comments regarding vm actions are fixed as well and ready for review. |
5466b69
to
8d7b026
Compare
Added WIP label again because there seems to be a issue with clicking the dropdown button. It's like the dropdown closes right after it is opened. |
8d7b026
to
9c440a2
Compare
Thanks a lot @rhrazdil, I'm going to backport those changes into openshift#888. |
https://cnv-qe-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/test-ocp-3.11-cnv-1.4-integration-web-ui-rhrazdil/30/console
question:
I'm not quite satisfied with defining the VM object in scenario.ts file, especially when is this long. @vojtechszocs What do you think about it? Maybe we could create some resource file wher CRDs could be placed.