Base64 fix and test cases refactor to use real browser#116
Merged
Conversation
Rewrite safeBtoa to prefer Buffer when available and fall back to a chunked btoa with a manual UTF-8 encoder, throwing a clear error when neither is available. Removes reliance on a Node-only code path. - test: migrate suite from mocha/sinon/nyc to Playwright (test-app) - ci: replace nodejs.yml with ci.yml; rename npmpublish.yml to publish-npm.yml - chore: drop mocha/chai/sinon/nyc/codecov and related devDependencies - docs: remove Codecov badge from README - chore: add LICENSE and set license to Apache-2.0
…s for Hindi characters
There was a problem hiding this comment.
Pull request overview
This PR fixes Unicode-safe Base64 encoding used in transformation overlays and refactors the test suite to run against the real built SDK in Chromium via Playwright (instead of Node + sinon/mocha). It also introduces release-please automation and updates CI/publishing workflows, alongside removing legacy tests and the old sample app.
Changes:
- Fix
safeBtoato correctly Base64-encode UTF-8 strings in browser environments (e.g., Hindi text overlays). - Migrate URL-generation, responsive attributes, and upload tests from Node/mocha to Playwright using a browser-hosted test app.
- Add release automation (release-please) and update GitHub Actions workflows; remove legacy CI/test tooling and sample app.
Reviewed changes
Copilot reviewed 36 out of 40 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/url-generation/overlay.js | Removed legacy mocha/chai overlay URL-generation tests (migrated to Playwright). |
| test/url-generation/buildtransformationString.js | Removed legacy mocha/chai transformation-string unit tests (migrated to Playwright). |
| test/upload.js | Removed legacy sinon fake-XHR upload tests (migrated to Playwright network interception). |
| test/setup.js | Removed Node polyfill-based test setup no longer used after Playwright migration. |
| test/responsive.js | Removed legacy responsive attributes tests (migrated to Playwright). |
| test-app/tests/upload.spec.ts | New Playwright upload suite using real Chromium + route interception and multipart parsing. |
| test-app/tests/responsive.spec.ts | New Playwright suite for getResponsiveImageAttributes running against the built bundle. |
| test-app/tests/overlay.spec.ts | New Playwright suite covering overlay URL generation and encoding (incl. Unicode/base64 cases). |
| test-app/tests/fixtures.ts | Shared Playwright fixture that loads /test-app/index.html and waits for SDK globals. |
| test-app/tests/buildTransformationString.spec.ts | New Playwright tests for buildTransformationString. |
| test-app/tests/basic.spec.ts | Converted basic URL-generation tests from mocha/chai to Playwright. |
| test-app/server.mjs | Added a minimal static server for Playwright’s webServer to serve repo root/test app. |
| test-app/playwright.config.ts | Added Playwright configuration (Chromium project + webServer). |
| test-app/package.json | Added isolated test-app package to run Playwright tests and host the server. |
| test-app/package-lock.json | Lockfile for test-app Playwright dependencies. |
| test-app/index.html | Browser harness that imports the built ESM bundle and exposes SDK functions on window. |
| test-app/.gitignore | Ignores test-app node_modules and Playwright artifacts. |
| src/utils/transformation.ts | Updated safeBtoa to be UTF-8 safe in browsers and prefer Buffer when available. |
| src/url.ts | Treat ff like di for slash-to-@@ conversion (font family paths in overlays). |
| samples/sample-app/views/index.pug | Removed legacy sample app view. |
| samples/sample-app/server/server.js | Removed legacy sample app server. |
| samples/sample-app/sample.env | Removed sample env template. |
| samples/sample-app/package.json | Removed sample app package manifest. |
| samples/sample-app/index.js | Removed sample app entry point. |
| release-please-config.json | Added release-please configuration. |
| README.md | Removed Codecov badge (but other badges now need updating to match new CI/license). |
| package.json | Removed mocha/nyc/chai tooling, switched tests to Playwright, updated license metadata. |
| LICENSE | Added Apache-2.0 license text (license change). |
| babel-register.js | Removed Babel register helper no longer needed after mocha removal. |
| .release-please-manifest.json | Added release-please manifest pinning current version. |
| .nycrc.json | Removed nyc config (nyc no longer used). |
| .mocharc.json | Removed mocha config (mocha no longer used). |
| .gitignore | Simplified node_modules ignore patterns. |
| .github/workflows/sync-release-as.yml | Added workflow to sync Release-As based on release PR title edits. |
| .github/workflows/release-please.yml | Added workflow to run release-please on pushes to master. |
| .github/workflows/publish-npm.yml | Updated npm publish workflow (OIDC provenance publish, modern actions versions). |
| .github/workflows/nodejs.yml | Removed old Node CI workflow. |
| .github/workflows/ci.yml | Added new CI workflow building SDK and running Playwright tests. |
Files not reviewed (1)
- test-app/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.