mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 05:54:26 +01:00
(Refactor): Removed Selenium Test for CanAccessUserStoreAsAdmin
Signed-off-by: Abhijay jain <Abhijay007j@gmail.com>
This commit is contained in:
@@ -1567,62 +1567,6 @@ retry:
|
|||||||
Assert.DoesNotContain(Policies.CanModifyServerSettings,s.Driver.PageSource);
|
Assert.DoesNotContain(Policies.CanModifyServerSettings,s.Driver.PageSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Selenium", "Selenium")]
|
|
||||||
[Trait("Lightning", "Lightning")]
|
|
||||||
public async Task CanAccessUserStoreAsAdmin()
|
|
||||||
{
|
|
||||||
using var s = CreateSeleniumTester(newDb: true);
|
|
||||||
s.Server.ActivateLightning();
|
|
||||||
await s.StartAsync();
|
|
||||||
await s.Server.EnsureChannelsSetup();
|
|
||||||
|
|
||||||
// Setup user, store and wallets
|
|
||||||
s.RegisterNewUser();
|
|
||||||
(_, string storeId) = s.CreateNewStore();
|
|
||||||
s.GoToStore();
|
|
||||||
s.GenerateWallet(isHotWallet: true);
|
|
||||||
s.AddLightningNode(LightningConnectionType.CLightning, false);
|
|
||||||
|
|
||||||
// Add apps
|
|
||||||
(_, string _) = s.CreateApp("PointOfSale");
|
|
||||||
(_, string _) = s.CreateApp("Crowdfund");
|
|
||||||
s.Logout();
|
|
||||||
|
|
||||||
// Setup admin and check access
|
|
||||||
s.GoToRegister();
|
|
||||||
s.RegisterNewUser(true);
|
|
||||||
string GetStorePath(string subPath) => $"/stores/{storeId}/{subPath}";
|
|
||||||
|
|
||||||
// Admin access
|
|
||||||
s.AssertPageAccess(false, GetStorePath(""));
|
|
||||||
s.AssertPageAccess(true, GetStorePath("reports"));
|
|
||||||
s.AssertPageAccess(true, GetStorePath("invoices"));
|
|
||||||
s.AssertPageAccess(false, GetStorePath("invoices/create"));
|
|
||||||
s.AssertPageAccess(true, GetStorePath("payment-requests"));
|
|
||||||
s.AssertPageAccess(false, GetStorePath("payment-requests/edit"));
|
|
||||||
s.AssertPageAccess(true, GetStorePath("pull-payments"));
|
|
||||||
s.AssertPageAccess(true, GetStorePath("payouts"));
|
|
||||||
s.AssertPageAccess(false, GetStorePath("onchain/BTC"));
|
|
||||||
s.AssertPageAccess(false, GetStorePath("onchain/BTC/settings"));
|
|
||||||
s.AssertPageAccess(false, GetStorePath("lightning/BTC"));
|
|
||||||
s.AssertPageAccess(false, GetStorePath("lightning/BTC/settings"));
|
|
||||||
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)
|
|
||||||
{ // should have view access to settings, but no submit buttons or create links
|
|
||||||
TestLogs.LogInformation($"Checking access to store page {path} as admin");
|
|
||||||
s.AssertPageAccess(true, $"stores/{storeId}/{path}");
|
|
||||||
if (path != "payout-processors")
|
|
||||||
{
|
|
||||||
s.Driver.ElementDoesNotExist(By.CssSelector("#mainContent .btn-primary"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[Trait("Selenium", "Selenium")]
|
[Trait("Selenium", "Selenium")]
|
||||||
public async Task CanChangeUserRoles()
|
public async Task CanChangeUserRoles()
|
||||||
|
|||||||
Reference in New Issue
Block a user