<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: 1.32.1</li>
<li>Operating System: Ubuntu 22.04.2 LTS</li>
<li>Browser: Desktop Safari</li>
<li>Other info: Only fails in CI (have tried Github Actions and also Azure Devops). This works locally.</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I provided exact source code that allows reproducing the issue locally.</li>
</ul>
<p dir="auto">The webpage loaded is a simple HTML page (served via firebase hosting emulator)</p>




<p dir="auto"><strong>Config file</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// playwright.config.ts
// @ts-check
const { defineConfig, devices } = require('@playwright/test');

/**
 * Read environment variables from file.
 * https://github.com/motdotla/dotenv
 */
// require('dotenv').config();

/**
 * @see https://playwright.dev/docs/test-configuration
 */
module.exports = defineConfig({
  testDir: './tests',
  /* Run tests in files in parallel */
  fullyParallel: true,
  /* Fail the build on CI if you accidentally left test.only in the source code. */
  forbidOnly: !!process.env.CI,
  retries: 0,
  /* Opt out of parallel tests on CI. */
  workers: process.env.CI ? 1 : undefined,
  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  reporter: 'line',
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  use: {
    /* Base URL to use in actions like `await page.goto('/')`. */
    // baseURL: 'http://127.0.0.1:3000',
    baseURL: &quot;http://localhost:5000&quot;,
    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
    trace: 'on-first-retry',
    screenshot: 'only-on-failure',
  },

  /* Configure projects for major browsers */
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },

    // README: current apparent bug in Playwright+Firefox when using a service worker and requesting a cross-domain HTTPS url (e.g. the firebase libraries from gstatic.com)
    // {
    //   name: 'firefox',
    //   use: { ...devices['Desktop Firefox'] },
    // },

    {
      name: 'webkit',
      use: { ...devices['Desktop Safari'] },
    },

    /* Test against mobile viewports. */
    // {
    //   name: 'Mobile Chrome',
    //   use: { ...devices['Pixel 5'] },
    // },
    // {
    //   name: 'Mobile Safari',
    //   use: { ...devices['iPhone 12'] },
    // },

    /* Test against branded browsers. */
    // {
    //   name: 'Microsoft Edge',
    //   use: { ...devices['Desktop Edge'], channel: 'msedge' },
    // },
    // {
    //   name: 'Google Chrome',
    //   use: { ..devices['Desktop Chrome'], channel: 'chrome' },
    // },
  ],

  /* Run your local dev server before starting the tests */
  // webServer: {
  //   command: 'npm run start',
  //   url: 'http://127.0.0.1:3000',
  //   reuseExistingServer: !process.env.CI,
  // },
});

