Use IDs in Selenium Tests When Possible

Bug #1353628 reported by Michael Jackson
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Wishlist
Martin Pavlásek

Bug Description

IDs are typically the most stable and fastest locators when using Selenium. The current Selenium integration tests are using CSS locators, even when unique IDs are available. We should consider using IDs as the standard, and switching the current CSS locators to IDs where possible. We may also consider adding IDs to the templates where it makes sense to help facilitate this in the testing.

Changed in horizon:
assignee: nobody → Michael Jackson (rebelagentm)
Julie Pichon (jpichon)
tags: added: integration-tests
removed: integration-test
Revision history for this message
Gary W. Smith (gary-w-smith) wrote :

Sounds like a reasonable change. Since id's must be unique, it may require some care in order to ensure that re-usable components generate unique ids.

Changed in horizon:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/117619

Changed in horizon:
status: Confirmed → In Progress
Revision history for this message
Tomáš Nováčik (tnovacik) wrote :

@gary: IDs must be unique and they cannot be used on reusable components as this would ruin the whole idea of IDs.

Revision history for this message
Wu Hong Guang (whg) wrote :

The locator builder order by selenium IDE is :
id
link
name
css
xpath

It's ideal to use id to locate element when id is available

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by David Lyle (<email address hidden>) on branch: master
Review: https://review.openstack.org/117619
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/155352

Changed in horizon:
assignee: Michael Jackson (rebelagentm) → Martin Pavlásek (mpavlase)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/155352
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=02c6dab840afa20b0c6c3e3a8c35b86ef754314a
Submitter: Jenkins
Branch: master

commit 02c6dab840afa20b0c6c3e3a8c35b86ef754314a
Author: Martin Pavlasek <email address hidden>
Date: Thu Feb 12 16:08:22 2015 +0100

    Use IDs in locators instead of CSS when it is possible

    There were a lot of places that uses CSS_SELECTOR table#someid
    instead of just ID someid.

    Closes-Bug: 1353628
    Partially implements blueprint: selenium-integration-testing
    Change-Id: Ic6ac9b425976e60c067fc24e9819374c1a6080c2

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → kilo-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: kilo-3 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.