mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-03 17:36:59 +01:00
Fix flaky alert message lookup
This commit is contained in:
parent
3b3fac98ad
commit
d555d2f3f6
1 changed files with 10 additions and 1 deletions
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -98,7 +99,15 @@ namespace BTCPayServer.Tests
|
|||
internal IWebElement FindAlertMessage(params StatusMessageModel.StatusSeverity[] severity)
|
||||
{
|
||||
var className = string.Join(", ", severity.Select(statusSeverity => $".alert-{StatusMessageModel.ToString(statusSeverity)}"));
|
||||
var el = Driver.FindElement(By.CssSelector(className)) ?? Driver.WaitForElement(By.CssSelector(className));
|
||||
IWebElement el;
|
||||
try
|
||||
{
|
||||
el = Driver.FindElement(By.CssSelector(className));
|
||||
}
|
||||
catch (NoSuchElementException)
|
||||
{
|
||||
el = Driver.WaitForElement(By.CssSelector(className));
|
||||
}
|
||||
if (el is null)
|
||||
throw new NoSuchElementException($"Unable to find {className}");
|
||||
return el;
|
||||
|
|
Loading…
Add table
Reference in a new issue