mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1198542: Update Marionette element IDs to be valid UUID. r=ato
This allows WebDriver compatibility to create valid URI. --HG-- extra : commitid : 7JjQgqwKr8P extra : rebase_source : 30e59c18b69ab404608c6b44f1dc11742b95ac78
This commit is contained in:
parent
1e59442474
commit
6b428e8150
@ -159,3 +159,13 @@ class TestElements(MarionetteTestCase):
|
||||
test_html = self.marionette.absolute_url("test.html")
|
||||
self.marionette.navigate(test_html)
|
||||
self.assertRaises(InvalidSelectorException, self.marionette.find_element, "Brie Search Type", "doesn't matter")
|
||||
|
||||
def test_element_id_is_valid_uuid(self):
|
||||
import re
|
||||
test_html = self.marionette.absolute_url("test.html")
|
||||
self.marionette.navigate(test_html)
|
||||
el = self.marionette.find_element(By.TAG_NAME, "body")
|
||||
uuid_regex = re.compile('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$')
|
||||
self.assertIsNotNone(re.search(uuid_regex, el.id),
|
||||
'UUID for the WebElement is not valid. ID is {}'\
|
||||
.format(el.id))
|
||||
|
@ -233,7 +233,8 @@ ElementManager.prototype = {
|
||||
delete this.seenItems[i];
|
||||
}
|
||||
}
|
||||
let id = uuidGen.generateUUID().toString();
|
||||
let uuid = uuidGen.generateUUID().toString();
|
||||
let id = uuid.substring(1, uuid.length - 1);
|
||||
this.seenItems[id] = Components.utils.getWeakReference(element);
|
||||
return id;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user