Bug 1273962

Summary: New tooltips of in ovirt UI are not automation-friendly
Product: [oVirt] ovirt-engine Reporter: movciari
Component: Frontend.WebAdminAssignee: Greg Sheremeta <gshereme>
Status: CLOSED CANTFIX QA Contact: Pavel Stehlik <pstehlik>
Severity: low Docs Contact:
Priority: low    
Version: 3.6.0CC: bugs, ecohen, vszocs
Target Milestone: ovirt-4.0.0-alphaFlags: ecohen: ovirt-4.0.0?
rule-engine: planning_ack?
rule-engine: devel_ack?
rule-engine: testing_ack?
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: ux
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-13 22:05:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: UX RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description movciari 2015-10-21 15:17:52 UTC
Description of problem:
Tooltips in ovirt 3.5 are easy to test automatically - we can just check if the element has the correct text in title attribute, but in 3.6 the tooltip is a completely separate element, which is not even close in DOM to the element it belongs to, so testing it would be cumbersome.

Elements with tooltips should at least have some data attribute which would contain text shown in tooltip.

Version-Release number of selected component (if applicable):
3.6.0-0.18.el6

How reproducible:
always

Additional info:
Low severity because tests for tooltips are less important than tests for other functionality, but it would still be nice to have tests for them, especially because new tooltips are not implemented using standard html title attribute

Comment 1 Vojtech Szocs 2015-10-23 16:03:11 UTC
Short-term workaround: utilize "aria-describedby" attribute that links to DOM element of the tooltip.

For example, VM main tab / Run Once button:

<div id="MainTabVirtualMachineView_table_Run" role="button">

After simulating mouse hover, it becomes:

<div id="MainTabVirtualMachineView_table_Run"
     role="button" aria-describedby="tooltipXXXXXX">

Test script would therefore need to:
- trigger mouse hover on given DOM element
- parse value of "aria-describedby" attribute
- locate associated tooltip DOM element by ID
- extract text from tooltip DOM element

Above mentioned workaround is too complicated, I think.

I believe we can modify tooltip'ed DOM element to include tooltip text via simple DOM attribute.

For example, upon mouse hover, Run Once button would become:

<div id="MainTabVirtualMachineView_table_Run"
     role="button" aria-describedby="tooltipXXXXXX"
     data-tooltip-text="Run">

In other words, (currently unused) "title" attribute would become "data-tooltip-text" attribute.

Comment 2 Greg Sheremeta 2015-11-13 22:05:11 UTC
Sorry for the trouble here.

Relying on the text in a tooltip is dangerous for automation because the tooltips don't convey a meaning. That is, they can be used for just about anything by developers.

A better way to test is to add data-xyz attributes as Vojtech suggests above. That way, if you want to check the status of a vm, simply read 'data-status.'

For specific places where you can no longer easily grab data because of the tooltip changes, please open a bug for each one and I'll get them fixed.

For Bug 1273970, I have added 'data-status' for vm status. 

Thanks!