Skip to content

[lexical-playground] Chore: Skip inapplicable e2e tests before setup - #64

Closed
etrepum wants to merge 1 commit into
mainfrom
codex/e2e-early-skips
Closed

etrepum wants to merge 1 commit into
mainfrom
codex/e2e-early-skips

Conversation

@etrepum

@etrepum etrepum commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Description

Some e2e tests create a page and initialize the playground before discovering that their editor mode or browser is unsupported.

Move the shared skip conditions in AutoLinks, Ruby, grapheme deletion (meta#7163), and the Safari IME regression (meta#8153) to file-level Playwright modifiers. These modifiers depend only on the mode/browser fixtures, so they run before page-dependent setup. Keep the grapheme table's individual skip flag at test declaration time.

This covers 104 registered cases across four files and preserves their existing applicability conditions and assertions.

Also exclude __tests__/browser/ from Playwright e2e discovery alongside __tests__/unit/, so future Vitest browser tests in the playground test directory are not imported by the e2e runner.

Test plan

Used Playwright 1.62.1 with temporary copies of the four specs, redirecting imports to instrumented page and initialization fixtures. These checks exercise runner ordering without starting browsers or the playground.

Before

python3 /tmp/lexical-audit-tools/summarize-skips.py summarizes the JSON reports from the instrumented runs:

before plain: 89 skipped, 89 page setups, 87 playground setups
before collab: 42 skipped, 42 page setups, 40 playground setups

node /tmp/lexical-audit-tools/verify-discovery.mjs runs playwright test --list using copies of the actual config and temporary e2e/regression/unit/browser fixtures. The unit and browser fixtures throw if imported:

before: FAIL — browser tests were imported by the e2e runner

After

The same commands produce:

after plain: 89 skipped, 0 page setups, 0 playground setups
after collab: 42 skipped, 0 page setups, 0 playground setups
PASS: identical skipped test titles and outcomes before/after

after: PASS — e2e + regression discovered; unit + browser never imported
Listing tests:
  [chromium] › __tests__/e2e/discovery.test.mjs:2:1 › e2e discovered
  [chromium] › __tests__/regression/discovery.test.mjs:2:1 › regression discovered
Total: 2 tests in 2 files

Prettier checked all five changed files using the repository's formatting options (without optional plugins):

Checking formatting...
All matched files use Prettier code style!

git diff --check passed. The full browser e2e suite and the repository's Playwright 1.63.0/platform matrix have not been run locally. These checks establish skip ordering and discovery behavior, not CI time savings. Temporary verification fixtures are not included in the PR.

## Description

Some e2e tests create a page and initialize the playground before discovering that their editor mode or browser is unsupported.

Move the shared skip conditions in AutoLinks, Ruby, grapheme deletion (meta#7163), and the Safari IME regression (meta#8153) to file-level Playwright modifiers. These modifiers depend only on the mode/browser fixtures, so they run before page-dependent setup. Keep the grapheme table's individual skip flag at test declaration time.

This covers 104 registered cases across four files and preserves their existing applicability conditions and assertions.

Also exclude `__tests__/browser/` from Playwright e2e discovery alongside `__tests__/unit/`, so future Vitest browser tests in the playground test directory are not imported by the e2e runner.

## Test plan

Used Playwright 1.62.1 with temporary copies of the four specs, redirecting imports to instrumented page and initialization fixtures. These checks exercise runner ordering without starting browsers or the playground.

### Before

`python3 /tmp/lexical-audit-tools/summarize-skips.py` summarizes the JSON reports from the instrumented runs:

```text
before plain: 89 skipped, 89 page setups, 87 playground setups
before collab: 42 skipped, 42 page setups, 40 playground setups
```

`node /tmp/lexical-audit-tools/verify-discovery.mjs` runs `playwright test --list` using copies of the actual config and temporary e2e/regression/unit/browser fixtures. The unit and browser fixtures throw if imported:

```text
before: FAIL — browser tests were imported by the e2e runner
```

### After

The same commands produce:

```text
after plain: 89 skipped, 0 page setups, 0 playground setups
after collab: 42 skipped, 0 page setups, 0 playground setups
PASS: identical skipped test titles and outcomes before/after

after: PASS — e2e + regression discovered; unit + browser never imported
Listing tests:
  [chromium] › __tests__/e2e/discovery.test.mjs:2:1 › e2e discovered
  [chromium] › __tests__/regression/discovery.test.mjs:2:1 › regression discovered
Total: 2 tests in 2 files
```

Prettier checked all five changed files using the repository's formatting options (without optional plugins):

```text
Checking formatting...
All matched files use Prettier code style!
```

`git diff --check` passed. The full browser e2e suite and the repository's Playwright 1.63.0/platform matrix have not been run locally. These checks establish skip ordering and discovery behavior, not CI time savings. Temporary verification fixtures are not included in the PR.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying lexical with  Cloudflare Pages  Cloudflare Pages

Latest commit: b75cb71
Status: ✅  Deploy successful!
Preview URL: https://33884ca8.lexical-a1o.pages.dev
Branch Preview URL: https://codex-e2e-early-skips.lexical-a1o.pages.dev

View logs

@etrepum etrepum closed this Oct 4, 2026
etrepum pushed a commit that referenced this pull request Oct 31, 2026
…backslash before raw output, and keep all look-ahead text matches per line

## Description

- Emails: a reference that export writes inside an email (`[email protected]&meta#111;**“x”**`) cut `@lexical/mdast`'s link short at the reference, since micromark finds an email only in the text as written. The `@` of such an email now goes out as `@` too, and `@lexical/mdast` links the whole decoded address, as cmark-gfm does.
- Backslash before raw output: with `shouldPreserveNewLines`, a raw backslash that ends text right before a code span or other raw output starting with ASCII punctuation or a line ending escaped it, so `a\` then code `x` came back as plain text. It now goes out as `&meta#92;`, as it already did before a marker.
- Text matches: import kept the first match per line only for the link syntax, so any other text-match transformer searched what was left of a long line again after each match. It now keeps the match of every transformer whose pattern does not look behind (no `^`, word boundary or lookbehind outside a character class, no `g`, `y` or `v` flag). One helper now shifts a kept match, and copies its named groups.

## Test plan

Command: `pnpm exec vitest run --project unit packages/lexical-markdown/src/__tests__/unit/LexicalMarkdown.test.ts`

### Before

With this commit's tests and the previous sources:

```
     × exports formatting beside an email, which both importers read back 20ms
     × exports formatting beside the start of an email, which both importers read back 2ms
     × exports formatting beside an email before a URL, which both importers read back 2ms
     × exports formatting beside a URL that holds an email, which both importers read back 1ms
     × keeps an email that holds a reference whole for @lexical/mdast 2ms
     × spoils a URL for the reference to a backslash before a code span 1ms
     × searches a line once for a text match that it does not hold 42ms
AssertionError: expected 5459 to be less than 520
```

### After

```
 Test Files  1 passed (1)
      Tests  778 passed (778)
```

On 30,000 random lines with custom text-match transformers, import gives the same result with the kept matches as with a fresh search after each match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
etrepum pushed a commit that referenced this pull request Oct 31, 2026
…er a raw backslash, and walk only delimiter runs at a cut

## Description

- When an email holds a reference, export writes each of its `@` as `&#64;` so that micromark readers link the whole address. With `shouldPreserveNewLines`, a raw backslash before the `@` (`x\@b.co`) then escaped the reference's `&`, and the reference came back as literal text. Such an `@` is now left as it is.
- After each match, import looks past the delimiter run cut at each edge to read its flanking as it was in the whole line. It walked the run of whatever character sat at the cut, so a look-ahead text-match transformer matching a long run of one character piece by piece walked the rest of the run at every match. It now walks only a run of a code-span or format-tag character, which is the only kind whose far side is read.
- A comment in `LINK.replace` says that its text-before-the-opener branch serves custom callers, since import passes the label from its real opener.

## Test plan

Command: `pnpm exec vitest run --project unit packages/lexical-markdown/src/__tests__/unit/LexicalMarkdown.test.ts`

### Before

The new test with the export source of the previous commit:

```
     × writes no reference for an email's `@` after a raw backslash 18ms
AssertionError: expected 'x\&#64;b.c&meta#111;**“y”**' to be 'x\@b.c&meta#111;**“y”**' // Object.is equality
```

### After

```
 Test Files  1 passed (1)
      Tests  782 passed (782)
```

The run-walk change has no observable output; import was compared with the previous commit on 20,000 random lines with custom text-match transformers, with no differences.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant