Seed-lookup related test fixes

This commit is contained in:
Dennis Reimann 2020-07-15 23:58:18 +02:00
parent cfef1f3432
commit 188774f30a
No known key found for this signature in database
GPG key ID: 5009E1797F03F8D0
3 changed files with 11 additions and 4 deletions

View file

@ -130,11 +130,16 @@ namespace BTCPayServer.Tests
Driver.WaitForElement(By.CssSelector($"#ScriptPubKeyType option[value={format}]")).Click();
Logs.Tester.LogInformation("Trying to click btn-generate");
Driver.WaitForElement(By.Id("btn-generate")).ForceClick();
// Seed backup page
AssertHappyMessage();
if (string.IsNullOrEmpty(seed))
{
seed = Driver.FindElements(By.ClassName("alert-success")).First().FindElement(By.TagName("code")).Text;
seed = Driver.FindElements(By.Id("recovery-phrase")).First().GetAttribute("data-mnemonic");
}
// Confirm seed backup
Driver.FindElement(By.Id("confirm")).Click();
Driver.FindElement(By.Id("submit")).Click();
WalletId = new WalletId(StoreId, cryptoCode);
return new Mnemonic(seed);
}

View file

@ -669,8 +669,10 @@ namespace BTCPayServer.Tests
s.Driver.FindElement(By.Id("SettingsMenu")).ForceClick();
s.Driver.FindElement(By.CssSelector("button[value=view-seed]")).Click();
// Seed backup page
s.AssertHappyMessage();
Assert.Equal(mnemonic.ToString(), s.Driver.FindElements(By.ClassName("alert-success")).First().FindElement(By.TagName("code")).Text);
var recoveryPhrase = s.Driver.FindElements(By.Id("recovery-phrase")).First().GetAttribute("data-mnemonic");
Assert.Equal(mnemonic.ToString(), recoveryPhrase);
}
}
void SetTransactionOutput(SeleniumTester s, int index, BitcoinAddress dest, decimal amount, bool subtract = false)

View file

@ -35,7 +35,7 @@
</div>
</div>
<ol class="my-5 d-flex flex-wrap justify-content-center align-items-center p-0" style="max-width:800px">
<ol id="recovery-phrase" data-mnemonic="@Model.Mnemonic" class="my-5 d-flex flex-wrap justify-content-center align-items-center p-0" style="max-width:800px">
@foreach (var word in Model.Words)
{
<li class="ml-4 p-3 text-secondary" style="flex: 0 1 11em">
@ -52,7 +52,7 @@
<form id="recoveryConfirmation" action="@Model.ReturnUrl" class="d-flex align-items-center justify-content-center" style="padding-bottom: 80px">
<label class="form-check-label lead order-2" for="confirm">I have saved my recovery phrase in a secure location</label>
<input type="checkbox" class="mr-3 order-1" id="confirm">
<button type="submit" class="btn btn-primary btn-lg px-5 order-3">Done</button>
<button type="submit" class="btn btn-primary btn-lg px-5 order-3" id="submit">Done</button>
<button type="submit" class="btn btn-primary btn-lg px-5 order-3" disabled>Done</button>
</form>
</div>