Skip to content
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using DCL.Multiplayer.Connections.DecentralandUrls;
using System;
using UnityEngine;
#if ALTTESTER
using DCL.Diagnostics;
using System.IO;
#endif

namespace DCL.Browser
{
Expand All @@ -15,7 +19,22 @@ public UnityAppWebBrowser(IDecentralandUrlsSource decentralandUrlsSource)

public void OpenUrl(string url)
{
Application.OpenURL(Uri.EscapeUriString(url));
var escaped = Uri.EscapeUriString(url);

#if ALTTESTER
// ALTTESTER builds write auth URL to disk and suppress the system browser so Playwright tests can drive their own browser to it.
try
{
var path = Path.Combine(Application.persistentDataPath, "auth-url.txt");
File.WriteAllText(path, escaped);
}
catch (Exception e)
{
ReportHub.LogException(e, ReportCategory.AUTHENTICATION);
}
#else
Application.OpenURL(escaped);
#endif
}

public void OpenUrl(DecentralandUrl url)
Expand Down
Loading