]
Ryan Emerson resolved ISPN-5941.
--------------------------------
Fix Version/s: 9.0.0.Beta3
Resolution: Done
Ensure testability of management console
----------------------------------------
Key: ISPN-5941
URL:
https://issues.jboss.org/browse/ISPN-5941
Project: Infinispan
Issue Type: Task
Components: Console
Reporter: Jiří Holuša
Assignee: Ryan Emerson
Fix For: 9.0.0.Beta3
Since we're planning to test ISPN management console using Selenium (Selenide more
specifically), we would appreciate taking more attention to giving ID's to page
elements that would be helpful for testing.
Just an example, how it could simplify our test development as a motivation. Currently
(ISPN 8.1.0.Alpha2), in the detail of cache container page with list of caches, the
shortest way (even with Java 8) how to get (for testing purposes) names of caches, is:
{code}
List<String> caches = $$("#cache-cards >
div").filterBy(attribute("ng-show", "cache.show"))
.stream().map(element ->
element.find("a").text()).collect(Collectors.toList());
{code}
The time to figure out this "query" was about 2 minutes (For the first time. I
know, very subjective, but as an example)
Now suppose we would add class="cacheName" to <a> element of the
corresponding cache card:
{code}
List<String> caches = $$("#cache-cards a.cacheName").stream().map(element
-> element.text()).collect(Collectors.toList());
{code}
Time to come up with such an "query" would be around 5 seconds :)
I tried to come up with some generic guidelines about where to put some id/class, feel
free to add some:
* to every input/select field
* especially with checkboxes which are differentiated with <label>
* generally to <span> or any (text?) element which can change it's value, which
is dependent on some state of the cache/server/...
Of course, you cannot be 100% successful with giving the id/class to every useful place,
but every single place, which you select correctly, simplifies and speeds up the test
development. Probably also a good idea to come up with some naming convention.