Skip to content

Commit 8ffb088

Browse files
authored
[tests] Fixed flaky test: test_input_filters openwisp#431
Closes openwisp#431
1 parent 1d648f5 commit 8ffb088

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

openwisp_utils/admin_theme/static/admin/css/openwisp.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ See https://code.djangoproject.com/ticket/33878 */
7373
--object-tools-fg: var(--button-fg) !important;
7474
--object-tools-bg: var(--close-button-bg) !important;
7575
--object-tools-hover-bg: var(--close-button-hover-bg) !important;
76-
--font-family-primary: "Roboto", "Lucida Grande", "DejaVu Sans",
77-
"Bitstream Vera Sans", Verdana, Arial, sans-serif;
76+
--font-family-primary:
77+
"Roboto", "Lucida Grande", "DejaVu Sans", "Bitstream Vera Sans", Verdana,
78+
Arial, sans-serif;
7879
}
7980
body {
8081
min-width: 320px;

openwisp_utils/admin_theme/static/drf-yasg/ow-drf-yasg.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ body::-webkit-scrollbar {
110110
text-transform: uppercase;
111111
font-weight: normal;
112112
margin: 0 5px;
113-
font-family: "Roboto", "Lucida Grande", "DejaVu Sans", "Bitstream Vera Sans",
114-
Verdana, Arial, sans-seri;
113+
font-family:
114+
"Roboto", "Lucida Grande", "DejaVu Sans", "Bitstream Vera Sans", Verdana,
115+
Arial, sans-serif;
115116
}
116117
.swagger-ui .btn:hover {
117118
background-color: #999;

tests/test_project/tests/test_selenium.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,20 @@ def test_input_filters(self):
586586

587587
with self.subTest('Test SimpleInputFilter'):
588588
self.open(url)
589-
input_field = self._get_simple_input_filter()
589+
590+
if "test_project/shelf/" not in self.web_driver.current_url:
591+
self.open(url)
592+
593+
input_field = WebDriverWait(self.web_driver, 2).until(
594+
EC.presence_of_element_located((By.CSS_SELECTOR, 'input[name=shelf]'))
595+
)
596+
590597
input_field.send_keys('Horror')
591598
self._get_filter_button().click()
592599
# Horror shelf is present
593-
self.web_driver.find_element(By.XPATH, horror_result_xpath)
600+
WebDriverWait(self.web_driver, 2).until(
601+
EC.visibility_of_element_located((By.XPATH, horror_result_xpath))
602+
)
594603
with self.assertRaises(NoSuchElementException):
595604
# Factual shelf is absent
596605
self.web_driver.find_element(By.XPATH, factual_result_xpath)

tests/test_project/tests/utils.py

-3
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ def _get_logout_link(self):
124124
def _get_menu_backdrop(self):
125125
return self.web_driver.find_element(By.CSS_SELECTOR, '.menu-backdrop')
126126

127-
def _get_simple_input_filter(self):
128-
return self.web_driver.find_element(By.CSS_SELECTOR, 'input[name=shelf]')
129-
130127
def _get_input_filter(self):
131128
return self.web_driver.find_element(
132129
By.CSS_SELECTOR, 'input[name=books_type__exact]'

0 commit comments

Comments
 (0)