-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Playwright Migration and GitHub Actions for CI #7
Conversation
@@ -0,0 +1,25 @@ | |||
name: Tram-Deco Playwright Tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is almost entirely from the npx playwright install
, and is probably the most bare-bones we could probably get this to be.
const getTextContent = async (element) => { | ||
return await element.evaluate((el) => el.textContent); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default toHaveText
does not work as expected with slots that have default content. There is probably an issue to raise in the playwright repository, but for the moment, just using this custom function to evaluate the results of textContent
manually.
return await element.evaluate((el) => el.textContent); | ||
}; | ||
|
||
test.describe('Tram-Deco Example Components', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is pretty much a translation of spec.cy.js
- I used ChatGPT to migrate one to the other
/** | ||
* @see https://playwright.dev/docs/test-configuration | ||
*/ | ||
module.exports = defineConfig({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've left this template pretty much untouched, but may update in the future. For now, this is fine.
Summary
Previously, we were using Cypress for out Automated testing, however it was not possible to trivially run that in CI, and the ergonomics of the automation test were honestly not that great.
This PR migrates the tests to Playwright, which allows for a more straight-forward interface when writing tests and interfacing with Web Components.
Checklist
Version Bump(not required, no source changes)