summaryrefslogtreecommitdiff
path: root/django/contrib/admin/tests.py
AgeCommit message (Collapse)Author
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-07-23Refs #36500 -- Shortened some long docstrings and comments.Mike Edmunds
Manually reformatted some long docstrings and comments that would be damaged by the to-be-applied autofixer script, in cases where editorial judgment seemed necessary for style or wording changes.
2025-07-23Removed double spaces after periods and within phrases.Sarah Boyce
2025-07-18Triggered window resize to fix layout issues.Sarah Boyce
2025-06-27Refs #15727 -- Updated AdminSeleniumTestCase to use ↵Natalia
ContentSecurityPolicyMiddleware. Replaced the custom CSP middleware previously used in the admin's AdminSeleniumTestCase with the official ContentSecurityPolicyMiddleware. This change ensures alignment with Django's built-in CSP support. Also updates the test logic to inspect browser console logs to assert that no CSP violations are triggered during Selenium admin tests.
2025-03-18Handled WebDriverException from Chrome driver version 113+.Sarah Boyce
2025-01-09Fixed #35940 -- Disabled SelectFilter add/remove buttons when appropriate.Brock
2024-08-08Fixed #35622 -- Made unittest ignore Django assertions in traceback frames.Adam Johnson
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-10-21Fixed #33211 -- Updated tests for Selenium 4.0.0.Carlton Gibson
Replaced deprecated `find_element[s]_by_*()` usages, in favour of `find_element[s]()` with an explicit `By`.
2021-10-21Refs #33211 -- Added assertCountSeleniumElements() test helper.Carlton Gibson
2020-09-14Fixed #31789 -- Added a new headers interface to HttpResponse.Tom Carrick
2019-12-02Refs #29892 -- Made Selenium tests wait for popups to be ready.Jon Dufresne
2019-11-28Fixed #31042 -- Removed AdminSeleniumTestCase.get_css_value() in favor of ↵Jon Dufresne
Selenium .is_displayed(). All instances of AdminSeleniumTestCase.get_css_value() were used to inspect the display property.
2019-11-27Fixed #30975 -- Replaced custom get_select_option with Selenium's ↵Johannes Hoppe
select_by_value.
2019-11-27Fixed #30973 -- Converted selenium tests wait_page_loaded to context manager.Johannes Hoppe
2017-12-04Fixed #28860 -- Removed unnecessary len() calls.Дилян Палаузов
2017-02-07Converted usage of ugettext* functions to their gettext* aliasesClaude Paroz
Thanks Tim Graham for the review.
2017-02-04Refs #27656 -- Updated django.contrib docstring verb style according to PEP 257.Anton Samarchyan
2016-05-17Fixed #26601 -- Improved middleware per DEP 0005.Florian Apolloner
Thanks Tim Graham for polishing the patch, updating the tests, and writing documentation. Thanks Carl Meyer for shepherding the DEP.
2016-05-03Fixed #26577 -- Disabled implicit wait of Selenium tests where appropriate.Simon Charette
2016-05-03Fixed #26575 -- Disabled SelectFilter buttons when inactive.David Sanders
2016-03-15Fixed #25364 -- Added generic way to test on all browsers supported by selenium.Akshesh
Browser names should be passed as a comma separated list to the --selenium flag. Thanks Tim Graham, Simon Charette and Moritz Sichert for review and discussion.
2016-02-19Fixed #25653 -- Made --selenium run only the selenium tests.Akshesh
2016-01-11Refs #494 -- Fixed a flaky admin_inlines tests.Tim Graham
2016-01-11Fixed #26048 -- Made admin selenium tests use implicitly_wait()Tim Graham
2015-12-05Fixed #25165 -- Removed inline JavaScript from the admin.Thomas Grainger
This allows setting a Content-Security-Policy HTTP header (refs #15727). Special thanks to blighj, the original author of this patch.
2015-08-28Fixed #25323 -- Fixed selenium test failures with chromedriver 2.18.Tim Graham
2014-08-28Fixed #23374 -- Renamed StaticLiveServerCase to StaticLiveServerTestCaseClaude Paroz
Refs #20739. Thanks Raphaël Hertzog for the report and the initial patch.
2014-03-03Fixed many typos in comments and docstrings.Rodolfo Carvalho
Thanks Piotr Kasprzyk for help with the patch.
2014-02-08Fixed #21674 -- Deprecated the import_by_path() function in favor of ↵Berker Peksag
import_string(). Thanks Aymeric Augustin for the suggestion and review.
2014-01-03Fixed selenium failure.Florian Apolloner
This fixes (at least according to tests on the ci itself) admin_widgets.tests.RelatedFieldWidgetSeleniumFirefoxTests.test_foreign_key_using_to_field (http://ci.djangoproject.com/job/Django/database=mysql_gis,python=python2.7/3792/testReport/junit/admin_widgets.tests/RelatedFieldWidgetSeleniumFirefoxTests/test_foreign_key_using_to_field/) The cause for this issue seems to be that wait_page_loaded was executed before click fired and as such no profile got saved (again just an educated guess, but with this fix I can no longer reproduce it -- fingers crossed).
2014-01-03Revert "Fixed #21227 -- Added workaround for selenium test failures"Florian Apolloner
This reverts commit 08c9ab5a0f564a3ac7803e6a97fae855f2e0524e.
2014-01-03Removed unneeded import.Florian Apolloner
2014-01-03Fixed a few flaky selenium tests.Florian Apolloner
Many thanks go to David Burns (@AutomatedTester) for helping me understand css selectors and pointing me towards the correct selenium methods.
2013-10-24Fixed #21227 -- Added workaround for selenium test failuresKevin Christopher Henry
Added a refresh() before quit() in the selenium tests, since this solves the problem of spurious test failures in some environments.
2013-09-17Destroy selenium before live server threads.Florian Apolloner
Ensure that selenium quits before the live server thread to prevent occasional hangs when killing the live server.
2013-09-17Final attempt to solve sporadic test failures.Florian Apolloner
tearDownClass is not called if setUpClass throws an exception, in our case this means that LiveServerTestCase leaks LiveServerThread sockets if the test happens to be skipped later on, and AdminSeleniumWebDriverTestCase doesn't close it's already open browser window. To prevent this leakage we catch errors where needed and manually call _tearDownClassInternal. _tearDownClassInternal should be written as defensively as possible since it is not allowed to make any assumptions on how far setUpClass got. This patch should fix the sporadic "Address already in use"-errors on jenkins and also the "This code isn't under transaction management"-error for sqlite (also just on jenkins). After discussion with koniiiik, jezdez, kmtracey, tos9, lifeless, nedbat and voidspace it was decided that this is the safest approach (thanks to everyone for their comments and help). Manually calling tearDownClass was shut down cause we don't know how our users override our classes. This is a private and very specialized API on purpose and should not be used without a strong reason! This patch partially reverts the earlier attempts to fix those issues, namely: 2fa0dd73b18f55d0fdd1c1d54b1d18031bfcf1ed and 3c5775d36f7e431d9691829a78580873111cb714 Final note: If this patch breaks in a later version of Django, please be very careful on how you fix it, you might not see test failures locally. That said, this patch hopefully doesn't produce even more failures.
2013-09-14Fixed error handling in 3c5775d36f7e431d9691829a78580873111cb714 for ↵Florian Apolloner
non-operational webdrivers.
2013-09-14Delayed initialization of Selenium webdrivers.Florian Apolloner
If setUpClass throws an exception (in this case "Address already in use" if the super call can't find any open port to bind too) tearDownClass is not called. This results in open browser windows from the webdriver, hence we only construct it once we are sure there is no code afterwards which could error out.
2013-08-31Updated Selenium-based tests after e909ceae9b.Ramiro Morales
2013-07-01Stopped using django.utils.unittest in the test suite.Aymeric Augustin
Refs #20680.
2013-06-10Defined available_apps in relevant tests.Aymeric Augustin
Fixed #20483.
2013-02-25Fixed #19854 -- Turn Django's own Selenium tests off by default.Carl Meyer
2013-02-23Added test runner option to skip Selenium tests (#19854).Zbigniew Siciarz
2013-02-20Made a couple of selenium tests wait for page loadedAnssi Kääriäinen
The admin_widgets tests were issuing click() to the browser but didn't wait for the effects of those clicks. This caused the resulting request to be processed concurrently with the test case. When using in-memory SQLite this caused weird failures. Also added wait_page_loaded() to admin selenium tests for code reuse. Fixed #19856
2013-02-04Fixed #17061 -- Factored out importing object from a dotted pathClaude Paroz
Thanks Carl Meyer for the report.
2012-10-04Fixed #19051 - Fixed Selenium tearDownClass method; thanks glarrain for the ↵Tim Graham
report.
2012-04-29Fixed #18013 -- Use the new 'as' syntax for exceptions.Claude Paroz
Thanks Clueless for the initial patch. Note that unittest has been purposely left out (external package only used by Python 2.6).