1010from selenium .webdriver .support .ui import Select , WebDriverWait
1111from swapper import load_model
1212
13- from openwisp_utils .test_selenium_mixins import SeleniumTestMixin
13+ from openwisp_utils .tests import SeleniumTestMixin
1414
15- from ...tests .utils import DeviceAdminSeleniumTextMixin
1615from .utils import CreateConfigTemplateMixin , TestWireguardVpnMixin
1716
1817Device = load_model ('config' , 'Device' )
1918
2019
2120@tag ('selenium_tests' )
2221class TestDeviceAdmin (
23- DeviceAdminSeleniumTextMixin ,
22+ SeleniumTestMixin ,
2423 CreateConfigTemplateMixin ,
2524 StaticLiveServerTestCase ,
2625):
@@ -97,6 +96,7 @@ def test_device_preview_keyboard_shortcuts(self):
9796 self .open (reverse ('admin:config_device_changelist' ))
9897 try :
9998 self .open (reverse ('admin:config_device_change' , args = [device .id ]))
99+ self .hide_loading_overlay ()
100100 except TimeoutException :
101101 self .fail ('Device detail page did not load in time' )
102102
@@ -140,6 +140,7 @@ def test_multiple_organization_templates(self):
140140 reverse ('admin:config_device_change' , args = [org1_device .id ])
141141 + '#config-group'
142142 )
143+ self .hide_loading_overlay ()
143144 # org2 templates should not be visible
144145 self .wait_for_invisibility (
145146 By .XPATH , f'//*[@value="{ org2_required_template .id } "]'
@@ -163,6 +164,7 @@ def test_change_config_backend(self):
163164 self .open (
164165 reverse ('admin:config_device_change' , args = [device .id ]) + '#config-group'
165166 )
167+ self .hide_loading_overlay ()
166168 self .find_element (by = By .XPATH , value = f'//*[@value="{ template .id } "]' )
167169 # Change config backed to
168170 config_backend_select = Select (
@@ -183,6 +185,7 @@ def test_template_context_variables(self):
183185 self .open (
184186 reverse ('admin:config_device_change' , args = [device .id ]) + '#config-group'
185187 )
188+ self .hide_loading_overlay ()
186189 try :
187190 WebDriverWait (self .web_driver , 2 ).until (
188191 EC .text_to_be_present_in_element_value (
@@ -216,6 +219,7 @@ def test_force_delete_device_with_deactivating_config(self):
216219
217220 self .login ()
218221 self .open (reverse ('admin:config_device_change' , args = [device .id ]))
222+ self .hide_loading_overlay ()
219223 # The webpage has two "submit-row" sections, each containing a "Deactivate"
220224 # button. The first (top) "Deactivate" button is hidden, causing
221225 # `wait_for_visibility` to fail. To avoid this issue, we use
@@ -232,6 +236,7 @@ def test_force_delete_device_with_deactivating_config(self):
232236 self .assertEqual (config .is_deactivating (), True )
233237
234238 self .open (reverse ('admin:config_device_change' , args = [device .id ]))
239+ self .hide_loading_overlay ()
235240 # Use `presence` instead of `visibility` for `wait_for`,
236241 # as the same issue described above applies here.
237242 self .find_elements (
@@ -282,7 +287,7 @@ def test_force_delete_multiple_devices_with_deactivating_config(self):
282287
283288@tag ('selenium_tests' )
284289class TestDeviceAdminUnsavedChanges (
285- DeviceAdminSeleniumTextMixin ,
290+ SeleniumTestMixin ,
286291 CreateConfigTemplateMixin ,
287292 StaticLiveServerTestCase ,
288293):
@@ -297,9 +302,10 @@ def test_unsaved_changes(self):
297302 self .login ()
298303 device = self ._create_config (organization = self ._get_org ()).device
299304 path = reverse ('admin:config_device_change' , args = [device .id ])
300- self . open ( path )
305+
301306 with self .subTest ('Alert should not be displayed without any change' ):
302307 self .open (path )
308+ self .hide_loading_overlay ()
303309 try :
304310 WebDriverWait (self .web_driver , 1 ).until (EC .alert_is_present ())
305311 except TimeoutException :
0 commit comments