[Django] #30975: Replace get_select_option with native select_by_value

10 views
Skip to first unread message

Django

unread,
Nov 10, 2019, 5:59:59 AM11/10/19
to django-...@googlegroups.com
#30975: Replace get_select_option with native select_by_value
------------------------------------------------+--------------------------
Reporter: Johannes Hoppe | Owner: nobody
Type: Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+--------------------------
We have our own method called
`django.contrib.admin.tests.AdminSeleniumTestCase.get_select_option` which
does the very same thing as
`selenium.webdriver.support.select.Select.select_by_value`.

We could replace it with something like:
{{{
def select_option(self, select_tag_css_selector, value):
from selenium.webdriver.support.ui import Select

select =
Select(self.selenium.find_element_by_css_selector(select_tag_css_selector))
select.select_by_value(value)
}}}

This would avoid looping over the DOM-tree as it's done in the current
implementation.
Furthermore, it can avoid errors when a select-tag is outside the current
viewport.

--
Ticket URL: <https://code.djangoproject.com/ticket/30975>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 10, 2019, 6:13:06 AM11/10/19
to django-...@googlegroups.com
#30975: Replace get_select_option with native select_by_value
-------------------------------------+-------------------------------------

Reporter: Johannes Hoppe | Owner: nobody
Type: | Status: assigned
Cleanup/optimization |

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/30975#comment:1>

Django

unread,
Nov 11, 2019, 4:32:00 AM11/11/19
to django-...@googlegroups.com
#30975: Replace get_select_option with native select_by_value
-------------------------------------+-------------------------------------

Reporter: Johannes Hoppe | Owner: nobody
Type: | Status: assigned
Cleanup/optimization |

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/30975#comment:2>

Django

unread,
Nov 15, 2019, 8:29:27 AM11/15/19
to django-...@googlegroups.com
#30975: Replace get_select_option with native select_by_value
--------------------------------------+------------------------------------

Reporter: Johannes Hoppe | Owner: nobody
Type: Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Carlton Gibson):

* stage: Unreviewed => Accepted


Comment:

OK. Sounds good. — Thanks again! (Will review all three tickets next
week.)

--
Ticket URL: <https://code.djangoproject.com/ticket/30975#comment:3>

Django

unread,
Nov 15, 2019, 8:32:02 AM11/15/19
to django-...@googlegroups.com
#30975: Replace get_select_option with Selenium's native select_by_value
--------------------------------------+------------------------------------

Reporter: Johannes Hoppe | Owner: nobody
Type: Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: Selenium | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Carlton Gibson):

* keywords: => Selenium


--
Ticket URL: <https://code.djangoproject.com/ticket/30975#comment:4>

Django

unread,
Nov 21, 2019, 1:35:04 AM11/21/19
to django-...@googlegroups.com
#30975: Replace get_select_option with Selenium's native select_by_value
--------------------------------------+------------------------------------
Reporter: Johannes Hoppe | Owner: nobody
Type: Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: Selenium | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Johannes Hoppe):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/30975#comment:5>

Django

unread,
Nov 27, 2019, 10:04:59 AM11/27/19
to django-...@googlegroups.com
#30975: Replace get_select_option with Selenium's native select_by_value
-------------------------------------+-------------------------------------

Reporter: Johannes Hoppe | Owner: nobody
Type: | Status: assigned
Cleanup/optimization |

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: Selenium | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/30975#comment:6>

Django

unread,
Nov 27, 2019, 10:35:00 AM11/27/19
to django-...@googlegroups.com
#30975: Replace get_select_option with Selenium's native select_by_value
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: nobody
Type: | Status: closed
Cleanup/optimization |

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed

Keywords: Selenium | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson <carlton.gibson@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"249a6190aef5e3676c6d9aa6c38cecff895b5993" 249a6190]:
{{{
#!CommitTicketReference repository=""
revision="249a6190aef5e3676c6d9aa6c38cecff895b5993"
Fixed #30975 -- Replaced custom get_select_option with Selenium's
select_by_value.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30975#comment:7>

Reply all
Reply to author
Forward
0 new messages