<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.35.1]</li>
<li>Operating System: [Ubuntu 22.04.2]</li>
<li>Browser: [WebKit, Mobile Safari]</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">workflow:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="name: Playwright Tests

on:
    push:
        branches: [main, master]
    pull_request:
        branches: [main, master]

jobs:
    test:
        timeout-minutes: 5

        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3
            - uses: actions/setup-node@v3
              with:
                  node-version: '20'

            - name: Cache Node modules
              id: npm_cache
              uses: actions/cache@v3
              with:
                  key: nm-pw-${{ hashFiles('yarn.lock') }}
                  path: |
                      node_modules
                      ~/.cache/ms-playwright

            - if: ${{ steps.npm_cache.outputs.cache-hit != 'true' }}
              run: |
                  yarn install --frozen-lockfile
                  npx playwright install --with-deps
                  npx playwright install-deps

            - name: Run Playwright tests
              run: yarn playwright test

            - uses: actions/upload-artifact@v3
              if: always()
              with:
                  name: playwright-report
                  path: playwright-report/
                  retention-days: 30"><pre class="notranslate"><span class="pl-ent">name</span>: <span class="pl-s">Playwright Tests</span>

<span class="pl-ent">on</span>:
    <span class="pl-ent">push</span>:
        <span class="pl-ent">branches</span>: <span class="pl-s">[main, master]</span>
    <span class="pl-ent">pull_request</span>:
        <span class="pl-ent">branches</span>: <span class="pl-s">[main, master]</span>

<span class="pl-ent">jobs</span>:
    <span class="pl-ent">test</span>:
        <span class="pl-ent">timeout-minutes</span>: <span class="pl-c1">5</span>

        <span class="pl-ent">runs-on</span>: <span class="pl-s">ubuntu-latest</span>
        <span class="pl-ent">steps</span>:
            - <span class="pl-ent">uses</span>: <span class="pl-s">actions/checkout@v3</span>
            - <span class="pl-ent">uses</span>: <span class="pl-s">actions/setup-node@v3</span>
              <span class="pl-ent">with</span>:
                  <span class="pl-ent">node-version</span>: <span class="pl-s"><span class="pl-pds">'</span>20<span class="pl-pds">'</span></span>

            - <span class="pl-ent">name</span>: <span class="pl-s">Cache Node modules</span>
              <span class="pl-ent">id</span>: <span class="pl-s">npm_cache</span>
              <span class="pl-ent">uses</span>: <span class="pl-s">actions/cache@v3</span>
              <span class="pl-ent">with</span>:
                  <span class="pl-ent">key</span>: <span class="pl-s">nm-pw-${{ hashFiles('yarn.lock') }}</span>
                  <span class="pl-ent">path</span>: <span class="pl-s">|</span>
<span class="pl-s">                      node_modules</span>
<span class="pl-s">                      ~/.cache/ms-playwright</span>
<span class="pl-s"></span>
<span class="pl-s"></span>            - <span class="pl-ent">if</span>: <span class="pl-s">${{ steps.npm_cache.outputs.cache-hit != 'true' }}</span>
              <span class="pl-ent">run</span>: <span class="pl-s">|</span>
<span class="pl-s">                  yarn install --frozen-lockfile</span>
<span class="pl-s">                  npx playwright install --with-deps</span>
<span class="pl-s">                  npx playwright install-deps</span>
<span class="pl-s"></span>
<span class="pl-s"></span>            - <span class="pl-ent">name</span>: <span class="pl-s">Run Playwright tests</span>
              <span class="pl-ent">run</span>: <span class="pl-s">yarn playwright test</span>

            - <span class="pl-ent">uses</span>: <span class="pl-s">actions/upload-artifact@v3</span>
              <span class="pl-ent">if</span>: <span class="pl-s">always()</span>
              <span class="pl-ent">with</span>:
                  <span class="pl-ent">name</span>: <span class="pl-s">playwright-report</span>
                  <span class="pl-ent">path</span>: <span class="pl-s">playwright-report/</span>
                  <span class="pl-ent">retention-days</span>: <span class="pl-c1">30</span></pre></div>




<p dir="auto"><strong>Link to the GitHub repository with the repro</strong></p>
<p dir="auto"><a href="https://github.com/budarin/zustand-clean-architecture">repository</a></p>
<p dir="auto"><strong>Config file</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { defineConfig, devices } from '@playwright/test';

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

/**
 * See https://playwright.dev/docs/test-configuration.
 */
export default defineConfig({
    testDir: './src/server/__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,
    /* Retry on CI only */
    retries: process.env.CI ? 2 : 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: 'list',
    /* 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',

        /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
        trace: 'on-first-retry',
    },

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

        {
            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: 'yarn start-client',
        url: 'http://127.0.0.1:3000/',
        reuseExistingServer: !process.env.CI,
    },
});"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">defineConfig</span><span class="pl-kos">,</span> <span class="pl-s1">devices</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'@playwright/test'</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"> * See https://playwright.dev/docs/test-configuration.</span>
<span class="pl-c"> */</span>
<span class="pl-k">export</span> <span class="pl-k">default</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">'./src/server/__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-c">/* Retry on CI only */</span>
    <span class="pl-c1">retries</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">2</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">'list'</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-c1">baseURL</span>: <span class="pl-s">'http://127.0.0.1:3000'</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-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-kos">{</span>
            <span class="pl-c1">name</span>: <span class="pl-s">'firefox'</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 Firefox'</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>
            <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-kos">{</span>
            <span class="pl-c1">name</span>: <span class="pl-s">'Mobile Chrome'</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">'Pixel 5'</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>
            <span class="pl-c1">name</span>: <span class="pl-s">'Mobile Safari'</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">'iPhone 12'</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 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-c1">webServer</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">command</span>: <span class="pl-s">'yarn start-client'</span><span class="pl-kos">,</span>
        <span class="pl-c1">url</span>: <span class="pl-s">'http://127.0.0.1:3000/'</span><span class="pl-kos">,</span>
        <span class="pl-c1">reuseExistingServer</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-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>Test file (self-contained)</strong></p>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>[make 1st PR]</li>
<li>[Merge it (tests in GHA will pass successfully)]</li>
</ul>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/8055157/247968299-8bd20de5-f9ed-481b-bf7d-bbcca8366506.png"><img width="1047" alt="image" src="https://user-images.githubusercontent.com/8055157/247968299-8bd20de5-f9ed-481b-bf7d-bbcca8366506.png" style="max-width: 100%;"></a>
- [Make another PR]
- [tests in GHA will fail with the error]
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/8055157/247969779-b1b1e229-8d01-4fad-ad42-09d2df537c44.png"><img width="1047" alt="image" src="https://user-images.githubusercontent.com/8055157/247969779-b1b1e229-8d01-4fad-ad42-09d2df537c44.png" style="max-width: 100%;"></a>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/8055157/247968641-0b4b66af-516e-400b-92f8-739292759ea5.png"><img width="1047" alt="image" src="https://user-images.githubusercontent.com/8055157/247968641-0b4b66af-516e-400b-92f8-739292759ea5.png" style="max-width: 100%;"></a>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/8055157/247968784-066a13fa-2f57-4491-b152-f070204ff8bb.png"><img width="1047" alt="image" src="https://user-images.githubusercontent.com/8055157/247968784-066a13fa-2f57-4491-b152-f070204ff8bb.png" style="max-width: 100%;"></a>
<p dir="auto"><strong>Expected</strong><br>
Expected to pass tests when cache for the dependencies is created</p>
<p dir="auto"><strong>Actual</strong><br>
Tests pass only if there is no cache with dependencies</p>
<p dir="auto">However, there is a strange thing - not all tests fail, tests only for Webkit and Mobile Safari do not pass</p>
<h3 dir="auto">Your question</h3>
<p dir="auto"><g-emoji class="g-emoji" alias="wave" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f44b.png">👋</g-emoji> I have a question about using regex.</p>
<p dir="auto">Say there is an element on page as follows:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;img .... data-permalink=&quot;2021-08-09/hello-world.png&quot;&gt;"><pre class="notranslate"><code class="notranslate">&lt;img .... data-permalink="2021-08-09/hello-world.png"&gt;
</code></pre></div>
<p dir="auto">I would like to use regex to match the element like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="await page.waitForSelector( 'img[data-permalink=&quot;/*world*/i&quot;' );"><pre class="notranslate"><code class="notranslate">await page.waitForSelector( 'img[data-permalink="/*world*/i"' );
</code></pre></div>
<p dir="auto">However when I try using regex in the Playwright debugger it does not appear to match anything, unfortunately.<br>
Question: is this possible? If not, is this something that may be on the roadmap?</p>
<hr>
<p dir="auto">Background: in my use case, I am attempting to verify that a file upload has taken place as expected. I have only the file name to work with, and the file name is added as an attribute to the resulting <code class="notranslate">&lt;img&gt;</code> element.<br>
The caveat is that the attribute holding the file name can possibly not match the actual file name 100%, due to sanitization as well as duplicate existing file resulting in something like this possibly happening:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2021-08-09/hello-world-1.png"><pre class="notranslate"><code class="notranslate">2021-08-09/hello-world-1.png
</code></pre></div>
<p dir="auto">Now, I realize I can wait for the <code class="notranslate">&lt;img&gt;</code> element, then extract the <code class="notranslate">data-permalink</code> attribute from the resulting ElementHandle, then check if it contains <code class="notranslate">world</code>, but that is a bit tedious.</p>
<p dir="auto">Thanks!</p>