Testing happy messages, fix approval button

This commit is contained in:
nicolas.dorier
2019-11-16 15:20:54 +09:00
parent 8ebac28ccf
commit c83bcd259d
3 changed files with 10 additions and 4 deletions

View File

@@ -70,6 +70,11 @@ namespace BTCPayServer.Tests
Driver.AssertNoError();
}
internal void AssertHappyMessage()
{
Assert.Single(Driver.FindElements(By.ClassName("alert-success")).Where(el => el.Displayed));
}
public static readonly TimeSpan ImplicitWait = TimeSpan.FromSeconds(10);
public string Link(string relativeLink)
{
@@ -110,8 +115,7 @@ namespace BTCPayServer.Tests
Driver.FindElement(By.ClassName("store-derivation-scheme")).SendKeys(derivationScheme);
Driver.FindElement(By.Id("Continue")).ForceClick();
Driver.FindElement(By.Id("Confirm")).ForceClick();
Driver.FindElement(By.Id("Save")).ForceClick();
return;
AssertHappyMessage();
}
public void AddLightningNode(string cryptoCode, LightningConnectionType connectionType)

View File

@@ -46,6 +46,7 @@ namespace BTCPayServer.Tests
Assert.Contains(passEl.Text, "hellorockstar", StringComparison.OrdinalIgnoreCase);
s.Driver.FindElement(By.Id("delete")).Click();
s.Driver.FindElement(By.Id("continue")).Click();
s.AssertHappyMessage();
seedEl = s.Driver.FindElement(By.Id("SeedTextArea"));
Assert.Contains("Seed removed", seedEl.Text, StringComparison.OrdinalIgnoreCase);
@@ -219,6 +220,7 @@ namespace BTCPayServer.Tests
s.ClickOnAllSideMenus();
s.GoToInvoices();
s.CreateInvoice(store);
s.AssertHappyMessage();
s.Driver.FindElement(By.ClassName("invoice-details-link")).Click();
var invoiceUrl = s.Driver.Url;
@@ -280,10 +282,10 @@ namespace BTCPayServer.Tests
s.Driver.FindElement(By.Id("Tokens")).Click();
s.Driver.FindElement(By.Id("CreateNewToken")).Click();
s.Driver.FindElement(By.Id("RequestPairing")).Click();
string pairingCode = AssertUrlHasPairingCode(s);
s.Driver.FindElement(By.Id("ApprovePairing")).Click();
s.AssertHappyMessage();
Assert.Contains(pairingCode, s.Driver.PageSource);
var client = new NBitpayClient.Bitpay(new Key(), s.Server.PayTester.ServerUri);

View File

@@ -38,7 +38,7 @@
<span asp-validation-for="StoreId" class="text-danger"></span>
</div>
<input type="hidden" name="pairingCode" value="@Model.Id" />
<button id="ApprovePairing" type="submit" class="btn btn-secondary" title="Approve this pairing demand">Approve</button>
<button id="ApprovePairing" type="submit" class="btn btn-primary" title="Approve this pairing demand">Approve</button>
</form>
</div>
<div class="col-md-4"></div>