Date: Wed, 16 Oct 2024 13:24:21 +0200
Subject: [PATCH 5/7] Update README.md
---
README.md | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index 1bf30f93..81cca80c 100644
--- a/README.md
+++ b/README.md
@@ -39,22 +39,24 @@ Here is what you need to be able to run Cometa.
Co.Meta needs to be able to fetch software from the internet. For example python libraries, pre-built containers with virtual browser.
When installing Co.meta in a corporate environment, make sure to whitelist the following domains on the Secure Proxy:
+
+* **List of FQDNs (Full Qualified Domain Names) to clear proxy**
+ | **Domain** | **Reason** |
+ |--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
+ | git.amvara.de | Configure GitLab-runner to provide updates to Cometa. The server should have access to the Amvara GitLab. |
+ | d.amvara.de | Set up Discord notifications for monitoring Cometa servers (storage, errors, feature executions, etc.) and sending notifications to the Amvara team. |
+ | github.com
raw.githubusercontent.com
media.githubusercontent.com
avatars.githubusercontent.com
gist.githubusercontent.com | Cometa downloads dependencies from GitHub repositories, as it is built on open-source libraries. |
+ | docs.docker.com
download.docker.com
store.docker.com | These URLs are used to download and update Docker and Docker Compose installers when updates are required. |
+ | hub.docker.com | Cometa runs on Docker containers and downloads necessary images from Docker Hub, such as Python, Apache, Node.js, etc. |
+ | registry.npmjs.org
www.npmjs.com
deb.nodesource.com | Cometa runs a container called `cometa_socket`, which uses Node.js and npm. |
+ | repo.maven.apache.org | Cometa runs a container called `cometa_selenoid`, which downloads JAR libraries from Maven. |
+ | pypi.org | The Cometa components `cometa_behave`, `cometa_django`, and `cometa_scheduler` rely on Python libraries and download dependencies from this URL. |
+ | kubernetes-charts.storage.googleapis.com | Proxy clearance for accessing Kubernetes charts. |
+ | deb.debian.org
security.debian.org (http and https) | Most of the containers running within cometa uses debian based container, so Debian official repositories are needed for downloading and updating dependencies. |
+ | deb.debian.org (http and https) | Debian backports repository for newer packages available for stable releases. |
+ | deb-multimedia.org (http and https) | Debian multimedia repository for additional multimedia-related packages. |
+ | deb.debian.org (http and https) | Debian "non-free" and "contrib" repositories for software outside of Debian's strict free software guidelines. |
- * https://*.amvara.de
- * https://github.com
- * https://*.githubusercontent.com
- * https://*.docker.com
- * https://*.docker.io
- * https://registry.npmjs.org
- * https://www.npmjs.com
- * https://repo.maven.apache.org
- * https://kubernetes-charts.storage.googleapis.com
- * https://plugins.gradle.org:443
- * https://registry.yarnpkg.com
- * https://deb.nodesource.com
- * https://mod-auth-openidc.org
- * https://pypi.org
- * http://*.debian.org and https://*.debian.org
For corporate environments using a Secure Proxy the Proxy usage needs to be configured:
From 0c6e01eed1ed48ca614fe5f2f8767b1e4cf4616d Mon Sep 17 00:00:00 2001
From: Anand Kushwaha
Date: Wed, 16 Oct 2024 15:12:59 +0200
Subject: [PATCH 6/7] Update README.md
---
README.md | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 81cca80c..28a34567 100644
--- a/README.md
+++ b/README.md
@@ -53,9 +53,7 @@ Here is what you need to be able to run Cometa.
| pypi.org | The Cometa components `cometa_behave`, `cometa_django`, and `cometa_scheduler` rely on Python libraries and download dependencies from this URL. |
| kubernetes-charts.storage.googleapis.com | Proxy clearance for accessing Kubernetes charts. |
| deb.debian.org
security.debian.org (http and https) | Most of the containers running within cometa uses debian based container, so Debian official repositories are needed for downloading and updating dependencies. |
- | deb.debian.org (http and https) | Debian backports repository for newer packages available for stable releases. |
- | deb-multimedia.org (http and https) | Debian multimedia repository for additional multimedia-related packages. |
- | deb.debian.org (http and https) | Debian "non-free" and "contrib" repositories for software outside of Debian's strict free software guidelines. |
+ | deb-multimedia.org (http and https) | Debian multimedia repository for additional multimedia-related packages. |
From b11f009bc4bc7a20d6d255e86f5b2e0b9d52b488 Mon Sep 17 00:00:00 2001
From: anandkushwaha064
Date: Wed, 13 Nov 2024 21:05:13 +0530
Subject: [PATCH 7/7] #4938 Adding option to send email on error after X times
only
---
backend/src/backend/generatePDF.py | 45 +++++++++++++++++--
backend/src/backend/models.py | 4 ++
.../edit-feature/edit-feature.component.html | 23 ++++++++++
.../edit-feature/edit-feature.component.scss | 6 ++-
.../edit-feature/edit-feature.component.ts | 4 ++
front/src/assets/config.json | 12 ++++-
front/src/assets/i18n/en.json | 1 +
front/src/assets/i18n/es.json | 1 +
8 files changed, 90 insertions(+), 6 deletions(-)
diff --git a/backend/src/backend/generatePDF.py b/backend/src/backend/generatePDF.py
index c422316c..09a531b9 100644
--- a/backend/src/backend/generatePDF.py
+++ b/backend/src/backend/generatePDF.py
@@ -173,17 +173,54 @@ def get(self, request):
response['Content-Length'] = len(PDFContent)
return response
else:
+ self.send_mail()
+
+ # Finish
+ return HttpResponse("200")
+
+ """
+ This function handles the logic of sending the mail
+ """
+ def send_mail(self):
+ feature = Feature.objects.get(feature_id=self.feature_id)
+ should_send_the_email = True
+
+ # if feature is set to check for notification on error
+ if feature.check_maximum_notification_on_error:
+ logger.debug("Checking for maximum emails on error")
+ # Check if current feature_result is failed
+ # Check if number of sent notifications are less then maximum number set to send the notification
+ if self.feature_result.success and not feature.send_mail_on_error:
+ should_send_the_email = True
+ feature.number_notification_sent = 0
+
+ elif self.feature_result.success:
+ should_send_the_email = False
+ feature.number_notification_sent = 0
+
+ # Send email and increase number_notification_sent count by 1
+ elif feature.number_notification_sent < feature.maximum_notification_on_error:
+ feature.number_notification_sent = feature.number_notification_sent + 1
+ should_send_the_email = True
+
+ elif feature.number_notification_sent >= feature.maximum_notification_on_error:
+ should_send_the_email = False
+ # In check_maximum_notification_on_error set number_notification_sent to 0 so that user can get the notification when new error is there
+ else:
+ feature.number_notification_sent = 0
+
+ feature.save()
+
+ if should_send_the_email:
# Build the subject and the emailbody.
self.subject = self.BuildEmailSubject()
self.emailbody = self.BuildEmailBody()
# Send the email.
self.SendEmail()
-
-
- # Finish
- return HttpResponse("200")
+ else:
+ logger.info("Skip sending email ")
"""
This function starts a logger to output information into syslog. It uses python default logger object.
"""
diff --git a/backend/src/backend/models.py b/backend/src/backend/models.py
index 3c917262..8eb50f4f 100755
--- a/backend/src/backend/models.py
+++ b/backend/src/backend/models.py
@@ -17,6 +17,7 @@
from django.dispatch import receiver
from django_cryptography.fields import encrypt
from crontab import CronSlices
+from django.core.validators import MinValueValidator, MaxValueValidator
# GLOBAL VARIABLES
@@ -778,6 +779,9 @@ class Feature(models.Model):
created_by = models.ForeignKey(OIDCAccount, on_delete=models.SET_NULL, null=True, default=None, related_name="created_by")
send_mail = models.BooleanField(default=False)
send_mail_on_error = models.BooleanField(default=False)
+ check_maximum_notification_on_error = models.BooleanField(default=False)
+ maximum_notification_on_error = models.IntegerField(default=0,validators=[MinValueValidator(0)])
+ number_notification_sent = models.IntegerField(default=0,validators=[MinValueValidator(0)])
attach_pdf_report_to_email = models.BooleanField(verbose_name="Enable or disable the option to attach PDFs to emails.", help_text="If true, a test result PDF will be attached to the email; otherwise, the email will be sent without the PDF. This is useful when sending emails with a customized template.", default=True)
do_not_use_default_template = models.BooleanField(verbose_name="Do not use Default e-Mail Template", help_text="If true, then the alternative template will be used, which can be used for creating customized e-Mails, e.g. only containing screenshot", default=False)
email_address = ArrayField(models.CharField(max_length=250), null=True, blank=True, default=list)
diff --git a/front/src/app/dialogs/edit-feature/edit-feature.component.html b/front/src/app/dialogs/edit-feature/edit-feature.component.html
index e6cea42e..147013a7 100755
--- a/front/src/app/dialogs/edit-feature/edit-feature.component.html
+++ b/front/src/app/dialogs/edit-feature/edit-feature.component.html
@@ -276,6 +276,20 @@ Clone feature
(blur)="onInputBlur()"
>
+
+ Maximum notifications on errors
+
+
+
+
When to send email:
Clone feature
>On error
+
+ Set maximum notifications on errors
Clone feature
mat-icon-button>
help_outline
+
diff --git a/front/src/app/dialogs/edit-feature/edit-feature.component.scss b/front/src/app/dialogs/edit-feature/edit-feature.component.scss
index 21bba533..78bb8fc3 100755
--- a/front/src/app/dialogs/edit-feature/edit-feature.component.scss
+++ b/front/src/app/dialogs/edit-feature/edit-feature.component.scss
@@ -43,7 +43,11 @@
}
.default_template {
- margin-left: 5%;
+ margin-left: 2%;
+}
+
+.maximum-notifications-check {
+ margin-left: 3%;
}
.report_to_email {
diff --git a/front/src/app/dialogs/edit-feature/edit-feature.component.ts b/front/src/app/dialogs/edit-feature/edit-feature.component.ts
index f812ffb0..0343ec7a 100755
--- a/front/src/app/dialogs/edit-feature/edit-feature.component.ts
+++ b/front/src/app/dialogs/edit-feature/edit-feature.component.ts
@@ -250,6 +250,8 @@ export class EditFeature implements OnInit, OnDestroy {
generate_dataset: [false],
need_help: [false],
send_mail_on_error: [false],
+ check_maximum_notification_on_error: [false],
+ maximum_notification_on_error: ['3'],
attach_pdf_report_to_email: [true],
do_not_use_default_template: [false],
continue_on_failure: [true],
@@ -635,6 +637,8 @@ export class EditFeature implements OnInit, OnDestroy {
'email_subject',
'email_body',
'send_mail_on_error',
+ 'maximum_notification_on_error',
+ 'check_maximum_notification_on_error',
'attach_pdf_report_to_email',
'do_not_use_default_template',
];
diff --git a/front/src/assets/config.json b/front/src/assets/config.json
index b215eaa6..2c9ae385 100755
--- a/front/src/assets/config.json
+++ b/front/src/assets/config.json
@@ -1,5 +1,5 @@
{
- "version": "3.0.2",
+ "version": "3.0.3",
"language": "en",
"appTitle": "co.meta",
"scenario": "dev",
@@ -232,6 +232,16 @@
"{Code is Poetry}"
],
"changelog": [
+ {
+ "version": "3.0.3",
+ "date": "2024-11-13",
+ "features": [
+ {
+ "title": "#4938 - Email report enhancement",
+ "description": "Email reporting enhanced to set the number of consecutive failure emails you want to receive. This option helps to avoid continuous failure notifications, so the user is not bombarded with excessive emails."
+ }
+ ]
+ },
{
"version": "3.0.2",
"date": "2024-10-09",
diff --git a/front/src/assets/i18n/en.json b/front/src/assets/i18n/en.json
index ec608541..cd842f34 100755
--- a/front/src/assets/i18n/en.json
+++ b/front/src/assets/i18n/en.json
@@ -40,6 +40,7 @@
"explanation": "Enabling this option allows other users to help you on this feature",
"edit_variable": "In this section, we can add or edit variables among other functionalities",
"default_template": "If Checked, then please provide your custom email template, which can be used for creating customized e-Mails, e.g. only containing screenshot. The default is false - to not change the actual behavior customers are using",
+ "maximum_notification_on_error": "If checked, please set the number of consecutive failure emails you want to receive. This option helps to avoid continuous failure notifications, so the user is not bombarded with excessive emails.",
"attach_pdf": "If Checked, PDF test result will be attached within the email, Other wise email without PDF will be sent. Useful when sending email with customized template"
},
"step-definition": {
diff --git a/front/src/assets/i18n/es.json b/front/src/assets/i18n/es.json
index 4fc1275b..93ced20e 100755
--- a/front/src/assets/i18n/es.json
+++ b/front/src/assets/i18n/es.json
@@ -157,6 +157,7 @@
"explanation": "Habilitar esta opción permite que otros usuarios te ayuden en esta característica",
"edit_variable": "En esta sección, podemos agregar o editar variables entre otras funcionalidades",
"default_template": "Si está marcado, proporcione su plantilla de correo electrónico personalizada, que se puede usar para crear correos electrónicos personalizados, por ejemplo, solo con capturas de pantalla. El valor predeterminado es falso: para no cambiar el comportamiento actual que usan los clientes.",
+ "maximum_notification_on_error":"Si está marcado, proporcione la cantidad de correos electrónicos de fallos consecutivos que desea recibir. Esta opción es útil para evitar notificaciones continuas de fallos, de modo que el usuario no sea bombardeado con correos electrónicos excesivos.",
"attach_pdf": "Si está marcado, se adjuntará el resultado de la prueba en PDF en el correo electrónico. De lo contrario, se enviará el correo electrónico sin PDF. Útil cuando se envía correo electrónico con plantilla personalizada."
},
"step-definition": {