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
99d2469e
Kaydet (Commit)
99d2469e
authored
Ock 11, 2016
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #494 -- Fixed a flaky admin_inlines tests.
üst
294d0d88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
5 deletions
+27
-5
tests.py
django/contrib/admin/tests.py
+22
-0
tests.py
tests/admin_inlines/tests.py
+5
-5
No files found.
django/contrib/admin/tests.py
Dosyayı görüntüle @
99d2469e
...
...
@@ -99,6 +99,28 @@ class AdminSeleniumWebDriverTestCase(StaticLiveServerTestCase):
timeout
)
def
wait_until_visible
(
self
,
css_selector
,
timeout
=
10
):
"""
Block until the element described by the CSS selector is visible.
"""
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.support
import
expected_conditions
as
ec
self
.
wait_until
(
ec
.
visibility_of_element_located
((
By
.
CSS_SELECTOR
,
css_selector
)),
timeout
)
def
wait_until_invisible
(
self
,
css_selector
,
timeout
=
10
):
"""
Block until the element described by the CSS selector is invisible.
"""
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.support
import
expected_conditions
as
ec
self
.
wait_until
(
ec
.
invisibility_of_element_located
((
By
.
CSS_SELECTOR
,
css_selector
)),
timeout
)
def
wait_page_loaded
(
self
):
"""
Block until page has started to load.
...
...
tests/admin_inlines/tests.py
Dosyayı görüntüle @
99d2469e
...
...
@@ -879,19 +879,19 @@ class SeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
self
.
admin_login
(
username
=
'super'
,
password
=
'secret'
)
self
.
selenium
.
get
(
self
.
live_server_url
+
reverse
(
'admin:admin_inlines_author_add'
))
# One field is in a stacked inline, other in a tabular one.
test_fields
=
[
'
id_nonautopkbook_set-0-title'
,
'
id_nonautopkbook_set-2-0-title'
]
test_fields
=
[
'
#id_nonautopkbook_set-0-title'
,
'#
id_nonautopkbook_set-2-0-title'
]
show_links
=
self
.
selenium
.
find_elements_by_link_text
(
'SHOW'
)
self
.
assertEqual
(
len
(
show_links
),
2
)
for
show_index
,
field_name
in
enumerate
(
test_fields
,
0
):
self
.
assertFalse
(
self
.
selenium
.
find_element_by_id
(
field_name
)
.
is_displayed
()
)
self
.
wait_until_invisible
(
field_name
)
show_links
[
show_index
]
.
click
()
self
.
assertTrue
(
self
.
selenium
.
find_element_by_id
(
field_name
)
.
is_displayed
()
)
self
.
wait_until_visible
(
field_name
)
hide_links
=
self
.
selenium
.
find_elements_by_link_text
(
'HIDE'
)
self
.
assertEqual
(
len
(
hide_links
),
2
)
for
hide_index
,
field_name
in
enumerate
(
test_fields
,
0
):
self
.
assertTrue
(
self
.
selenium
.
find_element_by_id
(
field_name
)
.
is_displayed
()
)
self
.
wait_until_visible
(
field_name
)
hide_links
[
hide_index
]
.
click
()
self
.
assertFalse
(
self
.
selenium
.
find_element_by_id
(
field_name
)
.
is_displayed
()
)
self
.
wait_until_invisible
(
field_name
)
class
SeleniumChromeTests
(
SeleniumFirefoxTests
):
...
...
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