Skip to content

Commit

Permalink
Bump selenium 3.14.0->4.3.0, geckodriver 0.26.0->0.31.0 (#155)
Browse files Browse the repository at this point in the history
* Bump selenium from 3.14.0 to 4.3.0

Bumps [selenium](https://github.com/SeleniumHQ/Selenium) from 3.14.0 to 4.3.0.
- [Release notes](https://github.com/SeleniumHQ/Selenium/releases)
- [Commits](SeleniumHQ/selenium@selenium-3.14.0...selenium-4.3.0)

---
updated-dependencies:
- dependency-name: selenium
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump geckodriver version

* Update removed selenium methods

* Oops, linting

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Madison Swain-Bowden <[email protected]>
  • Loading branch information
dependabot[bot] and AetherUnbound authored Jul 8, 2022
1 parent 42d6acd commit 2af3263
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 38 deletions.
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

# Install Geckodriver components
ENV GECKODRIVER_VERSION="v0.26.0"
ENV GECKODRIVER_SHA=d59ca434d8e41ec1e30dd7707b0c95171dd6d16056fb6db9c978449ad8b93cc0
ENV GECKODRIVER_VERSION="v0.31.0"
ENV GECKODRIVER_BINARY="geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz"
ENV GECKODRIVER_SHA=7fdd8007d22a6f44caa6929a3d74bbd6a00984d88be50255153671bd201e5493
ENV GECKODRIVER_BASE_URL="https://github.com/mozilla/geckodriver/releases/download"
RUN wget ${GECKODRIVER_BASE_URL}/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz && \
echo "${GECKODRIVER_SHA} geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz" | sha256sum --check - && \
tar -xzf geckodriver-v0.26.0-linux64.tar.gz -C /usr/bin
RUN wget ${GECKODRIVER_BASE_URL}/${GECKODRIVER_VERSION}/${GECKODRIVER_BINARY} && \
echo "${GECKODRIVER_SHA} ${GECKODRIVER_BINARY}" | sha256sum --check - && \
tar -xzf ${GECKODRIVER_BINARY} -C /usr/bin

# Install additional development requirements
COPY requirements-dev.txt /usr/src/app/
Expand Down
64 changes: 32 additions & 32 deletions OpenOversight/tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@

@contextmanager
def wait_for_page_load(browser, timeout=10):
old_page = browser.find_element_by_tag_name("html")
old_page = browser.find_element("tag name", "html")
yield
WebDriverWait(browser, timeout).until(expected_conditions.staleness_of(old_page))


def login_admin(browser):
browser.get("http://localhost:5000/auth/login")
with wait_for_page_load(browser):
elem = browser.find_element_by_id("email")
elem = browser.find_element("id", "email")
elem.clear()
elem.send_keys("[email protected]")
elem = browser.find_element_by_id("password")
elem = browser.find_element("id", "password")
elem.clear()
elem.send_keys("testtest")
with wait_for_page_load(browser):
browser.find_element_by_id("submit").click()
browser.find_element("id", "submit").click()
wait_for_element(browser, By.TAG_NAME, "body")


Expand All @@ -55,9 +55,9 @@ def test_user_can_load_homepage_and_get_to_form(mockdata, browser):
# Complainant loads homepage
assert "OpenOversight" in browser.title
with wait_for_page_load(browser):
browser.find_element_by_id("cpd").click()
browser.find_element("id", "cpd").click()

page_text = browser.find_element_by_tag_name("body").text
page_text = browser.find_element("tag name", "body").text
assert "Find an Officer" in page_text


Expand All @@ -66,23 +66,23 @@ def test_user_can_use_form_to_get_to_browse(mockdata, browser):
browser.get("http://localhost:5000/find")

# Complainant selects department and proceeds to next step
browser.find_element_by_id("activate-step-2").click()
browser.find_element("id", "activate-step-2").click()

# Complainant puts in what they remember about name/badge number and
# proceeds to next step
browser.find_element_by_id("activate-step-3").click()
browser.find_element("id", "activate-step-3").click()

# Complainant selects the officer rank and proceeds to next step
browser.find_element_by_id("activate-step-4").click()
browser.find_element("id", "activate-step-4").click()

# Complainant fills out demographic information on officer
# Complainant clicks generate list and gets list of officers
with wait_for_page_load(browser):
browser.find_element_by_name("submit-officer-search-form").click()
browser.find_element("name", "submit-officer-search-form").click()

page_text = browser.find_element_by_tag_name("body").text
page_text = browser.find_element("tag name", "body").text
assert "Filter officers" in page_text
assert browser.find_element_by_id("officer-profile-1")
assert browser.find_element("id", "officer-profile-1")


@pytest.mark.acceptance
Expand All @@ -95,7 +95,7 @@ def test_user_can_get_to_complaint(mockdata, browser):
# Complainant arrives at page with the badge number, name, and link
# to complaint form

title_text = browser.find_element_by_tag_name("h1").text
title_text = browser.find_element("tag name", "h1").text
assert "File a Complaint" in title_text


Expand All @@ -108,7 +108,7 @@ def test_officer_browse_pagination(mockdata, browser):
# first page of results
browser.get("http://localhost:5000/department/{}?page=1".format(dept_id))
wait_for_element(browser, By.TAG_NAME, "body")
page_text = browser.find_element_by_tag_name("body").text
page_text = browser.find_element("tag name", "body").text
expected = "Showing 1-{} of {}".format(perpage, total)
assert expected in page_text

Expand All @@ -118,7 +118,7 @@ def test_officer_browse_pagination(mockdata, browser):
"http://localhost:5000/department/{}?page={}".format(dept_id, last_page_index)
)
wait_for_element(browser, By.TAG_NAME, "body")
page_text = browser.find_element_by_tag_name("body").text
page_text = browser.find_element("tag name", "body").text
expected = "Showing {}-{} of {}".format(
perpage * (total // perpage) + 1, total, total
)
Expand All @@ -134,11 +134,11 @@ def test_find_officer_can_see_uii_question_for_depts_with_uiis(mockdata, browser
).first()
dept_id = str(dept_with_uii.id)

dept_selector = Select(browser.find_element_by_id("dept"))
dept_selector = Select(browser.find_element("id", "dept"))
dept_selector.select_by_value(dept_id)
browser.find_element_by_id("activate-step-2").click()
browser.find_element("id", "activate-step-2").click()

page_text = browser.find_element_by_tag_name("body").text
page_text = browser.find_element("tag name", "body").text
assert "Do you know any part of the Officer's" in page_text


Expand All @@ -151,11 +151,11 @@ def test_find_officer_cannot_see_uii_question_for_depts_without_uiis(mockdata, b
).one_or_none()
dept_id = str(dept_without_uii.id)

dept_selector = Select(browser.find_element_by_id("dept"))
dept_selector = Select(browser.find_element("id", "dept"))
dept_selector.select_by_value(dept_id)
browser.find_element_by_id("activate-step-2").click()
browser.find_element("id", "activate-step-2").click()

results = browser.find_elements_by_id("#uii-question")
results = browser.find_elements("id", "#uii-question")
assert len(results) == 0


Expand All @@ -171,7 +171,7 @@ def test_incident_detail_display_read_more_button_for_descriptions_over_cutoff(
).one_or_none()
incident_id = str(incident_long_descrip.id)

result = browser.find_element_by_id("description-overflow-row_" + incident_id)
result = browser.find_element("id", "description-overflow-row_" + incident_id)
assert result.is_displayed()


Expand All @@ -183,7 +183,7 @@ def test_incident_detail_do_not_display_read_more_button_for_descriptions_under_
browser.get("http://localhost:5000/officer/1")

# Select incident for officer that has description under cuttoff chars
result = browser.find_element_by_id("description-overflow-row_1")
result = browser.find_element("id", "description-overflow-row_1")
assert not result.is_displayed()


Expand All @@ -198,11 +198,11 @@ def test_click_to_read_more_displays_full_description(mockdata, browser):
orig_descrip = incident_long_descrip.description.strip()
incident_id = str(incident_long_descrip.id)

button = browser.find_element_by_id("description-overflow-button_" + incident_id)
button = browser.find_element("id", "description-overflow-button_" + incident_id)
button.click()

description_text = browser.find_element_by_id(
"incident-description_" + incident_id
description_text = browser.find_element(
"id", "incident-description_" + incident_id
).text.strip()
assert len(description_text) == len(orig_descrip)
assert description_text == orig_descrip
Expand All @@ -218,10 +218,10 @@ def test_click_to_read_more_hides_the_read_more_button(mockdata, browser):
).one_or_none()
incident_id = str(incident_long_descrip.id)

button = browser.find_element_by_id("description-overflow-button_" + incident_id)
button = browser.find_element("id", "description-overflow-button_" + incident_id)
button.click()

buttonRow = browser.find_element_by_id("description-overflow-row_" + incident_id)
buttonRow = browser.find_element("id", "description-overflow-row_" + incident_id)
assert not buttonRow.is_displayed()


Expand All @@ -241,13 +241,13 @@ def test_officer_form_has_units_alpha_sorted(mockdata, browser):

# Check for the Unit sort on the 'add officer' form
browser.get("http://localhost:5000/officer/new")
unit_select = Select(browser.find_element_by_id("unit"))
unit_select = Select(browser.find_element("id", "unit"))
select_units_sorted = list(map(lambda x: x.text, unit_select.options))
assert db_units_sorted == select_units_sorted

# Check for the Unit sort on the 'add assignment' form
browser.get("http://localhost:5000/officer/1")
unit_select = Select(browser.find_element_by_id("unit"))
unit_select = Select(browser.find_element("id", "unit"))
select_units_sorted = list(map(lambda x: x.text, unit_select.options))
assert db_units_sorted == select_units_sorted

Expand All @@ -266,13 +266,13 @@ def test_edit_officer_form_coerces_none_race_or_gender_to_not_sure(mockdata, bro
browser.get("http://localhost:5000/officer/1/edit")

wait_for_element(browser, By.ID, "gender")
select = Select(browser.find_element_by_id("gender"))
select = Select(browser.find_element("id", "gender"))
selected_option = select.first_selected_option
selected_text = selected_option.text
assert selected_text == "Not Sure"

wait_for_element(browser, By.ID, "race")
select = Select(browser.find_element_by_id("race"))
select = Select(browser.find_element("id", "race"))
selected_option = select.first_selected_option
selected_text = selected_option.text
assert selected_text == "Not Sure"
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pytest-env==0.6.2
pytest-pep8==1.0.6
pytest-sugar==0.9.4
pytest-xdist==1.25.0
selenium==3.14.0
selenium==4.3.0
sphinx==1.7.8
sphinx-autobuild==0.7.1
xvfbwrapper==0.2.9

0 comments on commit 2af3263

Please sign in to comment.