"><pre class="notranslate"><span class="pl-c">// playwright.config.ts</span>
<span class="pl-c">// <span class="pl-k">@ts</span>-check</span>
<span class="pl-k">const</span> <span class="pl-kos">{</span> defineConfig<span class="pl-kos">,</span> devices <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'@playwright/test'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">/**</span>
<span class="pl-c"> * Read environment variables from file.</span>
<span class="pl-c"> * https://github.com/motdotla/dotenv</span>
<span class="pl-c"> */</span>
<span class="pl-c">// require('dotenv').config();</span>

<span class="pl-c">/**</span>
<span class="pl-c"> * <span class="pl-k">@see</span> https://playwright.dev/docs/test-configuration</span>
<span class="pl-c"> */</span>
<span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-en">defineConfig</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">testDir</span>: <span class="pl-s">'./tests'</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Run tests in files in parallel */</span>
  <span class="pl-c1">fullyParallel</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Fail the build on CI if you accidentally left test.only in the source code. */</span>
  <span class="pl-c1">forbidOnly</span>: <span class="pl-c1">!</span><span class="pl-c1">!</span><span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">env</span><span class="pl-kos">.</span><span class="pl-c1">CI</span><span class="pl-kos">,</span>
  <span class="pl-c1">retries</span>: <span class="pl-c1">0</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Opt out of parallel tests on CI. */</span>
  <span class="pl-c1">workers</span>: <span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">env</span><span class="pl-kos">.</span><span class="pl-c1">CI</span> ? <span class="pl-c1">1</span> : <span class="pl-c1">undefined</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Reporter to use. See https://playwright.dev/docs/test-reporters */</span>
  <span class="pl-c1">reporter</span>: <span class="pl-s">'line'</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */</span>
  <span class="pl-c1">use</span>: <span class="pl-kos">{</span>
    <span class="pl-c">/* Base URL to use in actions like `await page.goto('/')`. */</span>
    <span class="pl-c">// baseURL: 'http://127.0.0.1:3000',</span>
    <span class="pl-c1">baseURL</span>: <span class="pl-s">"http://localhost:5000"</span><span class="pl-kos">,</span>
    <span class="pl-c">/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */</span>
    <span class="pl-c1">trace</span>: <span class="pl-s">'on-first-retry'</span><span class="pl-kos">,</span>
    <span class="pl-c1">screenshot</span>: <span class="pl-s">'only-on-failure'</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>

  <span class="pl-c">/* Configure projects for major browsers */</span>
  <span class="pl-c1">projects</span>: <span class="pl-kos">[</span>
    <span class="pl-kos">{</span>
      <span class="pl-c1">name</span>: <span class="pl-s">'chromium'</span><span class="pl-kos">,</span>
      <span class="pl-c1">use</span>: <span class="pl-kos">{</span> ...<span class="pl-s1">devices</span><span class="pl-kos">[</span><span class="pl-s">'Desktop Chrome'</span><span class="pl-kos">]</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>

    <span class="pl-c">// README: current apparent bug in Playwright+Firefox when using a service worker and requesting a cross-domain HTTPS url (e.g. the firebase libraries from gstatic.com)</span>
    <span class="pl-c">// {</span>
    <span class="pl-c">//   name: 'firefox',</span>
    <span class="pl-c">//   use: { ...devices['Desktop Firefox'] },</span>
    <span class="pl-c">// },</span>

    <span class="pl-kos">{</span>
      <span class="pl-c1">name</span>: <span class="pl-s">'webkit'</span><span class="pl-kos">,</span>
      <span class="pl-c1">use</span>: <span class="pl-kos">{</span> ...<span class="pl-s1">devices</span><span class="pl-kos">[</span><span class="pl-s">'Desktop Safari'</span><span class="pl-kos">]</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>

    <span class="pl-c">/* Test against mobile viewports. */</span>
    <span class="pl-c">// {</span>
    <span class="pl-c">//   name: 'Mobile Chrome',</span>
    <span class="pl-c">//   use: { ...devices['Pixel 5'] },</span>
    <span class="pl-c">// },</span>
    <span class="pl-c">// {</span>
    <span class="pl-c">//   name: 'Mobile Safari',</span>
    <span class="pl-c">//   use: { ...devices['iPhone 12'] },</span>
    <span class="pl-c">// },</span>

    <span class="pl-c">/* Test against branded browsers. */</span>
    <span class="pl-c">// {</span>
    <span class="pl-c">//   name: 'Microsoft Edge',</span>
    <span class="pl-c">//   use: { ...devices['Desktop Edge'], channel: 'msedge' },</span>
    <span class="pl-c">// },</span>
    <span class="pl-c">// {</span>
    <span class="pl-c">//   name: 'Google Chrome',</span>
    <span class="pl-c">//   use: { ..devices['Desktop Chrome'], channel: 'chrome' },</span>
    <span class="pl-c">// },</span>
  <span class="pl-kos">]</span><span class="pl-kos">,</span>

  <span class="pl-c">/* Run your local dev server before starting the tests */</span>
  <span class="pl-c">// webServer: {</span>
  <span class="pl-c">//   command: 'npm run start',</span>
  <span class="pl-c">//   url: 'http://127.0.0.1:3000',</span>
  <span class="pl-c">//   reuseExistingServer: !process.env.CI,</span>
  <span class="pl-c">// },</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
</pre></div>
<p dir="auto"><strong>Test file (self-contained)</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="test(&quot;Webkit bug&quot;, async ({ context, page }) =&gt; {

    await page.goto(&quot;/&quot;);
    const storageState = await context.storageState();
    console.log(storageState);
    await page.evaluate(() =&gt; localStorage.setItem(&quot;dev-mode&quot;, true));
    const storageState2 = await context.storageState();
    console.log(storageState2);
    await page.reload();

});"><pre class="notranslate"><span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">"Webkit bug"</span><span class="pl-kos">,</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">{</span> context<span class="pl-kos">,</span> page <span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>

    <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">"/"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">const</span> <span class="pl-s1">storageState</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">storageState</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">storageState</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">evaluate</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-s1">localStorage</span><span class="pl-kos">.</span><span class="pl-en">setItem</span><span class="pl-kos">(</span><span class="pl-s">"dev-mode"</span><span class="pl-kos">,</span> <span class="pl-c1">true</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">const</span> <span class="pl-s1">storageState2</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">storageState</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">storageState2</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">reload</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>[Run the test]</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">Test passes</p>
<p dir="auto"><strong>Actual</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Running script: DEBUG=pw:browser* npx playwright test

Running 2 tests using 1 worker

[1/2] [chromium] › login.spec.js:36:5 › Webkit bug
[chromium] › login.spec.js:36:5 › Webkit bug

  pw:browser &lt;launching&gt; /home/runner/.cache/ms-playwright/chromium-1055/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-2d3gMB --remote-debugging-pipe --no-startup-window +0ms
  pw:browser &lt;launched&gt; pid=4469 +4ms

  pw:browser [pid=4469][err] [0406/093140.969637:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable. +2s

  pw:browser [pid=4469][err] [0406/093141.009862:WARNING:sandbox_linux.cc(393)] InitializeSandbox() called with multiple threads in process gpu-process. +40ms

i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] &quot;GET / HTTP/1.1&quot; 200 - &quot;-&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] &quot;GET /css/main.css HTTP/1.1&quot; 200 - &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] &quot;GET /js/main.js HTTP/1.1&quot; 200 - &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] &quot;GET /img/PA-with-text-logo.svg HTTP/1.1&quot; 200 - &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] &quot;GET /img/landing.jpg HTTP/1.1&quot; 200 2995[35](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:36) &quot;http://localhost:5000/css/main.css&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] &quot;GET /sw.js HTTP/1.1&quot; 404 492 &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5615.29 Safari/537.36&quot;
{ cookies: [], origins: [] }

{
  cookies: [],
  origins: [ { origin: 'http://localhost:5000', localStorage: [Array] } ]
}

i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] &quot;GET / HTTP/1.1&quot; 200 - &quot;-&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] &quot;GET /sw.js HTTP/1.1&quot; 404 492 &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5615.29 Safari/537.36&quot;
  pw:browser [pid=4469] &lt;gracefully close start&gt; +1s

  pw:browser [pid=4469] &lt;process did exit: exitCode=0, signal=null&gt; +19ms


  pw:browser [pid=4469] starting temporary directories cleanup +1ms
  pw:browser [pid=4469] finished temporary directories cleanup +4ms

  pw:browser [pid=4469] &lt;gracefully close end&gt; +0ms

