Skip to content

Add playwright capabilities as a browser test runner. - #411

Open
JohnC-80 wants to merge 29 commits into
mainfrom
karma-to-playwright
Open

JohnC-80 wants to merge 29 commits into
mainfrom
karma-to-playwright

Conversation

@JohnC-80

@JohnC-80 JohnC-80 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Karma has long been the browser-based test runner go-to for stripes-*. Unfortunatlely the Karma project ended and it's time to move on.

Playwright is the new kid in town.

To migrate, the command stripes test karma can be switched to stripes test browser.

This PR implements a harness/shim layer in which tests are executed with browser orchestration handled by playwright. Previously, this functionality was implemented by a handful of dependencies -
karma, karma-browserstack-launcher, karma-chrome-launcher, karma-coverage-istanbul-reporter, karma-firefox-launcher, karma-junit-reporter, karma-mocha, karma-mocha-reporter, and last but most infamous karma-webpack.

playwright-service implements the harness, configures the build for tests, implements the logging output. This allows us to keep our mocha test suites and just swap out the thing(s) that orchestrate the browser and did the reporting.

The reporting layer is custom/controllable since mocha and the reporting are running in separate spaces (mocha in the browser, reporter in node) and built-in reporters depend on a shared environment.

…s test karma' command with 'stripes test playwright'.
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Jest Unit Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 387ea38. ± Comparison against base commit c0ed8c3.

♻️ This comment has been updated with latest results.

@JohnC-80 JohnC-80 added the AI label Nov 12, 2026
@JohnC-80 JohnC-80 changed the title remove karma dependency, add playwright capabilities, replace 'stripe… Add playwright capabilities as a browser test runner. Nov 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

@JohnC-80
JohnC-80 marked this pull request as ready for review November 13, 2026 15:31
@JohnC-80
JohnC-80 requested a review from a team as a code owner November 13, 2026 15:31

@zburke zburke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, thank you! 👏👏👏 It's such a relief to see this work! I'm impressed you got the Chromium install to work automatically (as evidenced in folio-org/stripes-components#2604), though I think we should follow up with devops and try to get it pre-installed on the CI images.

A few nits:

  • Please link this up with STCLI-255.
  • Ideally, let's handle all the "remove karma" stuff separately. "Add browser" is a new feature, but "Remove karma" is a breaking change. I think most of the removal here is just documentation, but lib/commands/test.js looks like it replaces karma with playwright.
  • IIUC, all our legacy decorators stuff has been removed, but maybe that work wasn't finished when this work started? It would be nice to clean it up here if possible.

PS: Boy George, FTW!!! 😆

Comment thread doc/commands.md
* [`status` command](#status-command)
* [`test` command](#test-command)
* [`test karma` command](#test-karma-command)
* [`test browser` command](#test-browser-command)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's separate "add browser" from "remove karma". I know this is just documentation, but still.

Comment thread doc/commands.md
`--bundle` | Create and use a production bundle retaining test hooks | boolean |
`--cache` | Enable webpack's caching for quicker rebuilds during development. | boolean | default: `false`
`--coverage, --karma.coverage` | Enable Karma coverage reports | boolean |
`--cache` | Enable caching of test bundle. Defaults to false. | boolean |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given we are adding --browser with the default value in the Notes column, let's keep that same formatting for this line. Alternatively, if these all default to false, just say so at the top and say "here's a table of on-switches".

Comment thread doc/commands.md
`--stripesConfig` | Stripes config JSON | string | supports stdin
`--tenant` | Specify a tenant ID | string |
`--watch` | Watch test files for changes and rerun tests automatically when changes are saved. | boolean | default: `false`
`--verbose` | Print passing tests as well as failures. | boolean |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't need to die on this hill, but if it were up to me:

My inclination is to show all results by default. This is how karma and jest work, so I think it's a standard expectation. Even jest --quiet **still shows all test results, but merely suppresses extra logging. If you think it's important to have a "no console output" option, I'd expect this as a --quiet flag to suppress this standard output.

Comment on lines +16 to +19
// opt-in: only the Playwright runner needs this; the (deprecated) Karma flow stays as it was.
if (options.legacyDecorators) {
enableLegacyDecorators(config);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?!? Why? I thought these were only present in interactors that imported from @bigtest/..., and those are all gone now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants