-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] Fixed monitoring charts not loading from device admin #329 #349
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
42c9290
[fix] Fixed monitoring charts not loading from device admin #329
pandafy 60cea8b
[tests] Fixed tests
pandafy 1f439e6
[chores] Updated openwisp-users commit hash
pandafy 140a55a
[tests] Improved test
pandafy 2dfd08b
[chores] Update images/openwisp_base/Dockerfile
nemesifier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,12 @@ | |
from urllib import request | ||
|
||
from selenium import webdriver | ||
from selenium.common.exceptions import NoSuchElementException | ||
from selenium.common.exceptions import NoSuchElementException, TimeoutException | ||
from selenium.webdriver.chrome.options import Options as ChromiumOptions | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | ||
from selenium.webdriver.support import expected_conditions as EC | ||
from selenium.webdriver.support.ui import WebDriverWait | ||
from utils import TestUtilities | ||
|
||
|
||
|
@@ -121,7 +123,6 @@ def setUpClass(cls): | |
# Create base drivers (Chromium) | ||
if cls.config['driver'] == 'chromium': | ||
options = ChromiumOptions() | ||
options.add_argument('--headless') | ||
options.add_argument('--ignore-certificate-errors') | ||
if cls.config['headless']: | ||
options.add_argument('--headless') | ||
|
@@ -190,6 +191,23 @@ def test_admin_login(self): | |
) | ||
self.fail(message) | ||
|
||
def test_device_monitoring_charts(self): | ||
self.login() | ||
self._wait_for_element() | ||
self.get_resource('test-device', '/admin/config/device/') | ||
self._wait_for_element() | ||
self.base_driver.find_element(By.CSS_SELECTOR, 'ul.tabs li.charts').click() | ||
try: | ||
WebDriverWait(self.base_driver, 3).until(EC.alert_is_present()) | ||
except TimeoutException: | ||
# No alert means that the request to fetch | ||
# monitoring charts was successful. | ||
pass | ||
else: | ||
# When the request to fetch monitoring charts fails, | ||
# an error is shown. | ||
self.fail('An alert was found on the device chart page.') | ||
|
||
def test_create_prefix_users(self): | ||
self.login() | ||
prefix_objname = 'automated-prefix-test-01' | ||
|
@@ -265,10 +283,6 @@ def test_console_errors(self): | |
# url_list tests | ||
for url in url_list: | ||
self.base_driver.get(f"{self.config['app_url']}{url}") | ||
# console_error_check method should be called twice | ||
# to avoid the "beforeunload' chrome issue | ||
# https://stackoverflow.com/questions/10680544/beforeunload-chrome-issue | ||
self.console_error_check() | ||
self.assertEqual([], self.console_error_check()) | ||
self.assertIn('OpenWISP', self.base_driver.title) | ||
# change_form_list tests | ||
|
@@ -311,10 +325,10 @@ def test_forgot_password(self): | |
"""Test forgot password to ensure that postfix is working properly.""" | ||
self.base_driver.get(f"{self.config['app_url']}/accounts/password/reset/") | ||
self.base_driver.find_element(By.NAME, 'email').send_keys('[email protected]') | ||
self.base_driver.find_element(By.XPATH, '//input[@type="submit"]').click() | ||
self.base_driver.find_element(By.XPATH, '//button[@type="submit"]').click() | ||
self._wait_for_element() | ||
self.assertIn( | ||
'We have sent you an e-mail. If you have not received ' | ||
'We have sent you an email. If you have not received ' | ||
'it please check your spam folder. Otherwise contact us ' | ||
'if you do not receive it in a few minutes.', | ||
self.base_driver.page_source, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried adding only this test on the latest master and it fails here, I was expecting it to fail in the try/except block below, but that's not the case. Is this intended or not?
Failure output:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not able to replicate this error locally. Did you also copy the changes in data.py and utis.py?
Anyway, I have improved the test to make it more robust.