[2/2] [webkit] › login.spec.js:36:5 › Webkit bug
[webkit] › login.spec.js:36:5 › Webkit bug
  pw:browser &lt;launching&gt; /home/runner/.cache/ms-playwright/webkit-1811/pw_run.sh --inspector-pipe --headless --no-startup-window +0ms

  pw:browser &lt;launched&gt; pid=5147 +4ms

  pw:browser [pid=5147][err] Could not determine the accessibility bus address +2s

i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] &quot;GET / HTTP/1.1&quot; 200 - &quot;-&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] &quot;GET /css/main.css HTTP/1.1&quot; 200 - &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] &quot;GET /js/main.js HTTP/1.1&quot; 200 - &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] &quot;GET /img/PA-with-text-logo.svg HTTP/1.1&quot; 200 - &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] &quot;GET /img/landing.jpg HTTP/1.1&quot; 200 299535 &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15&quot;
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] &quot;GET /sw.js HTTP/1.1&quot; 404 492 &quot;http://localhost:5000/&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15&quot;
{ cookies: [], origins: [] }

  pw:browser [pid=5147][err] EGLDisplay Initialization failed: EGL_NOT_INITIALIZED +7s

  pw:browser [pid=5147][err] /home/runner/.cache/ms-playwright/webkit-1811/pw_run.sh: line 21:  5152 Segmentation fault      (core dumped) WEBKIT_FORCE_COMPLEX_TEXT=&quot;1&quot; &quot;$MINIBROWSER&quot; &quot;$@&quot; +0ms

  pw:browser [pid=5147] &lt;process did exit: exitCode=1[39](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:40), signal=null&gt; +1ms
  pw:browser [pid=5147] starting temporary directories cleanup +0ms

  pw:browser [pid=5147] finished temporary directories cleanup +5ms


  1) [webkit] › login.spec.js:36:5 › Webkit bug ────────────────────────────────────────────────────

    Error: browserContext.storageState: Browser closed.
    ==================== Browser output: ====================
    &lt;launching&gt; /home/runner/.cache/ms-playwright/webkit-1811/pw_run.sh --inspector-pipe --headless --no-startup-window
    &lt;launched&gt; pid=5147
    [pid=5147][err] Could not determine the accessibility bus address
    [pid=5147][err] EGLDisplay Initialization failed: EGL_NOT_INITIALIZED
    [pid=5147][err] /home/runner/.cache/ms-playwright/webkit-1811/pw_run.sh: line 21:  5152 Segmentation fault      (core dumped) WEBKIT_FORCE_COMPLEX_TEXT=&quot;1&quot; &quot;$MINIBROWSER&quot; &quot;$@&quot;
    [pid=5147] &lt;process did exit: exitCode=139, signal=null&gt;
    [pid=5147] starting temporary directories cleanup
    [pid=5147] finished temporary directories cleanup

      [40](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:41) |     console.log(storageState);
      [41](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:42) |     await page.evaluate(() =&gt; localStorage.setItem(&quot;dev-mode&quot;, true));
    &gt; [42](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:43) |     const storageState2 = await context.storageState();
         |                                         ^
      [43](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:44) |     console.log(storageState2);
      [44](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:45) |     await page.reload();
      [45](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:46) |

        at /home/runner/work/jackass/jackass/test/e2e/tests/login.spec.js:42:41


  1 failed
    [webkit] › login.spec.js:36:5 › Webkit bug ─────────────────────────────────────────────────────
  1 passed (13.3s)
