mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Fixing Selenium tests
This commit is contained in:
@@ -855,8 +855,7 @@ namespace BTCPayServer.Tests
|
|||||||
s.GoToStore(StoreNavPages.Emails);
|
s.GoToStore(StoreNavPages.Emails);
|
||||||
s.Driver.FindElement(By.Id("ConfigureEmailRules")).Click();
|
s.Driver.FindElement(By.Id("ConfigureEmailRules")).Click();
|
||||||
Assert.Contains("There are no rules yet.", s.Driver.PageSource);
|
Assert.Contains("There are no rules yet.", s.Driver.PageSource);
|
||||||
// by default selenium tests setup email server settings
|
Assert.Contains("You need to configure email settings before this feature works", s.Driver.PageSource);
|
||||||
Assert.DoesNotContain("You need to configure email settings before this feature works", s.Driver.PageSource);
|
|
||||||
|
|
||||||
// invoice created rule
|
// invoice created rule
|
||||||
s.Driver.FindElement(By.Id("CreateEmailRule")).Click();
|
s.Driver.FindElement(By.Id("CreateEmailRule")).Click();
|
||||||
@@ -906,13 +905,11 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.True(deleteLinks.Count == 2, "Expected exactly two delete buttons but found a different number.");
|
Assert.True(deleteLinks.Count == 2, "Expected exactly two delete buttons but found a different number.");
|
||||||
|
|
||||||
deleteLinks[0].Click();
|
deleteLinks[0].Click();
|
||||||
s.Driver.SwitchTo().Alert().Accept(); // Confirm the delete
|
|
||||||
|
|
||||||
deleteLinks = s.Driver.FindElements(By.XPath("//a[contains(text(), 'Delete')]")); // Refresh list
|
deleteLinks = s.Driver.FindElements(By.XPath("//a[contains(text(), 'Delete')]")); // Refresh list
|
||||||
Assert.True(deleteLinks.Count == 1, "Expected one delete button remaining.");
|
Assert.True(deleteLinks.Count == 1, "Expected one delete button remaining.");
|
||||||
|
|
||||||
deleteLinks[0].Click();
|
deleteLinks[0].Click();
|
||||||
s.Driver.SwitchTo().Alert().Accept(); // Confirm the second delete
|
|
||||||
|
|
||||||
// Validate that there are no more rules
|
// Validate that there are no more rules
|
||||||
Assert.Contains("There are no rules yet.", s.Driver.PageSource);
|
Assert.Contains("There are no rules yet.", s.Driver.PageSource);
|
||||||
@@ -3960,7 +3957,6 @@ retry:
|
|||||||
s.Server.ActivateLightning();
|
s.Server.ActivateLightning();
|
||||||
await s.StartAsync();
|
await s.StartAsync();
|
||||||
await s.Server.EnsureChannelsSetup();
|
await s.Server.EnsureChannelsSetup();
|
||||||
var storeSettingsPaths = new [] {"settings", "rates", "checkout", "tokens", "users", "roles", "webhooks", "payout-processors", "payout-processors/onchain-automated/BTC", "payout-processors/lightning-automated/BTC", "emails", "email-settings", "forms"};
|
|
||||||
|
|
||||||
// Setup user, store and wallets
|
// Setup user, store and wallets
|
||||||
s.RegisterNewUser();
|
s.RegisterNewUser();
|
||||||
@@ -3993,6 +3989,10 @@ retry:
|
|||||||
s.AssertPageAccess(false, GetStorePath("lightning/BTC"));
|
s.AssertPageAccess(false, GetStorePath("lightning/BTC"));
|
||||||
s.AssertPageAccess(false, GetStorePath("lightning/BTC/settings"));
|
s.AssertPageAccess(false, GetStorePath("lightning/BTC/settings"));
|
||||||
s.AssertPageAccess(false, GetStorePath("apps/create"));
|
s.AssertPageAccess(false, GetStorePath("apps/create"));
|
||||||
|
|
||||||
|
var storeSettingsPaths = new [] {"settings", "rates", "checkout", "tokens", "users", "roles", "webhooks",
|
||||||
|
"payout-processors", "payout-processors/onchain-automated/BTC", "payout-processors/lightning-automated/BTC",
|
||||||
|
"emails/rules", "email-settings", "forms"};
|
||||||
foreach (var path in storeSettingsPaths)
|
foreach (var path in storeSettingsPaths)
|
||||||
{ // should have view access to settings, but no submit buttons or create links
|
{ // should have view access to settings, but no submit buttons or create links
|
||||||
TestLogs.LogInformation($"Checking access to store page {path} as admin");
|
TestLogs.LogInformation($"Checking access to store page {path} as admin");
|
||||||
@@ -4013,7 +4013,8 @@ retry:
|
|||||||
s.Server.ActivateLightning();
|
s.Server.ActivateLightning();
|
||||||
await s.StartAsync();
|
await s.StartAsync();
|
||||||
await s.Server.EnsureChannelsSetup();
|
await s.Server.EnsureChannelsSetup();
|
||||||
var storeSettingsPaths = new [] {"settings", "rates", "checkout", "tokens", "users", "roles", "webhooks", "payout-processors", "payout-processors/onchain-automated/BTC", "payout-processors/lightning-automated/BTC", "emails", "email-settings", "forms"};
|
var storeSettingsPaths = new [] {"settings", "rates", "checkout", "tokens", "users", "roles", "webhooks", "payout-processors",
|
||||||
|
"payout-processors/onchain-automated/BTC", "payout-processors/lightning-automated/BTC", "emails/rules", "email-settings", "forms"};
|
||||||
|
|
||||||
// Setup users
|
// Setup users
|
||||||
var manager = s.RegisterNewUser();
|
var manager = s.RegisterNewUser();
|
||||||
|
|||||||
@@ -523,6 +523,8 @@ namespace BTCPayServer.Services
|
|||||||
"Email password reset functionality is not configured for this server. Please contact the server administrator to assist with account recovery.": "",
|
"Email password reset functionality is not configured for this server. Please contact the server administrator to assist with account recovery.": "",
|
||||||
"email rules": "",
|
"email rules": "",
|
||||||
"Email Rules": "",
|
"Email Rules": "",
|
||||||
|
"Create Email Rule": "",
|
||||||
|
"Edit Email Rule": "",
|
||||||
"Email rules allow BTCPay Server to send customized emails from your store based on events.": "",
|
"Email rules allow BTCPay Server to send customized emails from your store based on events.": "",
|
||||||
"Email sent to {0}. Please verify you received it.": "",
|
"Email sent to {0}. Please verify you received it.": "",
|
||||||
"Email Server": "",
|
"Email Server": "",
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
<a asp-action="EmailRulesEdit" asp-route-storeId="@storeId" asp-route-ruleIndex="@rule.index">Edit</a>
|
<a asp-action="EmailRulesEdit" asp-route-storeId="@storeId" asp-route-ruleIndex="@rule.index">Edit</a>
|
||||||
-
|
-
|
||||||
<form asp-action="EmailRulesDelete" asp-route-storeId="@storeId" asp-route-ruleIndex="@rule.index" method="post" style="display:inline;">
|
<form asp-action="EmailRulesDelete" asp-route-storeId="@storeId" asp-route-ruleIndex="@rule.index" method="post" style="display:inline;">
|
||||||
<a href="#" class="text-danger" onclick="event.preventDefault(); if (confirm('Are you sure you want to delete this email rule?')) this.closest('form').submit();">Delete</a>
|
<a href="#" class="text-danger" onclick="event.preventDefault(); this.closest('form').submit();">Delete</a>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
@{
|
@{
|
||||||
var storeId = Context.GetStoreData().Id;
|
var storeId = Context.GetStoreData().Id;
|
||||||
bool isEdit = Model.Trigger != null;
|
bool isEdit = Model.Trigger != null;
|
||||||
ViewData["Title"] = isEdit ? "Edit Store Email Rule" : "Create Store Email Rule";
|
ViewData.SetActivePage(StoreNavPages.Emails, StringLocalizer[isEdit ? "Edit Email Rule" : "Create Email Rule"], storeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@section PageHeadContent {
|
@section PageHeadContent {
|
||||||
|
|||||||
Reference in New Issue
Block a user