From 0096250384c618d8f5fbf202c5be7d475f417496 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 11 Sep 2019 15:58:38 +0900 Subject: [PATCH] Fix test --- BTCPayServer.Tests/SeleniumTester.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index d4d442536..8f988d00d 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -99,9 +99,7 @@ namespace BTCPayServer.Tests public string RegisterNewUser(bool isAdmin = false) { - GoToHome(); - if (Driver.PageSource.Contains("id=\"Logout\"")) - Logout(); + EnsureLogout(); var usr = RandomUtils.GetUInt256().ToString().Substring(20) + "@a.com"; Driver.FindElement(By.Id("Register")).Click(); Driver.FindElement(By.Id("Email")).SendKeys(usr); @@ -114,6 +112,13 @@ namespace BTCPayServer.Tests return usr; } + private void EnsureLogout() + { + GoToHome(); + if (Driver.PageSource.Contains("id=\"Logout\"")) + Logout(); + } + public (string storeName, string storeId) CreateNewStore() { var usr = "Store" + RandomUtils.GetUInt64().ToString(); @@ -205,10 +210,10 @@ namespace BTCPayServer.Tests public void Login(string user, string password) { + EnsureLogout(); Driver.FindElement(By.Id("Email")).SendKeys(user); Driver.FindElement(By.Id("Password")).SendKeys(password); Driver.FindElement(By.Id("LoginButton")).Click(); - } public void GoToStore(string storeId, StoreNavPages storeNavPage = StoreNavPages.Index)