fix CanExportInvoicesJson

This commit is contained in:
Kukks 2022-08-26 11:22:00 +02:00 committed by Andrew Camilleri
parent 0098dacdff
commit 5d2b42960b
3 changed files with 15 additions and 9 deletions

View File

@ -447,9 +447,12 @@ namespace BTCPayServer.Tests
s.AddDerivationScheme();
s.GoToInvoices();
var i = s.CreateInvoice();
s.GoToInvoiceCheckout(i);
s.PayInvoice(true);
TestUtils.Eventually(() => s.Driver.FindElement(By.LinkText("View receipt")).Click());
await s.Server.PayTester.InvoiceRepository.MarkInvoiceStatus(i, InvoiceStatus.Settled);
TestUtils.Eventually(() =>
{
s.Driver.Navigate().Refresh();
s.Driver.FindElement(By.Id($"Receipt")).Click();
});
TestUtils.Eventually(() =>
{
s.Driver.Navigate().Refresh();
@ -472,7 +475,11 @@ namespace BTCPayServer.Tests
s.GoToInvoiceCheckout(i);
var checkouturi = s.Driver.Url;
s.PayInvoice();
TestUtils.Eventually(() => s.Driver.FindElement(By.LinkText("View receipt")).Click());
TestUtils.Eventually(() =>
{
s.Driver.Navigate().Refresh();
s.Driver.FindElement(By.Id("receipt-btn")).Click();
});
TestUtils.Eventually(() =>
{
s.Driver.Navigate().Refresh();
@ -483,7 +490,7 @@ namespace BTCPayServer.Tests
await s.Server.PayTester.InvoiceRepository.MarkInvoiceStatus(i, InvoiceStatus.Settled);
TestUtils.Eventually(() => s.Driver.FindElement(By.LinkText("View receipt")).Click());
TestUtils.Eventually(() => s.Driver.FindElement(By.Id("receipt-btn")).Click());
TestUtils.Eventually(() =>
{
s.Driver.Navigate().Refresh();

View File

@ -1765,11 +1765,10 @@ namespace BTCPayServer.Tests
}, Facade.Merchant);
var networkFee = new FeeRate(invoice.MinerFees["BTC"].SatoshiPerBytes).GetFee(100);
// ensure 0 invoices exported because there are no payments yet
var jsonResult = user.GetController<UIInvoiceController>().Export("json").GetAwaiter().GetResult();
var result = Assert.IsType<ContentResult>(jsonResult);
Assert.Equal("application/json", result.ContentType);
Assert.Equal("[]", result.Content);
Assert.Equal(1, JArray.Parse(result.Content).Count);
var cashCow = tester.ExplorerNode;
var invoiceAddress = BitcoinAddress.Create(invoice.CryptoInfo[0].Address, cashCow.Network);

View File

@ -206,10 +206,10 @@
<div class="success-message">{{$t("This invoice has been paid")}}</div>
<a class="action-button" :href="srvModel.merchantRefLink" v-if="!isModal && srvModel.merchantRefLink">
<span v-if="srvModel.receiptLink != srvModel.merchantRefLink" v-html="$t('Return to StoreName', srvModel)"></span>
<span v-else v-html="$t('View receipt')"></span>
<span v-else v-html="$t('View receipt')" id="receipt-btn"></span>
</a>
<a class="action-button" :href="srvModel.receiptLink" :target="isModal?'_blank':'_top'" v-if="srvModel.receiptLink && (srvModel.merchantRefLink != srvModel.receiptLink) || isModal">
<span v-html="$t('View receipt')"></span>
<span v-html="$t('View receipt')" id="receipt-btn"></span>
</a>
<button class="action-button close-action" v-show="isModal" v-on:click="close">
<span v-html="$t('Close')"></span>