Title: [255622] trunk/Tools
Revision
255622
Author
[email protected]
Date
2020-02-03 17:32:06 -0800 (Mon, 03 Feb 2020)

Log Message

Make Bugzilla._find_select_element_for_flag more robust
https://bugs.webkit.org/show_bug.cgi?id=207148

Reviewed by Jonathan Bedard.

This patch resolves two FIXMEs:
1. _find_select_element_for_flag() is now used in _fill_attachment_form() method.
2. _find_select_element_for_flag() now does not rely on order of <select> elements.

* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(Bugzilla._fill_attachment_form):
(Bugzilla._find_select_element_for_flag):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (255621 => 255622)


--- trunk/Tools/ChangeLog	2020-02-04 01:03:06 UTC (rev 255621)
+++ trunk/Tools/ChangeLog	2020-02-04 01:32:06 UTC (rev 255622)
@@ -1,3 +1,18 @@
+2020-02-03  Alexey Shvayka  <[email protected]>
+
+        Make Bugzilla._find_select_element_for_flag more robust
+        https://bugs.webkit.org/show_bug.cgi?id=207148
+
+        Reviewed by Jonathan Bedard.
+
+        This patch resolves two FIXMEs:
+        1. _find_select_element_for_flag() is now used in _fill_attachment_form() method.
+        2. _find_select_element_for_flag() now does not rely on order of <select> elements.
+
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (Bugzilla._fill_attachment_form):
+        (Bugzilla._find_select_element_for_flag):
+
 2020-02-03  Alex Christensen  <[email protected]>
 
         Reduce size of HashMap and HashSet

Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py (255621 => 255622)


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2020-02-04 01:03:06 UTC (rev 255621)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2020-02-04 01:32:06 UTC (rev 255622)
@@ -626,9 +626,8 @@
         self.browser['description'] = description
         if is_patch:
             self.browser['ispatch'] = ("1",)
-        # FIXME: Should this use self._find_select_element_for_flag?
-        self.browser['flag_type-1'] = ('?',) if mark_for_review else ('X',)
-        self.browser['flag_type-3'] = (self._commit_queue_flag(commit_flag),)
+        self._find_select_element_for_flag("review").value = ("?",) if mark_for_review else ("X",)
+        self._find_select_element_for_flag("commit-queue").value = (self._commit_queue_flag(commit_flag),)
 
         filename = filename or "%s.patch" % timestamp()
         if not mimetype:
@@ -784,13 +783,17 @@
         return bug_id
 
     def _find_select_element_for_flag(self, flag_name):
-        # FIXME: This will break if we ever re-order attachment flags
         if flag_name == "review":
-            return self.browser.find_control(type='select', nr=0)
+            class_name = "flag_type-1"
         elif flag_name == "commit-queue":
-            return self.browser.find_control(type='select', nr=1)
-        raise Exception("Don't know how to find flag named \"%s\"" % flag_name)
+            class_name = "flag_type-3"
+        else:
+            raise Exception("Don't know how to find flag named \"%s\"" % flag_name)
 
+        return self.browser.find_control(
+            type="select",
+            predicate=lambda control: class_name in (control.attrs.get("class") or ""))
+
     def clear_attachment_flags(self,
                                attachment_id,
                                additional_comment_text=None):
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to