{"id":20293012,"url":"https://github.com/gemini-testing/playwright-utils","last_synced_at":"2026-05-12T09:36:48.523Z","repository":{"id":196150070,"uuid":"694170014","full_name":"gemini-testing/playwright-utils","owner":"gemini-testing","description":"Custom playwright utilities","archived":false,"fork":false,"pushed_at":"2023-11-30T11:37:40.000Z","size":392,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-01-14T09:16:10.450Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gemini-testing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-20T13:16:42.000Z","updated_at":"2024-02-26T23:15:49.000Z","dependencies_parsed_at":"2023-09-27T16:33:22.714Z","dependency_job_id":"e98df3a7-09b4-48fc-b515-b32afb3475de","html_url":"https://github.com/gemini-testing/playwright-utils","commit_stats":null,"previous_names":["gemini-testing/playwright-utils"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemini-testing%2Fplaywright-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemini-testing%2Fplaywright-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemini-testing%2Fplaywright-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemini-testing%2Fplaywright-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gemini-testing","download_url":"https://codeload.github.com/gemini-testing/playwright-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241787485,"owners_count":20020101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T15:20:40.340Z","updated_at":"2026-05-12T09:36:48.492Z","avatar_url":"https://github.com/gemini-testing.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# playwright-utils\n\nUsefull [playwright][pwt] utilities, such as fixtures, custom commands and matchers.\n\n## Installation\n\n```bash\nnpm install --save-dev @gemini-testing/playwright-utils\n```\n\n## Contents\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Matchers](#matchers)\n  - [ToMatchScreenshot](#tomatchscreenshot)\n    - [Usage](#usage)\n    - [Migration from `toHaveScreenshot`:](#migration-from-tohavescreenshot)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Matchers\n- [toMatchScreenshot](#tomatchscreenshot)\n\n### ToMatchScreenshot\n\n[looks-same][looks-same] based visual comparison. It uses [CIEDE2000][ciede2000] based tolerance instead of pixelmatch (which is used under the hood of `toHaveScreenshot`) [YIQ NTSC transmission color space][yiq-ntsc] threshold, which has [severe problems](https://github.com/mapbox/pixelmatch/issues/127) calculating the color difference in shades of blue.\n\n#### Usage\n\nSetup:\n\n```typescript\n// playwright.ts\nimport { test as base, expect } from \"@playwright/test\";\nimport { createMatchersFixture, type PlaywrightUtilsOptions } from \"@gemini-testing/playwright-utils\";\n\nconst test = base.extend\u003cPlaywrightTestOptions \u0026 PlaywrightUtilsOptions\u003e({\n    ...createMatchersFixture(expect)\n});\n\nexport { test, expect };\n```\n\n```typescript\n// playwright.config.ts\nimport { defineConfig, type PlaywrightTestOptions } from \"@playwright/test\";\nimport type { PlaywrightUtilsOptions } from \"@gemini-testing/playwright-utils\";\n\nexport default defineConfig\u003cPlaywrightTestOptions, PlaywrightUtilsOptions\u003e({\n    // ...\n    use: {\n        // ...\n        toMatchScreenshot: {\n            // Default project config\n            tolerance: 2.3,\n            antialiasingTolerance: 4,\n            maxDiffPixels: 0,\n            maxDiffPixelRatio: 0,\n            stopOnFirstImageDiff: false,\n            saveImageOnScreenshotMatch: true,\n            animations: \"disabled\",\n            caret: \"hide\",\n            maskColor: \"#FF00FF\",\n            scale: \"css\",\n            timeout: 30000,\n            fullPage: false,\n        }\n    }\n});\n```\n\nUsage:\n\n```typescript\nawait expect(page.locator(\"body\")).toMatchScreenshot(\"plain\", {\n    // Comparison options, have higher priority than project options\n    maxDiffPixels: 3\n});\n```\n\nArgs:\n- snapshotName: `string`\n- opts?: `Object`\n  - [tolerance][looks-same-tolerance]: `number`\n  - [antialiasingTolerance][looks-same-antialiasing-tolerance]: `number`\n  - [shouldCluster][looks-same-diff-clusters]: `boolean` - Used by [html-reporter][html-reporter]'s diffBubbles\n  - [clustersSize][looks-same-diff-clusters]: `number` - Used by [html-reporter][html-reporter]'s diffBubbles\n  - [maxDiffPixels][pwt-max-diff-pixels]: `number`\n  - [maxDiffPixelRatio][pwt-max-diff-pixels-ratio]: `number`\n  - [stopOnFirstImageDiff]: `boolean` - Stop test execution immediately after image comparison error\n  - [saveImageOnScreenshotMatch]: `boolean` - Save image on image comparison success (used by reporters)\n  - [animations][pwt-animations]: `\"disabled\" | \"allow\"`\n  - [caret][pwt-caret]: `\"hide\" | \"initial\"`\n  - [maskColor][pwt-mask-color]: `string`\n  - [scale][pwt-scale]: `\"css\" | \"device\"`\n  - [fullPage][pwt-full-page]: `boolean`\n  - timeout: `number` - Screenshot capturing timeout\n\n#### Migration from `toHaveScreenshot`:\n\n- If you have `toHaveScreenshot` calls without specified `name`, it is required to name them.\n- Move contents of your `toHaveScreenshot` options from `expect` section of playwright config to `toMatchScreenshot` at `use` section of playwright config, then remove `threshold` property (`toMatchScreenshot` uses `tolerance` instead. Preferred value is 2.3).\n\n**Note**: Screenshot comparison errors, caused by `toMatchScreenshot`, won't stop test execution by default. You can configure it with `stopOnFirstImageDiff` option.\n\n[pwt]: https://playwright.dev/\n[looks-same]: https://github.com/gemini-testing/looks-same\n[ciede2000]: https://en.wikipedia.org/wiki/Color_difference#CIEDE2000\n[yiq-ntsc]: http://www.progmat.uaem.mx:8080/artVol2Num2/Articulo3Vol2Num2.pdf\n[looks-same-tolerance]: https://github.com/gemini-testing/looks-same#comparing-images\n[looks-same-antialiasing-tolerance]: https://github.com/gemini-testing/looks-same#comparing-images-with-ignoring-antialiasing\n[looks-same-diff-clusters]: https://github.com/gemini-testing/looks-same#getting-diff-clusters\n[pwt-max-diff-pixels]: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-max-diff-pixels\n[pwt-max-diff-pixels-ratio]: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-max-diff-pixel-ratio\n[pwt-animations]: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-animations\n[pwt-caret]: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-caret\n[pwt-mask-color]: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-mask-color\n[pwt-scale]: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-scale\n[pwt-full-page]: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-full-page\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemini-testing%2Fplaywright-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgemini-testing%2Fplaywright-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemini-testing%2Fplaywright-utils/lists"}