Skip to content

Commit

Permalink
Moved XhrPending test case on its own selenium instance with explicit…
Browse files Browse the repository at this point in the history
… waits
  • Loading branch information
jpic committed Jan 28, 2014
1 parent 903edf8 commit 07ff404
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions autocomplete_light/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
SelectChoiceInEmptyFormTestCase,
WidgetInitialStatusInEditForm,
RemoveChoiceInEditFormTestCase,
XhrPendingTestCase,
KeyboardTestCase,
InlineBlankTestCase,
InlineSelectChoiceTestCase,
Expand Down
16 changes: 12 additions & 4 deletions autocomplete_light/tests/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from selenium.webdriver.support import ui
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC


if VERSION[0] == 1 and VERSION[1] < 7:
Expand Down Expand Up @@ -213,12 +215,18 @@ def test_autocomplete_shows_up(self):
def test_autocomplete_has_four_choices(self):
self.assertEqual(4, len(self.autocomplete_choices()))

class XhrPendingTestCase(WidgetTestCase):
def setup_test_case(self):
self.login()
self.open_url('/admin/basic/fkmodel/add/')

def test_xhr_pending(self):
self.selenium.find_element_by_css_selector(
'input.xhr-pending[name=%s-autocomplete]' % self.autocomplete_name)
self.send_keys('ja')
ui.WebDriverWait(self.selenium, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR,
'input.xhr-pending[name=%s-autocomplete]' % self.autocomplete_name)))

self.selenium.find_element_by_css_selector(
'input:not(.xhr-pending)[name=%s-autocomplete]' % self.autocomplete_name)
ui.WebDriverWait(self.selenium, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR,
'input:not(.xhr-pending)[name=%s-autocomplete]' % self.autocomplete_name)))


class SelectChoiceInEmptyFormTestCase(WidgetTestCase):
Expand Down

0 comments on commit 07ff404

Please sign in to comment.