Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
294d0d88
Kaydet (Commit)
294d0d88
authored
Ock 11, 2016
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26048 -- Made admin selenium tests use implicitly_wait()
üst
bc7d201b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
16 deletions
+6
-16
tests.py
django/contrib/admin/tests.py
+2
-8
tools.txt
docs/topics/testing/tools.txt
+1
-0
tests.py
tests/admin_views/tests.py
+2
-4
tests.py
tests/admin_widgets/tests.py
+1
-4
No files found.
django/contrib/admin/tests.py
Dosyayı görüntüle @
294d0d88
...
...
@@ -37,6 +37,7 @@ class AdminSeleniumWebDriverTestCase(StaticLiveServerTestCase):
except
Exception
as
e
:
raise
SkipTest
(
'Selenium webdriver "
%
s" not installed or not '
'operational:
%
s'
%
(
cls
.
webdriver_class
,
str
(
e
)))
cls
.
selenium
.
implicitly_wait
(
10
)
# This has to be last to ensure that resources are cleaned up properly!
super
(
AdminSeleniumWebDriverTestCase
,
cls
)
.
setUpClass
()
...
...
@@ -63,13 +64,6 @@ class AdminSeleniumWebDriverTestCase(StaticLiveServerTestCase):
"""
self
.
wait_until
(
lambda
d
:
len
(
d
.
window_handles
)
==
num_windows
,
timeout
)
def
wait_loaded_tag
(
self
,
tag_name
,
timeout
=
10
):
"""
Helper function that blocks until the element with the given tag name
is found on the page.
"""
self
.
wait_for
(
tag_name
,
timeout
)
def
wait_for
(
self
,
css_selector
,
timeout
=
10
):
"""
Helper function that blocks until a CSS selector is found on the page.
...
...
@@ -112,7 +106,7 @@ class AdminSeleniumWebDriverTestCase(StaticLiveServerTestCase):
from
selenium.common.exceptions
import
TimeoutException
try
:
# Wait for the next page to be loaded
self
.
wait_
loaded_tag
(
'body'
)
self
.
wait_
for
(
'body'
)
except
TimeoutException
:
# IE7 occasionally returns an error "Internet Explorer cannot
# display the webpage" and doesn't load the next page. We just
...
...
docs/topics/testing/tools.txt
Dosyayı görüntüle @
294d0d88
...
...
@@ -900,6 +900,7 @@ The code for this test may look as follows::
def setUpClass(cls):
super(MySeleniumTests, cls).setUpClass()
cls.selenium = WebDriver()
cls.selenium.implicitly_wait(10)
@classmethod
def tearDownClass(cls):
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
294d0d88
...
...
@@ -4430,8 +4430,7 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
self
.
admin_login
(
username
=
'super'
,
password
=
'secret'
,
login_url
=
reverse
(
'admin:index'
))
self
.
selenium
.
get
(
full_url
)
self
.
selenium
.
find_element_by_class_name
(
'deletelink'
)
.
click
()
# Wait until we're on the delete page.
self
.
wait_for
(
'.cancel-link'
)
# Click 'cancel' on the delete page.
self
.
selenium
.
find_element_by_class_name
(
'cancel-link'
)
.
click
()
# Wait until we're back on the change page.
self
.
wait_for_text
(
'#content h1'
,
'Change pizza'
)
...
...
@@ -4452,8 +4451,7 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
self
.
admin_login
(
username
=
'super'
,
password
=
'secret'
,
login_url
=
reverse
(
'admin:index'
))
self
.
selenium
.
get
(
full_url
)
self
.
selenium
.
find_element_by_class_name
(
'deletelink'
)
.
click
()
# Wait until we're on the delete page.
self
.
wait_for
(
'.cancel-link'
)
# Click 'cancel' on the delete page.
self
.
selenium
.
find_element_by_class_name
(
'cancel-link'
)
.
click
()
# Wait until we're back on the change page.
self
.
wait_for_text
(
'#content h1'
,
'Change pizza'
)
...
...
tests/admin_widgets/tests.py
Dosyayı görüntüle @
294d0d88
...
...
@@ -1154,7 +1154,6 @@ class HorizontalVerticalFilterSeleniumFirefoxTests(SeleniumDataMixin, AdminSelen
# Navigate away and go back to the change form page.
self
.
selenium
.
find_element_by_link_text
(
'Home'
)
.
click
()
self
.
selenium
.
back
()
self
.
wait_for
(
'#id_students_from'
)
expected_unselected_values
=
[
str
(
self
.
arthur
.
id
),
str
(
self
.
bob
.
id
),
str
(
self
.
cliff
.
id
),
str
(
self
.
jason
.
id
),
str
(
self
.
jenny
.
id
),
str
(
self
.
john
.
id
),
...
...
@@ -1306,7 +1305,6 @@ class RelatedFieldWidgetSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWeb
self
.
selenium
.
find_element_by_id
(
'add_id_user'
)
.
click
()
self
.
wait_for_popup
()
self
.
selenium
.
switch_to
.
window
(
'id_user'
)
self
.
wait_for
(
'#id_password'
)
password_field
=
self
.
selenium
.
find_element_by_id
(
'id_password'
)
password_field
.
send_keys
(
'password'
)
...
...
@@ -1318,14 +1316,13 @@ class RelatedFieldWidgetSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWeb
self
.
selenium
.
find_element_by_css_selector
(
save_button_css_selector
)
.
click
()
self
.
selenium
.
switch_to
.
window
(
main_window
)
# The field now contains the new user
self
.
wait_for
(
'#id_user option[value="newuser"]'
)
self
.
assertSelectOptions
(
'#id_user'
,
[
''
,
'super'
,
'newuser'
]
)
# Click the Change User button to change it
self
.
selenium
.
find_element_by_id
(
'change_id_user'
)
.
click
()
self
.
wait_for_popup
()
self
.
selenium
.
switch_to
.
window
(
'id_user'
)
self
.
wait_for
(
'#id_username'
)
username_field
=
self
.
selenium
.
find_element_by_id
(
'id_username'
)
username_value
=
'changednewuser'
username_field
.
clear
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment