CI: Unit and integration tests - #2
Merged
Merged
Conversation
WezSieTato
commented
Jul 1, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial automated test setup (unit + E2E/integration) for the Pola browser extension, and refactors EAN validation into a shared module so it can be reused by both the content script and tests.
Changes:
- Added Jest unit tests for EAN validation and popup rendering/behavior (with a Chrome API mock).
- Added Playwright E2E tests that inject the extension’s scripts into real store pages to verify EAN detection.
- Refactored
validateEANintolib/validateEAN.jsand updated the popup to inject it before the content script; added GitHub Actions workflows to run tests.
Reviewed changes
Copilot reviewed 12 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
test/validateEAN.test.js |
New unit tests for EAN-8/EAN-13 validation behavior. |
test/popup.test.js |
New jsdom-based unit tests for popup UI logic and API/cache handling. |
test/mocks/chrome.js |
Chrome API mock used by popup unit tests. |
test-e2e/ean-detection.spec.js |
New Playwright spec that validates EAN detection on real product pages. |
README.rst |
Documents supported stores / planned support list. |
popup/pola.js |
Injects lib/validateEAN.js before the content script; exports Pola in test environments. |
playwright.config.js |
Playwright configuration targeting test-e2e/. |
package.json |
Adds Node tooling + scripts for unit and integration tests. |
package-lock.json |
Locks Jest/Playwright dependency tree for CI reproducibility. |
lib/validateEAN.js |
New shared EAN validation implementation (used by tests and injected into pages). |
jest.config.js |
Jest configuration (jsdom environment, test match). |
content_scripts/pola.js |
Removes duplicated inline validateEAN implementation (now relies on injected shared one). |
.gitignore |
Ignores node_modules/ and Playwright/Jest output (test-results). |
.github/workflows/unit_tests.yml |
CI job to run Jest unit tests on pushes/PRs. |
.github/workflows/integration_tests.yml |
CI job to run Playwright integration tests on pushes/PRs + schedule. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.