Skip to content

CI: Unit and integration tests - #2

Merged
WezSieTato merged 10 commits into
masterfrom
feature/CI
Jul 1, 2026
Merged

CI: Unit and integration tests#2
WezSieTato merged 10 commits into
masterfrom
feature/CI

Conversation

@WezSieTato

Copy link
Copy Markdown
Member

No description provided.

Comment thread README.rst Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 validateEAN into lib/validateEAN.js and 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.

Comment thread lib/validateEAN.js
Comment thread lib/validateEAN.js Outdated
Comment thread README.rst Outdated
Comment thread README.rst Outdated
Comment thread .github/workflows/integration_tests.yml Outdated
Comment thread test/popup.test.js Outdated
WezSieTato and others added 5 commits July 1, 2026 10:39
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>
@WezSieTato
WezSieTato merged commit 83d11d8 into master Jul 1, 2026
4 checks passed
@WezSieTato
WezSieTato deleted the feature/CI branch July 1, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants