Issue 1:
System info

Playwright Version: [v1.35.1]

Operating System: [Ubuntu 22.04.2]

Browser: [WebKit, Mobile Safari]

Source code

I provided exact source code that allows reproducing the issue locally.

workflow:

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

Link to the GitHub repository with the repro

repository

Config file

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,
},
});

Test file (self-contained)

Steps

[make 1st PR]

[Merge it (tests in GHA will pass successfully)]

- [Make another PR]
- [tests in GHA will fail with the error]

Expected

Expected to pass tests when cache for the dependencies is created

Actual

Tests pass only if there is no cache with dependencies

However, there is a strange thing - not all tests fail, tests only for Webkit and Mobile Safari do not pass

Issue 2:
Your question

👋 I have a question about using regex.

Say there is an element on page as follows:

<img .... data-permalink="2021-08-09/hello-world.png">

I would like to use regex to match the element like this:

await page.waitForSelector( 'img[data-permalink="/*world*/i"' );

However when I try using regex in the Playwright debugger it does not appear to match anything, unfortunately.

Question: is this possible? If not, is this something that may be on the roadmap?

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 <img> element.

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:

2021-08-09/hello-world-1.png

Now, I realize I can wait for the <img> element, then extract the data-permalink attribute from the resulting ElementHandle, then check if it contains world, but that is a bit tedious.

Thanks!