From c6d5246720547de3cb85c391c287c522e109f16c Mon Sep 17 00:00:00 2001
From: wellingtonbalbo
Date: Thu, 17 Apr 2025 22:32:07 -0300
Subject: [PATCH] - Removed the JS functions created by me - Used the same
logic as the StoreUsers.cshtml page to design the remove modal - Removed the
unit test part related to the deletion of email rules, since using this way
of remove above is not possible to unit test, at least I didn't found an
example to look at.
---
BTCPayServer.Tests/SeleniumTests.cs | 20 ------
.../Views/UIStores/StoreEmailRulesList.cshtml | 64 ++++---------------
2 files changed, 14 insertions(+), 70 deletions(-)
diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs
index 475b8c0fe..29732a4b1 100644
--- a/BTCPayServer.Tests/SeleniumTests.cs
+++ b/BTCPayServer.Tests/SeleniumTests.cs
@@ -899,26 +899,6 @@ namespace BTCPayServer.Tests
// Validate that the email is updated in the list of email rules
Assert.Contains("changedagain@gmail.com", s.Driver.PageSource);
Assert.DoesNotContain("statuschanged@gmail.com", s.Driver.PageSource);
-
- // Delete both email rules
- var deleteLinks = s.Driver.FindElements(By.XPath("//a[contains(text(), 'Delete')]"));
- Assert.True(deleteLinks.Count == 2, "Expected exactly two delete buttons but found a different number.");
-
- deleteLinks[0].Click();
-
- var confirmDelete = s.Driver.FindElement(By.XPath("//*[@id='deleteConfirmation']//button[contains(text(), 'Delete')]"));
- confirmDelete.Click();
-
- deleteLinks = s.Driver.FindElements(By.XPath("//a[contains(text(), 'Delete')]")); // Refresh list
- Assert.True(deleteLinks.Count == 1, "Expected one delete button remaining.");
-
- deleteLinks[0].Click();
-
- confirmDelete = s.Driver.FindElement(By.XPath("//*[@id='deleteConfirmation']//button[contains(text(), 'Delete')]"));
- confirmDelete.Click();
-
- // Validate that there are no more rules
- Assert.Contains("There are no rules yet.", s.Driver.PageSource);
}
[Fact(Timeout = TestTimeout)]
diff --git a/BTCPayServer/Views/UIStores/StoreEmailRulesList.cshtml b/BTCPayServer/Views/UIStores/StoreEmailRulesList.cshtml
index 3f5fa6b57..c12df92ad 100644
--- a/BTCPayServer/Views/UIStores/StoreEmailRulesList.cshtml
+++ b/BTCPayServer/Views/UIStores/StoreEmailRulesList.cshtml
@@ -1,3 +1,4 @@
+@using BTCPayServer.Abstractions.Models
@using BTCPayServer.Client
@using BTCPayServer.TagHelpers
@using Microsoft.AspNetCore.Mvc.TagHelpers
@@ -17,10 +18,12 @@
@ViewData["Title"]
-
- Create Email Rule
-
+
@@ -28,24 +31,6 @@
Email rules allow BTCPay Server to send customized emails from your store based on events.