Skip to content

Commit

Permalink
Tests - Add failing test for issue 4621
Browse files Browse the repository at this point in the history
Issue #4621
  • Loading branch information
amaitland committed Dec 7, 2024
1 parent a81202b commit 85cbb48
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions CefSharp.Test/Issues/Issue4621.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,33 @@ public async Task GoogleSearchToGmailBreaksJS()

var mainFrame = browser.GetMainFrame();
Assert.True(mainFrame.IsValid);
var buttonText = await mainFrame.EvaluateScriptAsync<string>("(function() { return document.querySelector(\"a[data-action='sign in']\").innerText; })();");
Assert.Equal("Sign in", buttonText);
var text = await mainFrame.EvaluateScriptAsync<string>("(function() { return document.querySelector(\"span\").innerText; })();");
Assert.Equal("For work", text);
}
}

[SkipIfRunOnAppVeyorFact]
public async Task NavigateBetweenTwoUrlsBreaksJs()
{
const string theUrl = "https://brave.com/";
const string theUrl2 = "https://brave.com/search/";

using (var browser = new ChromiumWebBrowser(theUrl, useLegacyRenderHandler: false))
{
var response = await browser.WaitForInitialLoadAsync();

await Task.Delay(1000);

for (var x = 0; x < 20; x++)
{
await browser.LoadUrlAsync(x % 2 == 0 ? theUrl : theUrl2);

var javascriptResponse = await browser.EvaluateScriptAsync($"{x}+1");

Assert.True(javascriptResponse.Success, javascriptResponse.Message);

Assert.Equal(x + 1, (int)javascriptResponse.Result);
}
}
}
}
Expand Down

0 comments on commit 85cbb48

Please sign in to comment.