⚠  Script exited unsuccessfully (code 1)
i  emulators: Shutting down emulators.
i  functions: Stopping Functions Emulator
i  hosting: Stopping Hosting Emulator
i  firestore: Stopping Firestore Emulator
i  auth: Stopping Authentication Emulator
i  eventarc: Stopping Eventarc Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator

Error: Script &quot;DEBUG=pw:browser* npx playwright test&quot; exited with code 1
Error: Process completed with exit code 1."><pre class="notranslate"><code class="notranslate">Running script: DEBUG=pw:browser* npx playwright test

Running 2 tests using 1 worker

[1/2] [chromium] › login.spec.js:36:5 › Webkit bug
[chromium] › login.spec.js:36:5 › Webkit bug

  pw:browser &lt;launching&gt; /home/runner/.cache/ms-playwright/chromium-1055/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-2d3gMB --remote-debugging-pipe --no-startup-window +0ms
  pw:browser &lt;launched&gt; pid=4469 +4ms

  pw:browser [pid=4469][err] [0406/093140.969637:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable. +2s

  pw:browser [pid=4469][err] [0406/093141.009862:WARNING:sandbox_linux.cc(393)] InitializeSandbox() called with multiple threads in process gpu-process. +40ms

i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] "GET /css/main.css HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] "GET /js/main.js HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] "GET /img/PA-with-text-logo.svg HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] "GET /img/landing.jpg HTTP/1.1" 200 2995[35](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:36) "http://localhost:5000/css/main.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] "GET /sw.js HTTP/1.1" 404 492 "http://localhost:5000/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5615.29 Safari/537.36"
{ cookies: [], origins: [] }

