Migrate test runner to vitest browser #1300
Conversation
|
|
|
||
| const silencedLogs = ['Lit is in dev mode.', 'Multiple versions of Lit loaded.']; | ||
|
|
||
| // Pre-existing unhandled rejections that wtr ignored, which we can now see and are silencing until resolved. |
There was a problem hiding this comment.
We can add a follow-up issue to address these
size-limit report 📦
|
| ); | ||
|
|
||
| component.focus(); | ||
| sendKeys({ press: 'Tab' }); |
There was a problem hiding this comment.
This was never actually doing anything meaningful, I removed just this line on develop as well and the test passes just the same.
There was a problem hiding this comment.
These tests passed intermittently as they were when I was running them locally, extending the timeout made them less flaky
| ?.getAttribute('aria-describedby'); | ||
|
|
||
| expect(component.renderRoot.querySelector(`#${groupDescID}`)?.textContent)?.to.equal(text); | ||
| expect(component.renderRoot.querySelector(`#${groupDescID}`)?.textContent?.trim())?.to.equal( |
There was a problem hiding this comment.
Because of the difference in how vitest compiles the component for testing, there were some whitespace changes, which resulted in errors like this
AssertionError: expected '\n Please make a selection\n \n ' to equal 'Please make a selection'
I just added .trim() where this was happening
| headless: true, | ||
| provider: playwright(), | ||
| screenshotFailures: false, | ||
| viewport: { width: 1280, height: 720 }, |
There was a problem hiding this comment.
Match wtr's full-page size, Vitest iframe default is 414x896
This change: (check at least one)
Is this a breaking change? (check one)
Is the: (complete all)
What does this change address?
Starts the process of migrating away from
@open-wc/testing(#1009)How does this change work?
Our current testing framework has proven to be somewhat hard to work (#580) with and not as well supported (current version) as we would like. While the desired end result is to get rid of
@open-wc/testing, doing so all in one pass has proven to be difficult enough that it keeps getting delayed or dropped in favor of more pressing work.This PR takes things from the other direction - replacing the current
wtrtest runner withvitestusing browser mode, but keeping the tests themselves largely the same. This allows us to start moving in the direction we want to go with minimal changes to the large testing suite we need to maintain.Once we get this merged in we can start working through the test files component-by-component as we have time and removing
@open-wc/testing, we could probably create per-component issues or a project to track that work.It also has the fringe benefit of making
playwrighta direct devDependency (closes #1169 ). Withwtr, playwright was required but not listed as a dependency. This requiring contributors knowing what was happening and runningnpx playwright installlocally to get tests to pass, which was a frequent stumbling block for new contributors.