Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="Docker.DotNet" Version="3.125.15" />
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Microsoft.Playwright" Version="1.52.0" />
<PackageReference Include="Microsoft.Playwright" Version="1.57.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1">
<PrivateAssets>all</PrivateAssets>
Expand Down
3 changes: 1 addition & 2 deletions BTCPayServer.Plugins.IntegrationTests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ ARG MONERO_PLUGIN_FOLDER=/root/.btcpayserver/Plugins/BTCPayServer.Plugins.Monero
RUN mkdir -p ${MONERO_PLUGIN_FOLDER}
RUN cd Plugins/Monero && dotnet build BTCPayServer.Plugins.Monero.sln --configuration ${CONFIGURATION_NAME} /p:RazorCompileOnBuild=true --output ${MONERO_PLUGIN_FOLDER}
RUN cd BTCPayServer.Plugins.IntegrationTests && dotnet build --configuration ${CONFIGURATION_NAME} /p:CI_TESTS=true /p:RazorCompileOnBuild=true
RUN dotnet tool install --global Microsoft.Playwright.CLI
RUN dotnet tool install --global JetBrains.DotCover.CommandLineTools --version 2025.1.6
ENV PATH="$PATH:/root/.dotnet/tools"
RUN playwright install chromium --with-deps
RUN pwsh /source/BTCPayServer.Plugins.IntegrationTests/bin/Release/net8.0/playwright.ps1 install chromium --with-deps
WORKDIR /source/BTCPayServer.Plugins.IntegrationTests
ENV CONFIGURATION_NAME=${CONFIGURATION_NAME}
ENTRYPOINT ["./docker-entrypoint.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,38 @@ namespace BTCPayServer.Plugins.IntegrationTests.Monero;

public static class IntegrationTestUtils
{

private static readonly ILogger Logger = LoggerFactory
.Create(builder => builder.AddConsole())
.CreateLogger("IntegrationTestUtils");

private static readonly string ContainerWalletDir =
Environment.GetEnvironmentVariable("BTCPAY_XMR_WALLET_DAEMON_WALLETDIR") ?? "/wallet";

public static async Task CleanUpAsync(PlaywrightTester playwrightTester)
public static async Task CleanUpAsync(PlaywrightTester playwrightTester, bool deleteWalletFiles = true)
{
MoneroRpcProvider moneroRpcProvider = playwrightTester.Server.PayTester.GetService<MoneroRpcProvider>();
if (moneroRpcProvider.IsAvailable("XMR"))
{
await moneroRpcProvider.CloseWallet("XMR");
}
var moneroRpcProvider = playwrightTester.Server.PayTester.GetService<MoneroRpcProvider>();
await moneroRpcProvider.CloseWallet("XMR");

var walletService = playwrightTester.Server.PayTester.GetService<MoneroWalletService>();
walletService.GetWalletState().IsConnected = false;

if (playwrightTester.Server.PayTester.InContainer)
{
DeleteWalletInContainer();
if (deleteWalletFiles)
{
moneroRpcProvider.DeleteAllWallets();
}
await DropDatabaseAsync(
"btcpayserver",
"Host=postgres;Port=5432;Username=postgres;Database=postgres");
}
else
{
await RemoveWalletFromLocalDocker();
if (deleteWalletFiles)
{
await RemoveWalletFromLocalDocker();
}
await DropDatabaseAsync(
"btcpayserver",
"Host=localhost;Port=39372;Username=postgres;Database=postgres");
Expand Down

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions Plugins/Monero/Configuration/MoneroWalletState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;

namespace BTCPayServer.Plugins.Monero.Configuration
{
public class MoneroWalletState
{
public string ActiveWalletAddress { get; set; }

public string ActiveWalletName => ActiveWalletAddress != null && Wallets.TryGetValue(ActiveWalletAddress, out var name) ? name : null;

public DateTimeOffset? LastActivatedAt { get; set; }

public bool IsInitialized => !string.IsNullOrEmpty(ActiveWalletAddress);

public bool IsConnected { get; set; }

public bool PasswordFileMigration { get; set; }

public Dictionary<string, string> Wallets { get; set; } = [];
}
}
Loading
Loading