Skip to content
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

POC: Add End to End Tests for the Browser Extension #238

Closed
2 tasks
nickytonline opened this issue Aug 3, 2023 · 5 comments · Fixed by #262
Closed
2 tasks

POC: Add End to End Tests for the Browser Extension #238

nickytonline opened this issue Aug 3, 2023 · 5 comments · Fixed by #262

Comments

@nickytonline
Copy link
Member

nickytonline commented Aug 3, 2023

Cypress is great for end to end tests and it can even load a browser extension. It be good to explore if we can get the extension running in Cypress so that we can run a test suite of end to end tests for the browser extension.

If successful, it'd be great to add an E2E test suite for the browser extension.

@diivi
Copy link
Contributor

diivi commented Aug 4, 2023

I'll check this out.

@nickytonline
Copy link
Member Author

nickytonline commented Aug 4, 2023

The linked article mentions unzipping the browser extension. This isn't necessary. In the case of the OpenSauced extension, we just need to build the extension then hook up Cypress with the dist folder for the extension after building it.

@diivi diivi mentioned this issue Aug 4, 2023
19 tasks
@nickytonline
Copy link
Member Author

nickytonline commented Aug 4, 2023

@diivi, I tested your PR and the test works. I was digging a bit and it looks like Cypress does not appear to be able to open the extension popup (see cypress-io/cypress#14808), but Playwright supports this (see https://github.com/microsoft/playwright/blob/b3ce913551b88d14e06006d06f0e0a8d2346f665/docs/src/chrome-extensions-js-python.md?plain=1#L194 as an example test).

If you need the ID of the Chrome extension, it's pplnlkccgafncfoncmepefkcgjejfmge.

The PR you put up is for exploratory purposes, so see if you're able to trigger the popup with Playwright as there is a lot going on in the popup.

You don't have to do the whole flow with CI/CD, just a quick proof of concept.

Example test:

const EXTENSION_ID = 'pplnlkccgafncfoncmepefkcgjejfmge';

test('popup page', async ({ page, extensionId }) => {
  await page.goto(`chrome-extension://${EXTENSION_ID}/popup.html`);
  await expect(page.getByRole('link', { name: 'OpenSauced' })).toBeVisible();
});

Additional links:

@github-actions
Copy link

github-actions bot commented Sep 1, 2023

🎉 This issue has been resolved in version 1.14.1-beta.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Nov 1, 2023

🎉 This issue has been resolved in version 1.14.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants