Skip to content

Commit 3509689

Browse files
committed
Fix Razor Partial view load up and add another test to prove it
1 parent cdfdb2c commit 3509689

5 files changed

Lines changed: 95 additions & 4 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: dotnet clean
3232

3333
- name: Build projects
34-
run: dotnet build -c Release --no-restore
34+
run: dotnet build -c Release --no-restore
3535

3636
- name: Deterministic build check
3737
run: |

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "submodules/btcpayserver"]
22
path = submodules/btcpayserver
3-
url = https://github.com/btcpayserver/btcpayserver
3+
url = https://github.com/btcpayserver/btcpayserver

BTCPayServer.Plugins.IntegrationTests/Monero/MoneroPluginIntegrationTest.cs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,89 @@ public async Task EnableMoneroPluginSuccessfully()
9393
await s.Page.SelectOptionAsync("#SettlementConfirmationThresholdChoice", "3");
9494
await s.Page.ClickAsync("#SaveButton");
9595
}
96+
97+
[Fact]
98+
public async Task EnableMoneroPluginSuccessfullySecond()
99+
{
100+
await using var s = CreatePlaywrightTester();
101+
await s.StartAsync();
102+
103+
if (s.Server.PayTester.MockRates)
104+
{
105+
var rateProviderFactory = s.Server.PayTester.GetService<RateProviderFactory>();
106+
rateProviderFactory.Providers.Clear();
107+
108+
var coinAverageMock = new MockRateProvider();
109+
coinAverageMock.ExchangeRates.Add(new PairRate(CurrencyPair.Parse("BTC_USD"), new BidAsk(5000m)));
110+
coinAverageMock.ExchangeRates.Add(new PairRate(CurrencyPair.Parse("BTC_EUR"), new BidAsk(4000m)));
111+
coinAverageMock.ExchangeRates.Add(new PairRate(CurrencyPair.Parse("XMR_BTC"), new BidAsk(4500m)));
112+
rateProviderFactory.Providers.Add("coingecko", coinAverageMock);
113+
114+
var kraken = new MockRateProvider();
115+
kraken.ExchangeRates.Add(new PairRate(CurrencyPair.Parse("BTC_USD"), new BidAsk(0.1m)));
116+
kraken.ExchangeRates.Add(new PairRate(CurrencyPair.Parse("XMR_USD"), new BidAsk(0.1m)));
117+
kraken.ExchangeRates.Add(new PairRate(CurrencyPair.Parse("XMR_BTC"), new BidAsk(0.1m)));
118+
rateProviderFactory.Providers.Add("kraken", kraken);
119+
}
120+
121+
await s.RegisterNewUser(true);
122+
await s.CreateNewStore(preferredExchange: "Kraken");
123+
await s.Page.Locator("a.nav-link[href*='monerolike/XMR']").ClickAsync();
124+
await s.Page.Locator("input#PrimaryAddress").FillAsync("43Pnj6ZKGFTJhaLhiecSFfLfr64KPJZw7MyGH73T6PTDekBBvsTAaWEUSM4bmJqDuYLizhA13jQkMRPpz9VXBCBqQQb6y5L");
125+
await s.Page.Locator("input#PrivateViewKey").FillAsync("1bfa03b0c78aa6bc8292cf160ec9875657d61e889c41d0ebe5c54fd3a2c4b40e");
126+
await s.Page.Locator("input#RestoreHeight").FillAsync("0");
127+
await s.Page.Locator("input#WalletPassword").FillAsync("pass123");
128+
await s.Page.ClickAsync("button[name='command'][value='set-wallet-details']");
129+
await s.Page.CheckAsync("#Enabled");
130+
await s.Page.SelectOptionAsync("#SettlementConfirmationThresholdChoice", "2");
131+
await s.Page.ClickAsync("#SaveButton");
132+
var classList = await s.Page.Locator("svg.icon-checkmark").GetAttributeAsync("class");
133+
Assert.Contains("text-success", classList);
134+
135+
// Set rate provider
136+
await s.Page.Locator("#StoreNav-General").ClickAsync();
137+
await s.Page.Locator("#mainNav #StoreNav-Rates").ClickAsync();
138+
await s.Page.FillAsync("#DefaultCurrencyPairs", "BTC_USD,XMR_USD,XMR_BTC");
139+
await s.Page.SelectOptionAsync("#PrimarySource_PreferredExchange", "kraken");
140+
await s.Page.Locator("#page-primary").ClickAsync();
141+
142+
// Generate a new invoice
143+
await s.Page.Locator("a.nav-link[href*='invoices']").ClickAsync();
144+
await s.Page.Locator("#page-primary").ClickAsync();
145+
await s.Page.FillAsync("#Amount", "4.20");
146+
await s.Page.FillAsync("#BuyerEmail", "monero@monero.com");
147+
await Task.Delay(TimeSpan.FromSeconds(25)); // wallet-rpc needs some time to sync. refactor this later
148+
await s.Page.Locator("#page-primary").ClickAsync();
149+
150+
// View the invoice
151+
var href = await s.Page.Locator("a[href^='/i/']").GetAttributeAsync("href");
152+
var invoiceId = href?.Split("/i/").Last();
153+
await s.Page.Locator($"a[href='/i/{invoiceId}']").ClickAsync();
154+
await s.Page.ClickAsync("#DetailsToggle");
155+
156+
// Verify the total fiat amount is $4.20
157+
var totalFiat = await s.Page.Locator("#PaymentDetails-TotalFiat dd.clipboard-button").InnerTextAsync();
158+
Assert.Equal("$4.20", totalFiat);
159+
160+
await s.Page.GoBackAsync();
161+
await s.Page.Locator("a.nav-link[href*='monerolike/XMR']").ClickAsync();
162+
163+
// Create a new account label
164+
await s.Page.FillAsync("#NewAccountLabel", "tst-account");
165+
await s.Page.ClickAsync("button[name='command'][value='add-account']");
166+
167+
// Select primary Account Index
168+
await s.Page.Locator("a.nav-link[href*='monerolike/XMR']").ClickAsync();
169+
await s.Page.SelectOptionAsync("#AccountIndex", "1");
170+
await s.Page.ClickAsync("#SaveButton");
171+
172+
// Verify selected account index
173+
await s.Page.Locator("a.nav-link[href*='monerolike/XMR']").ClickAsync();
174+
var selectedValue = await s.Page.Locator("#AccountIndex").InputValueAsync();
175+
Assert.Equal("1", selectedValue);
176+
177+
// Select confirmation time to 0
178+
await s.Page.SelectOptionAsync("#SettlementConfirmationThresholdChoice", "3");
179+
await s.Page.ClickAsync("#SaveButton");
180+
}
96181
}

BTCPayServer.Plugins.IntegrationTests/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ services:
8989
- "bitcoin_datadir:/data"
9090

9191
monerod:
92-
image: btcpayserver/monero:0.18.4.2
92+
image: btcpayserver/monero:0.18.4.3
9393
restart: unless-stopped
9494
container_name: monerod
9595
command: monerod --fixed-difficulty 1 --log-level=2 --rpc-bind-ip=0.0.0.0 --confirm-external-bind --rpc-bind-port=18081 --block-notify="/bin/sh ./scripts/notifier.sh -k -X GET https://host.docker.internal:14142/monerolikedaemoncallback/block?cryptoCode=xmr&hash=%s" --regtest --no-igd --hide-my-port --offline --non-interactive
@@ -99,7 +99,7 @@ services:
9999
- "18081:18081"
100100

101101
xmr_wallet:
102-
image: btcpayserver/monero:0.18.4.2
102+
image: btcpayserver/monero:0.18.4.3
103103
restart: unless-stopped
104104
container_name: xmr_wallet
105105
command: monero-wallet-rpc --log-level 2 --allow-mismatched-daemon-version --rpc-bind-ip=0.0.0.0 --disable-rpc-login --confirm-external-bind --rpc-bind-port=18082 --non-interactive --trusted-daemon --daemon-address=monerod:18081 --wallet-dir=/wallet --tx-notify="/bin/sh ./scripts/notifier.sh -k -X GET https://host.docker.internal:14142/monerolikedaemoncallback/tx?cryptoCode=xmr&hash=%s"

global.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sdk": {
3+
"version": "8.0.416",
4+
"rollForward": "latestFeature"
5+
}
6+
}

0 commit comments

Comments
 (0)