Skip to content

Commit 9bb2adc

Browse files
committed
Use 3s timeout for GetUserAgentAsync and updat test
1 parent 88d2daa commit 9bb2adc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/ElectronNET.API/API/WebContents.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public void SetAudioMuted(bool muted)
388388
/// Returns string - The user agent for this web page.
389389
/// </summary>
390390
/// <returns></returns>
391-
public Task<string> GetUserAgentAsync() => InvokeAsync<string>();
391+
public Task<string> GetUserAgentAsync() => InvokeAsyncWithTimeout<string>(3000);
392392

393393
/// <summary>
394394
/// Overrides the user agent for this web page.

src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,12 @@ public async Task GetSetUserAgent_check()
178178
{
179179
////Skip.If(Environment.GetEnvironmentVariable("GITHUB_RUN_ID") != null && RuntimeInformation.IsOSPlatform(OSPlatform.Windows), "Skipping test on Windows CI.");
180180

181+
await Task.Delay(1000);
182+
181183
fx.MainWindow.WebContents.SetUserAgent("MyUserAgent/1.0");
184+
182185
await Task.Delay(1000);
186+
183187
var ok = await fx.MainWindow.WebContents.GetUserAgentAsync();
184188
ok.Should().Be("MyUserAgent/1.0");
185189
}

0 commit comments

Comments
 (0)