{
  cookies: [],
  origins: [ { origin: 'http://localhost:5000', localStorage: [Array] } ]
}

i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.29 Safari/537.36"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:41 +0000] "GET /sw.js HTTP/1.1" 404 492 "http://localhost:5000/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5615.29 Safari/537.36"
  pw:browser [pid=4469] &lt;gracefully close start&gt; +1s

  pw:browser [pid=4469] &lt;process did exit: exitCode=0, signal=null&gt; +19ms


  pw:browser [pid=4469] starting temporary directories cleanup +1ms
  pw:browser [pid=4469] finished temporary directories cleanup +4ms

  pw:browser [pid=4469] &lt;gracefully close end&gt; +0ms

[2/2] [webkit] › login.spec.js:36:5 › Webkit bug
[webkit] › login.spec.js:36:5 › Webkit bug
  pw:browser &lt;launching&gt; /home/runner/.cache/ms-playwright/webkit-1811/pw_run.sh --inspector-pipe --headless --no-startup-window +0ms

  pw:browser &lt;launched&gt; pid=5147 +4ms

  pw:browser [pid=5147][err] Could not determine the accessibility bus address +2s

i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] "GET /css/main.css HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] "GET /js/main.js HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] "GET /img/PA-with-text-logo.svg HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] "GET /img/landing.jpg HTTP/1.1" 200 299535 "http://localhost:5000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15"
i  hosting: 127.0.0.1 - - [06/Apr/2023:09:31:49 +0000] "GET /sw.js HTTP/1.1" 404 492 "http://localhost:5000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15"
{ cookies: [], origins: [] }

  pw:browser [pid=5147][err] EGLDisplay Initialization failed: EGL_NOT_INITIALIZED +7s

  pw:browser [pid=5147][err] /home/runner/.cache/ms-playwright/webkit-1811/pw_run.sh: line 21:  5152 Segmentation fault      (core dumped) WEBKIT_FORCE_COMPLEX_TEXT="1" "$MINIBROWSER" "$@" +0ms

  pw:browser [pid=5147] &lt;process did exit: exitCode=1[39](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:40), signal=null&gt; +1ms
  pw:browser [pid=5147] starting temporary directories cleanup +0ms

  pw:browser [pid=5147] finished temporary directories cleanup +5ms


  1) [webkit] › login.spec.js:36:5 › Webkit bug ────────────────────────────────────────────────────

    Error: browserContext.storageState: Browser closed.
    ==================== Browser output: ====================
    &lt;launching&gt; /home/runner/.cache/ms-playwright/webkit-1811/pw_run.sh --inspector-pipe --headless --no-startup-window
    &lt;launched&gt; pid=5147
    [pid=5147][err] Could not determine the accessibility bus address
    [pid=5147][err] EGLDisplay Initialization failed: EGL_NOT_INITIALIZED
    [pid=5147][err] /home/runner/.cache/ms-playwright/webkit-1811/pw_run.sh: line 21:  5152 Segmentation fault      (core dumped) WEBKIT_FORCE_COMPLEX_TEXT="1" "$MINIBROWSER" "$@"
    [pid=5147] &lt;process did exit: exitCode=139, signal=null&gt;
    [pid=5147] starting temporary directories cleanup
    [pid=5147] finished temporary directories cleanup

      [40](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:41) |     console.log(storageState);
      [41](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:42) |     await page.evaluate(() =&gt; localStorage.setItem("dev-mode", true));
    &gt; [42](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:43) |     const storageState2 = await context.storageState();
         |                                         ^
      [43](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:44) |     console.log(storageState2);
      [44](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:45) |     await page.reload();
      [45](https://github.com/pocketangler/jackass/actions/runs/4627475169/jobs/8185434488#step:8:46) |

        at /home/runner/work/jackass/jackass/test/e2e/tests/login.spec.js:42:41


  1 failed
    [webkit] › login.spec.js:36:5 › Webkit bug ─────────────────────────────────────────────────────
  1 passed (13.3s)
⚠  Script exited unsuccessfully (code 1)
i  emulators: Shutting down emulators.
i  functions: Stopping Functions Emulator
i  hosting: Stopping Hosting Emulator
i  firestore: Stopping Firestore Emulator
i  auth: Stopping Authentication Emulator
i  eventarc: Stopping Eventarc Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator

Error: Script "DEBUG=pw:browser* npx playwright test" exited with code 1
Error: Process completed with exit code 1.
</code></pre></div>
<p dir="auto">Hello.</p>
<p dir="auto">I am trying to deal with saving authentication state between my tests.<br>
I am going with approach where I have beforeAll hook where I log in to application, then save the state with context().storageState():</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="BeforeAll(async function () {
global.browser = await chromium.launch({
        headless: false,
    });
    global.page = await global.browser.newPage();
    await page.goto('https://mypage.com');
    ***some authentication steps ***
    await page.context().storageState({ path: 'storageState.json' });
    page.close();
});"><pre class="notranslate"><code class="notranslate">BeforeAll(async function () {
global.browser = await chromium.launch({
        headless: false,
    });
    global.page = await global.browser.newPage();
    await page.goto('https://mypage.com');
    ***some authentication steps ***
    await page.context().storageState({ path: 'storageState.json' });
    page.close();
});
</code></pre></div>
<p dir="auto">after this action storageState.json file has this structure (no auth info that's fine):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;cookies&quot;: [],
  &quot;origins&quot;: [
    {
      &quot;origin&quot;: &quot;https://mypage.com&quot;,
      &quot;localStorage&quot;: [
        {
          &quot;name&quot;: &quot;signedOut&quot;,
          &quot;value&quot;: &quot;false&quot;
        }
      ]
    }
  ]
}"><pre class="notranslate"><code class="notranslate">{
  "cookies": [],
  "origins": [
    {
      "origin": "https://mypage.com",
      "localStorage": [
        {
          "name": "signedOut",
          "value": "false"
        }
      ]
    }
  ]
}
</code></pre></div>
<p dir="auto">next I use "Before" hook to set up each test:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Before(async function (scenario) {
    global.context = await global.browser.newContext({
        storageState: 'storageState.json'
    });

    global.page = await global.context.newPage();
    await page.goto('https://mypage.com');
});"><pre class="notranslate"><code class="notranslate">Before(async function (scenario) {
    global.context = await global.browser.newContext({
        storageState: 'storageState.json'
    });

    global.page = await global.context.newPage();
    await page.goto('https://mypage.com');
});
</code></pre></div>
<p dir="auto">and then I start my test cases.</p>
<p dir="auto">The issue is that for each test, there is additional page that open for url in storageState.json file so for the user it looks like this:</p>
<ul dir="auto">
<li><strong>one page opens (this is because of using storageState file)</strong></li>
<li><strong>redirection to mypage.com (this is because of 'origin' in storageState)</strong></li>
<li><strong>page close</strong></li>
<li>page open again (this is because of newPage() in Before)</li>
<li>redirection to mypage.com (this is from 'Before' goto step)</li>
<li>test proceed</li>
</ul>
<p dir="auto">I think first 3 steps should not happen.</p>
<p dir="auto">I did some research and if I remove value from origin parameter then this first page will not open and everything is fine.<br>
Also if I remove storageState: 'storageState.json' from 'Before' then this issue is gone but I need this state in context for each test.</p>
<p dir="auto">I think the similar issue was here but no answers were given:</p>
<p dir="auto"><a href="url">https://stackoverflow.com/questions/70878170/playwright-browsercontext-storagestate-opens-all-visited-tabs</a></p>