Closed Bug 753490 Opened 8 years ago Closed 8 years ago

find_element regression

Categories

(Testing :: Marionette, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla17

People

(Reporter: mdas, Assigned: jgriffin)

References

(Depends on 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

our test_findelement.py tests are now failing with the latest mozilla-central with the following failures:

======================================================================
FAIL: test_class_name (test_findelement.TestElementsChrome)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit/test_findelement.py", line 203, in test_class_name
    self.assertEqual(el.id, found_el.id)
AssertionError: u'{2efc8dbe-eafe-0e45-85aa-0aebe033a776}' != u'{b2996932-8a06-b14d-88cf-528a12b9b47d}'
- {2efc8dbe-eafe-0e45-85aa-0aebe033a776}
+ {b2996932-8a06-b14d-88cf-528a12b9b47d}


======================================================================
FAIL: test_id (test_findelement.TestElementsChrome)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit/test_findelement.py", line 178, in test_id
    self.assertEqual(el.id, found_el.id)
AssertionError: u'{12e2e93b-4efa-f24e-a167-6a4eec260875}' != u'{72bcfcd0-a6dd-4047-84f6-bb98ccc78950}'
- {12e2e93b-4efa-f24e-a167-6a4eec260875}
+ {72bcfcd0-a6dd-4047-84f6-bb98ccc78950}


======================================================================
FAIL: test_tag_name (test_findelement.TestElementsChrome)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit/test_findelement.py", line 197, in test_tag_name
    self.assertEqual(el.id, found_el.id)
AssertionError: u'{7613c78b-c505-e343-a02b-1f79fb93e168}' != u'{57f6844e-7521-cf44-b6fc-042568538b6d}'
- {7613c78b-c505-e343-a02b-1f79fb93e168}
+ {57f6844e-7521-cf44-b6fc-042568538b6d}


======================================================================
FAIL: test_xpath (test_findelement.TestElementsChrome)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit/test_findelement.py", line 209, in test_xpath
    self.assertEqual(el.id, found_el.id)
AssertionError: u'{c8918654-f261-e942-89c5-3e9612bec6c9}' != u'{83044ded-869f-204c-9893-ca18c0e5ff0d}'
- {c8918654-f261-e942-89c5-3e9612bec6c9}
+ {83044ded-869f-204c-9893-ca18c0e5ff0d}


----------------------------------------------------------------------
Ran 20 tests in 13.496s
So, this is apparently a XUL bug, since it only affects chrome tests.  Two XUL elements, which have the same string representation (e.g., [object XULElement @ 0x7f2144dd4040 (native @ 0x7f2144c510d0)]), fail both == and === comparisons.

According to https://developer.mozilla.org/en/DOM/node.isSameNode, this is the correct method of determining this.  I'll file a bug.

A possible workaround is to convert the nodes to strings, e.g.,

node1.toString() == node2.toString()

which fixes this problem, and since the string representation includes what is presumably a memory address, this should be safe.
Depends on: 774869
Attached patch patch v0.1 (obsolete) — Splinter Review
We can get the tests passing using this patch, if it doesn't look like bug 774869 is getting any traction.
Attached patch patch v0.2Splinter Review
I haven't been able to create a mochitest to reproduce this problem for bug 774869.  The attached is a workaround which allows the tests to pass.
Attachment #643164 - Attachment is obsolete: true
Attachment #646426 - Flags: review?(mdas)
Attachment #646426 - Flags: review?(mdas) → review+
http://hg.mozilla.org/mozilla-central/rev/160c92e9a254
Assignee: mdas → jgriffin
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.