From 3a40fb30308598841a12989c3e7ffbe816bf6f98 Mon Sep 17 00:00:00 2001 From: cleeding <50547620+cleeding@users.noreply.github.com> Date: Sun, 23 Mar 2025 20:30:20 +0000 Subject: [PATCH] Update BaseTest.cs with --user-data-dir for GitHub Actions --- Tests/BaseTest.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Tests/BaseTest.cs b/Tests/BaseTest.cs index cc584ce..59d9b5d 100644 --- a/Tests/BaseTest.cs +++ b/Tests/BaseTest.cs @@ -21,6 +21,17 @@ public class BaseTest [SetUp] public virtual void Setup() { + var options = new ChromeOptions(); + + // Common Chrome options for both local and CI environments + options.AddArguments("headless", "disable-gpu", "window-size=1280x1024", "no-sandbox"); + + // Conditionally add user data dir for CI environment (GitHub Actions) + if (Environment.GetEnvironmentVariable("GITHUB_ACTIONS") != null) + { + options.AddArguments($"--user-data-dir=/tmp/chrome-{Guid.NewGuid()}"); // Unique directory for CI + } + _driver = new ChromeDriver(); _basePage = new BasePage(_driver); _homePage = new HomePage(_driver); @@ -71,4 +82,4 @@ public void GlobalSetup() } } -} \ No newline at end of file +}