ai
ai copied to clipboard
POC: E2E test with Playwright
Type of feature
🍕 Feature
Current behavior
This is related to the latest stream I had with @nickytonline we could test the popup index page through the code below.
import { test } from './popupFixture';
test('popup page', async ({ page, extensionId }) => {
await page.goto(`chrome-extension://${extensionId}/index.html`);
await page.getByRole('button', { name: 'Login' }).click();
});
When I tried to work on the tests and login to the extension I could not do that due the inability to open a new tab and get the authentication from it, the playwright is testing the popups as HTML pages and not allowing to have the browser features that we need.
Here is an example from playwright:
This page is pretty similar to http://localhost:3000/ when you run the dev server, and that page does not allow you to login or open new window, I am not sure if this is possible to do not.
Related issue: https://github.com/open-sauced/ai/issues/238
A solution to have is:
- test components in the extension, playwright docs
- test the link to the app if it's correct or not (to prevent the issue we faced before)
- testing the injection codes with evaluation functions
The downside for this would be:
- not being able to test if the extension has injected any code to the page, which is what we are doing.
Another thing we could try:
- using the browser to unpack the extension and use it from the browser but not sure if that is possible.
A good thing in playwright is that we could use the authentication feautre to login to github and opensauced, then we could use the cookies/auth information from that.
I think this is a feature request in the playwright but it's not implemented yet, related issues: support for Chrome extension popup testing Ability to click browser action buttons Can I use playwright to test chrome extension?
Resources: End-to-end testing Chrome extension, google docs
Suggested solution
No response
Additional context
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributing Docs
- [ ] I agree to follow this project's Contribution Docs