Skip to content

Commit dadf6c7

Browse files
committed
[chores] Added organization setup for geo selenium test
The geo selenium tests were failing overall due to organization not being created for the device. Added organization mixin to solve this. Also added a temporary link to `django_loci` tarball in requirements.txt to tackle failing builds. Signed-off-by: DragnEmperor <[email protected]>
1 parent 71974f5 commit dadf6c7

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

openwisp_controller/geo/tests/test_selenium.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
from selenium.webdriver.common.by import By
55
from swapper import load_model
66

7+
from openwisp_users.tests.utils import TestOrganizationMixin
8+
79
Device = load_model('config', 'Device')
810
Location = load_model('geo', 'Location')
911
FloorPlan = load_model('geo', 'FloorPlan')
1012
DeviceLocation = load_model('geo', 'DeviceLocation')
1113

1214

13-
class TestDeviceAdminSelenium(BaseTestDeviceAdminSelenium, StaticLiveServerTestCase):
15+
class TestDeviceAdminSelenium(
16+
BaseTestDeviceAdminSelenium, TestOrganizationMixin, StaticLiveServerTestCase
17+
):
1418
app_label = 'geo'
1519
object_model = Device
1620
location_model = Location
@@ -24,7 +28,21 @@ def _get_prefix(cls):
2428
return cls.inline_field_prefix
2529

2630
def _create_device(self):
31+
org = self._get_org()
2732
self.find_element(by=By.NAME, value='mac_address').send_keys(
2833
'11:22:33:44:55:66'
2934
)
35+
self.find_element(
36+
by=By.CSS_SELECTOR, value='#select2-id_organization-container'
37+
).click()
38+
self.wait_for_invisibility(
39+
By.CSS_SELECTOR, '.select2-results__option.loading-results'
40+
)
41+
self.find_element(by=By.CLASS_NAME, value='select2-search__field').send_keys(
42+
org.name
43+
)
44+
self.wait_for_invisibility(
45+
By.CSS_SELECTOR, '.select2-results__option.loading-results'
46+
)
47+
self.find_element(by=By.CLASS_NAME, value='select2-results__option').click()
3048
super()._create_device()

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ django-reversion~=5.1.0
33
django-taggit~=6.0.0
44
netjsonconfig @ https://github.com/openwisp/netjsonconfig/tarball/1.2
55
django-x509 @ https://github.com/openwisp/django-x509/tarball/1.3
6-
django-loci @ https://github.com/openwisp/django-loci/tarball/1.2
6+
# temp for passing tests
7+
django-loci @ https://github.com/DragnEmperor/django-loci/tarball/chores/migrate-formset-function
78
django-flat-json-widget~=0.3.1
89
openwisp-users @ https://github.com/openwisp/openwisp-users/tarball/1.2
910
openwisp-utils[celery,channels] @ https://github.com/openwisp/openwisp-utils/tarball/1.2

0 commit comments

Comments
 (0)