internal async Task ExpectImplAsync(string expression, FrameExpectOptions expectOptions, object expected, string message) { if (expectOptions.Timeout == null) { expectOptions.Timeout = 5_000; } if (expectOptions.IsNot) { message = message.Replace("expected to", "expected not to"); } var result = await ActualLocator.ExpectAsync(expression, expectOptions).ConfigureAwait(false); if (result.Matches == IsNot) { var actual = result.Received; var log = string.Join("\n", result.Log); if (!string.IsNullOrEmpty(log)) { log = "\nCall log:\n" + log; } if (expected == null) { throw new PlaywrightException($"{message} {log}"); } throw new PlaywrightException($"{message} '{FormatValue(expected)}'\nBut was: '{FormatValue(actual)}' {log}"); } }
internal async Task ExpectImplAsync(string expression, ExpectedTextValue[] expectedText, object expected, string message, FrameExpectOptions options) { options = options ?? new(); options.ExpectedText = expectedText; options.IsNot = IsNot; await ExpectImplAsync(expression, options, expected, message).ConfigureAwait(false); }
internal Task <FrameExpectResult> ExpectAsync(string expression, FrameExpectOptions options = null) => _frame.ExpectAsync( _selector, expression, options);
internal async Task ExpectImplAsync(string expression, ExpectedTextValue textValue, object expected, string message, FrameExpectOptions options) { await ExpectImplAsync(expression, new ExpectedTextValue[] { textValue }, expected, message, options).ConfigureAwait(false); }
private Task ExpectTrueAsync(string expression, string message, FrameExpectOptions options) { ExpectedTextValue[] expectedText = null; return(ExpectImplAsync(expression, expectedText, null, message, options)); }