forked from lucyparsons/OpenOversight
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump selenium 3.14.0->4.3.0, geckodriver 0.26.0->0.31.0 (#155)
* 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
1 parent
42d6acd
commit 2af3263
Showing
3 changed files
with
39 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
|
||
|
||
|
@@ -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 | ||
|
||
|
||
|
@@ -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 | ||
|
@@ -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 | ||
|
||
|
||
|
@@ -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 | ||
|
||
|
@@ -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 | ||
) | ||
|
@@ -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 | ||
|
||
|
||
|
@@ -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 | ||
|
||
|
||
|
@@ -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() | ||
|
||
|
||
|
@@ -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() | ||
|
||
|
||
|
@@ -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 | ||
|
@@ -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() | ||
|
||
|
||
|
@@ -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 | ||
|
||
|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters