UI improvements (#412)
* Update CONTRIBUTING.md * Add option for tags on import (#377) * Add option for tags on import and backup * .add_watch() can accept empty tag Use https://changedetection.io/CHANGELOG.txt as a nice default page to watch * plaintext mime type fix - Don't attempt to extract HTML content from plaintext, this will remove lines and break changedetection (#391) * #323 Adding note about discord:// 2000 char limit (#392) * Adding note about discord:// 2000 char limit * Ability to use a generated salted password in deployments as env var SALTED_PASS (#397) * Ability to use a generated salted password in deployments as env var SALTED_PASS * Offer instance on Lemonade Tidy README * Update README - Tidy up sections * Update README - Fix docker section * Update README.md * /preview format doesnt need <pre> - fixing too many returnlines in content on diff/preview page * fixed the reference to wiki for rpi section (#402) * Add notification note - tgram:// bots cant send messages to other bots, so you should specify chat ID of non-bot user. * Notification error log handler (#403) * Add a notifications debug/error log interface (Link available under the notification URLs list) * Refactor tests for notification error log handler (#404) * Introduce -h option to allow listening not on 0.0.0.0. (#406) * Fix typo in the startup create-directory command suggestion (#405) * Use flask url_for() for webdriver chrome icon instead of relative path * merging latest upstream changes Co-authored-by: dgtlmoon <dgtlmoon@gmail.com> Co-authored-by: Tim Loderhose <timlod@users.noreply.github.com> Co-authored-by: Radu Ursache <3800336+rursache@users.noreply.github.com> Co-authored-by: Alexander Aleksandrovič Klimov <al2klimov@gmail.com>ui-improvements
parent
9f2806062b
commit
ca91f732b8
@ -0,0 +1,19 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="edit-form">
|
||||||
|
<div class="inner">
|
||||||
|
|
||||||
|
<h4 style="margin-top: 0px;">The following issues were detected when sending notifications</h4>
|
||||||
|
<div id="notification-customisation">
|
||||||
|
<ul style="font-size: 80%; margin:0px; padding: 0 0 0 7px">
|
||||||
|
{% for log in logs|reverse %}
|
||||||
|
<li>{{log}}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
from flask import url_for
|
||||||
|
|
||||||
|
from .util import live_server_setup
|
||||||
|
|
||||||
|
|
||||||
|
def test_import(client, live_server):
|
||||||
|
|
||||||
|
live_server_setup(live_server)
|
||||||
|
|
||||||
|
# Give the endpoint time to spin up
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
res = client.post(
|
||||||
|
url_for("import_page"),
|
||||||
|
data={
|
||||||
|
"urls": """https://example.com
|
||||||
|
https://example.com tag1
|
||||||
|
https://example.com tag1, other tag"""
|
||||||
|
},
|
||||||
|
follow_redirects=True,
|
||||||
|
)
|
||||||
|
assert b"3 Imported" in res.data
|
||||||
|
assert b"tag1" in res.data
|
||||||
|
assert b"other tag" in res.data
|
@ -0,0 +1,66 @@
|
|||||||
|
import os
|
||||||
|
import time
|
||||||
|
import re
|
||||||
|
from flask import url_for
|
||||||
|
from . util import set_original_response, set_modified_response, live_server_setup
|
||||||
|
import logging
|
||||||
|
|
||||||
|
def test_check_notification_error_handling(client, live_server):
|
||||||
|
|
||||||
|
live_server_setup(live_server)
|
||||||
|
set_original_response()
|
||||||
|
|
||||||
|
# Give the endpoint time to spin up
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
# use a different URL so that it doesnt interfere with the actual check until we are ready
|
||||||
|
test_url = url_for('test_endpoint', _external=True)
|
||||||
|
res = client.post(
|
||||||
|
url_for("api_watch_add"),
|
||||||
|
data={"url": "https://changedetection.io/CHANGELOG.txt", "tag": ''},
|
||||||
|
follow_redirects=True
|
||||||
|
)
|
||||||
|
assert b"Watch added" in res.data
|
||||||
|
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
# Check we capture the failure, we can just use trigger_check = y here
|
||||||
|
res = client.post(
|
||||||
|
url_for("edit_page", uuid="first"),
|
||||||
|
data={"notification_urls": "jsons://broken-url.changedetection.io/test",
|
||||||
|
"notification_title": "xxx",
|
||||||
|
"notification_body": "xxxxx",
|
||||||
|
"notification_format": "Text",
|
||||||
|
"url": test_url,
|
||||||
|
"tag": "",
|
||||||
|
"title": "",
|
||||||
|
"headers": "",
|
||||||
|
"minutes_between_check": "180",
|
||||||
|
"fetch_backend": "html_requests",
|
||||||
|
"trigger_check": "y"},
|
||||||
|
follow_redirects=True
|
||||||
|
)
|
||||||
|
assert b"Updated watch." in res.data
|
||||||
|
|
||||||
|
found=False
|
||||||
|
for i in range(1, 10):
|
||||||
|
time.sleep(1)
|
||||||
|
logging.debug("Fetching watch overview....")
|
||||||
|
res = client.get(
|
||||||
|
url_for("index"))
|
||||||
|
|
||||||
|
if bytes("Notification error detected".encode('utf-8')) in res.data:
|
||||||
|
found=True
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
assert found
|
||||||
|
|
||||||
|
|
||||||
|
# The error should show in the notification logs
|
||||||
|
res = client.get(
|
||||||
|
url_for("notification_logs"))
|
||||||
|
assert bytes("Name or service not known".encode('utf-8')) in res.data
|
||||||
|
|
||||||
|
|
||||||
|
# And it should be listed on the watch overview
|
Loading…
Reference in new issue