System.TimeoutException : Timeout 30000ms exceeded Playwright with .net 5 core application

3.9k Views Asked by At

Is there any global setting for the .net application to overwrite the default configuration of the playwright? On the playwright documentation for node.js, it has documentation, however for the .net application there is a missing page and how can I change the default timeout.

Node.JS https://playwright.dev/docs/test-timeouts

// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
  timeout: 5 * 60 * 1000,
};
export default config;

Getting an exception as

[xUnit.net 00:00:37.65]     LegalRegtech.UiTesting.UI.GivenAccount.Then_Should_Login_the_user [FAIL]
  Failed LegalRegtech.UiTesting.UI.GivenAccount.Then_Should_Login_the_user [37 s]
  Error Message:
   System.TimeoutException : Timeout 30000ms exceeded.
=========================== logs ===========================
navigating to "https://dev.6clicks.io/", waiting until "load"
============================================================
  Stack Trace:
     at Microsoft.Playwright.Transport.Connection.InnerSendMessageToServerAsync[T](String guid, String method, Object args) in /_/src/Playwright/Transport/Connection.cs:line 161
   at Microsoft.Playwright.Transport.Connection.WrapApiCallAsync[T](Func`1 action, Boolean isInternal)
   at Microsoft.Playwright.Core.Frame.GotoAsync(String url, FrameGotoOptions options) in /_/src/Playwright/Core/Frame.cs:line 526
   at LegalRegtech.UiTesting.UI.GivenAccount.Then_Should_Login_the_user() in C:\Projects\New item\6clicks\test\LegalRegTech.UiTesting\UI\GivenAccount.cs:line 59
--- End of stack trace from previous location ---
[xUnit.net 00:01:09.73]     LegalRegtech.UiTesting.UI.GivenAccount.Then_Login_Page_Should_Load [FAIL]
  Failed LegalRegtech.UiTesting.UI.GivenAccount.Then_Login_Page_Should_Load [32 s]
  Error Message:
   System.TimeoutException : Timeout 30000ms exceeded.
=========================== logs ===========================
navigating to "https://dev.6clicks.io/", waiting until "load"
============================================================
  Stack Trace:
     at Microsoft.Playwright.Transport.Connection.InnerSendMessageToServerAsync[T](String guid, String method, Object args) in /_/src/Playwright/Transport/Connection.cs:line 161
   at Microsoft.Playwright.Transport.Connection.WrapApiCallAsync[T](Func`1 action, Boolean isInternal)
   at Microsoft.Playwright.Core.Frame.GotoAsync(String url, FrameGotoOptions options) in /_/src/Playwright/Core/Frame.cs:line 526
   at LegalRegtech.UiTesting.UI.GivenAccount.Then_Login_Page_Should_Load() in C:\Projects\New item\6clicks\test\LegalRegTech.UiTesting\UI\GivenAccount.cs:line 39
1

There are 1 best solutions below

0
On

Playwright for .NET discourages using xunit see here. Also the playwright.config file does only work for Node.js.

I'd recommend to set the DEBUG=pw:api env var to get more logs. Most likely your site is not reachable or hangs.