Skip to Main Content
Spotfire Ideas Portal
Status Future Consideration
Product Spotfire
Created by Guest
Created on May 25, 2021

Provide autotesting-friendly XPATH's for Spotfire web interface elements.

Background:

Any serious application requires testing, and Spotfire is no exception.
Each hotfix installation, reconfiguration or redeploy lead to the potential outages, that could be avoided
with a proactive usage of automated testing.

For testing Spotfire Webplayer with selenium, we need to imitate user activity, such as

  • Open analysis

  • Detect that analysis had (or had not) loaded successfully

  • Close analysis.

These steps are performed for each test analysis that represents some Spotfire feature or integrations,
to get a clear representation of possible broken parts of the Spotfire or it's dependencies.

(Different data source types, data functions, custom plugins, etc)

To imitate these actions, it is required to locate each element that will be clicked,
or that will indicate analysis state by searching it using element's XPATH.

For example, current 10.10 web interface shows it's state in a "globe" element in the right-bottom corner, that could be found with the following xpath:

"//div[@class='sfx_status-globe_221 sfx_online_333' and starts-with(@title,'User:') ]"

It has title "Processing" during data load, and we use it to determine if analysis is still loading, or loading is done.

Or, as another example, closing analysis is performed by clicking the following sequence of xpaths:

"//div[@class='contextMenuItemLabel' and @title='File']"
"//div[@class='sfx_button_356 sfx_button-enabled_355 sfx_hidable-item_346' and @title='Show menus']",

"//div[@class='contextMenuItemLabel' and @title='Close']",



Issue:


However, there are several issues with this approach, that require developers to step in and help us:

1) These xpaths tend to be changed by developers with each hotfix, and therefore we have to identify these xpaths from the scratch with almost any new update.
It consumes time, and affects speed of delivering new versions of Spotfire to our users.

2) These xpaths can stop working at all, due to the fact that developers are not aware that xpaths are used for testing.

For example, when we had implemented such testing in older version, that "globe" element had xpath with "@title=Ready", that quite clearly indicated that analysis had been loaded.
In 10.10 it had changed to xpath with "starts-with(@title,'User:"

In the latest version of 11.1 Spotfire, that globe element does not clearly show the state anymore,

it has XPATH "//div[@class='sfx_status-globe_226 sfx_online_482' ]" without any signs of current state.
and we are not able to find any other element that could be addressed by XPATH and will represent current state of the analysis.

At this point we cannot switch to 11.1 because of our autotesting being broken by this change.



Proposed solution:


1) Please, provide some unique and constant attributes to the critical elements of the interface, so we could locate these elements reliably.
At this point File, Menu, Close buttons are most critical for us.


2) Please, do not change them at least between major version upgrades.


3)And the most valuable right now: Please, provide an element that will reliably show current analysis state, could be located by XPATH, and parsed in a straightforward way.
From our point of view, it should have at least three states, represented in some attribute - (Loading, Ready, Error),
where Ready exactly means that all data had been loaded successfully, all data-functions that should work on start-up had completed successfully, etc, and nothing else is going on.


Thank you in advance.


  • Attach files
  • Guest
    Reply
    |
    Jun 2, 2023

    For the menus you could try with the following xpaths. Please do not rely on the class as they are designed to change with every hotfix/release


    1. sfx_Menu_File=xpath:.//div[@title=‘File’]

    2. sfx_Menu_ShowMenu=xpath:.//div[@title=‘Show menus’]

    3. sfx_Menu_Close=xpath:.//div[contains(@class,“contextMenu”)]//div[contains(@class,“contextMenuItem”)]//div[@title=‘Close’]

    Do not use class with numbers - //div[@class='sfx_button_356 sfx_button-enabled_355 sfx_hidable-item_346' and @title='Show menus']",

    Instead you could use contains(@class) as shown in 3 above



    State of the analysis if you want to check if analysis is loaded or not or the spinner exists, something that was earlier done with Globe ready - Probably you could execute javascript through Selenium like this

    ((JavascriptExecutor) getDriver()).executeScript(“return Spotfire.Busy.idle();“).equals(true);


    Note that Spotfire does a lot of asynchronous calls and this could be reliable to a large extent if not always