{"id":28515032,"url":"https://github.com/percy/percy-playwright-java","last_synced_at":"2026-03-13T08:10:40.460Z","repository":{"id":244811798,"uuid":"814106530","full_name":"percy/percy-playwright-java","owner":"percy","description":"Percy visual testing for Java Playwright","archived":false,"fork":false,"pushed_at":"2026-03-09T12:07:23.000Z","size":80,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-03-09T16:55:39.184Z","etag":null,"topics":["java","percy","percy-sdk","playwright","playwright-java","visual-testing"],"latest_commit_sha":null,"homepage":"","language":"Java","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/percy.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-12T10:57:14.000Z","updated_at":"2025-04-17T06:48:34.000Z","dependencies_parsed_at":"2024-06-17T16:46:07.742Z","dependency_job_id":null,"html_url":"https://github.com/percy/percy-playwright-java","commit_stats":null,"previous_names":["percy/percy-playwright-java"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/percy/percy-playwright-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/percy%2Fpercy-playwright-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/percy%2Fpercy-playwright-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/percy%2Fpercy-playwright-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/percy%2Fpercy-playwright-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/percy","download_url":"https://codeload.github.com/percy/percy-playwright-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/percy%2Fpercy-playwright-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30462087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T06:34:02.089Z","status":"ssl_error","status_checked_at":"2026-03-13T06:33:49.182Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["java","percy","percy-sdk","playwright","playwright-java","visual-testing"],"created_at":"2025-06-09T02:35:16.828Z","updated_at":"2026-03-13T08:10:40.447Z","avatar_url":"https://github.com/percy.png","language":"Java","readme":"# percy-playwright-java\n![Test](https://github.com/percy/percy-playwright-java/workflows/Test/badge.svg)\n\n[Percy](https://percy.io) visual testing for Java Playwright.\n\n## Installation\n\nnpm install `@percy/cli`:\n\n```sh-session\n$ npm install --save-dev @percy/cli\n```\n\nAdd percy-playwright-java to your project dependencies. If you're using Maven:\n\n``` xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.percy\u003c/groupId\u003e\n  \u003cartifactId\u003epercy-playwright-java\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.2-beta.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\nThis is an example test using the `percy.snapshot` function.\n\n``` java\n// import ...\nimport io.percy.playwright;\n\npublic class Example {\n    private static Browser browser;\n    private static BrowserContext context;\n    private static Page page;\n    private static Percy percy;\n\n    public static void main(String[] args) {\n        browser = playwright.firefox().launch(new BrowserType.LaunchOptions().setHeadless(false));\n        context = browser.newContext();\n        page = context.newPage();\n        percy = new Percy(page);\n        percy.snapshot(\"Java example\");\n    }\n}\n```\n\nRunning the test above normally will result in the following log:\n\n```sh-session\n[percy] Percy is not running, disabling snapshots\n```\n\nWhen running with [`percy\nexec`](https://github.com/percy/cli/tree/master/packages/cli-exec#percy-exec), and your project's\n`PERCY_TOKEN`, a new Percy build will be created and snapshots will be uploaded to your project.\n\n```sh-session\n$ export PERCY_TOKEN=[your-project-token]\n$ percy exec -- [java test command]\n[percy] Percy has started!\n[percy] Created build #1: https://percy.io/[your-project]\n[percy] Snapshot taken \"Java example\"\n[percy] Stopping percy...\n[percy] Finalized build #1: https://percy.io/[your-project]\n[percy] Done!\n```\n\n## Configuration\n\nThe snapshot method arguments:\n\n`percy.snapshot(name, widths[], minHeight, enableJavaScript, percyCSS, scope)`\n\n- `name` (**required**) - The snapshot name; must be unique to each snapshot\n- Additional snapshot options (overrides any project options):\n    - `widths` - An array of widths to take screenshots at\n    - `minHeight` - The minimum viewport height to take screenshots at\n    - `enableJavaScript` - Enable JavaScript in Percy's rendering environment\n    - `percyCSS` - Percy specific CSS only applied in Percy's rendering\n      environment\n    - `scope` - A CSS selector to scope the screenshot to\n\n    \n## Percy on Automate\n\n## Usage\n\nThis is an example test using the `percy.screenshot` function.\n\n``` java\nimport io.percy.playwright;\n\npublic class Example {\n    private static Percy percy;\n\n    public static void main(String[] args) {\n        JsonObject capabilitiesObject = new JsonObject();\n        capabilitiesObject.addProperty(\"browser\", \"chrome\");    // allowed browsers are `chrome`, `edge`, `playwright-chromium`, `playwright-firefox` and `playwright-webkit`\n        capabilitiesObject.addProperty(\"browser_version\", \"latest\");\n        capabilitiesObject.addProperty(\"os\", \"osx\");\n        capabilitiesObject.addProperty(\"os_version\", \"catalina\");\n        capabilitiesObject.addProperty(\"name\", \"Playwright\");\n        capabilitiesObject.addProperty(\"build\", \"Playwright-Java\");\n        capabilitiesObject.addProperty(\"browserstack.username\", \"\u003cusername\u003e\");\n        capabilitiesObject.addProperty(\"browserstack.accessKey\", \"\u003caccessKey\u003e\");\n\n        BrowserType chromium = playwright.chromium();\n        String caps = URLEncoder.encode(capabilitiesObject.toString(), \"utf-8\");\n        String ws_endpoint = \"wss://cdp.browserstack.com/playwright?caps=\" + caps;\n        Browser browser = chromium.connect(ws_endpoint);\n        Page page = browser.newPage();\n        page.navigate(\"https://percy.io\");\n        percy = new Percy(page);\n        percy.screenshot(\"Screenshot-1\");\n    }\n}\n```\n\n- `page` (**required**) - A playwright page instance\n- `name` (**required**) - The screenshot name; must be unique to each screenshot\n- `options` (**optional**) - There are various options supported by percy.screenshot to server further functionality.\n    - `sync` - Boolean value by default it falls back to false, Gives the processed result around screenshot [From CLI v1.28.8]\n    - `fullPage` - Boolean value by default it falls back to `false`, Takes full page screenshot [From CLI v1.28.8]\n    - `freezeAnimatedImage` - Boolean value by default it falls back to `false`, you can pass `true` and percy will freeze image based animations.\n    - `freezeImageBySelectors` - List of selectors. Images will be freezed which are passed using selectors. For this to work `freezeAnimatedImage` must be set to true.\n    - `freezeImageByXpaths` - List of xpaths. Images will be freezed which are passed using xpaths. For this to work `freezeAnimatedImage` must be set to true.\n    - `percyCSS` - Custom CSS to be added to DOM before the screenshot being taken. Note: This gets removed once the screenshot is taken.\n    - `ignoreRegionXpaths` - List of xpaths. elements in the DOM can be ignored using xpath\n    - `ignoreRegionSelectors` - List of selectors. elements in the DOM can be ignored using selectors.\n    - `customIgnoreRegions` - List of custom objects. elements can be ignored using custom boundaries\n    - Refer to example -\n        - ```\n            List\u003cHashMap\u003e customRegion = new ArrayList\u003c\u003e();\n            HashMap\u003cString, Integer\u003e region1 = new HashMap\u003c\u003e();\n            region1.put(\"top\", 10);\n            region1.put(\"bottom\", 110);\n            region1.put(\"right\", 10);\n            region1.put(\"left\", 120);\n            customRegion.add(region1);\n            options.put(\"custom_ignore_regions\", customRegion);\n          ```\n\n        - Parameters:\n            - `top` (int): Top coordinate of the ignore region.\n            - `bottom` (int): Bottom coordinate of the ignore region.\n            - `left` (int): Left coordinate of the ignore region.\n            - `right` (int): Right coordinate of the ignore region.\n    - `considerRegionXpaths` - List of xpaths. elements in the DOM can be considered for diffing and will be ignored by Intelli Ignore using xpaths.\n    - `considerRegionSelectors` - List of selectors. elements in the DOM can be considered for diffing and will be ignored by Intelli Ignore using selectors.\n    - `customConsiderRegions` - List of custom objects. elements can be considered for diffing and will be ignored by Intelli Ignore using custom boundaries\n        - Refer to example -\n            - ```\n          List\u003cHashMap\u003e customRegion = new ArrayList\u003c\u003e();\n          HashMap\u003cString, Integer\u003e region2 = new HashMap\u003c\u003e();\n          region2.put(\"top\", 10);\n          region2.put(\"bottom\", 110);\n          region2.put(\"right\", 10);\n          region2.put(\"left\", 120);\n          customRegion.add(region2);\n          options.put(\"custom_consider_regions\", customRegion);\n        ```\n            - Parameters:\n                - `top` (int): Top coordinate of the consider region.\n                - `bottom` (int): Bottom coordinate of the consider region.\n                - `left` (int): Left coordinate of the consider region.\n                - `right` (int): Right coordinate of the consider region.\n    - `regions` parameter that allows users to apply snapshot options to specific areas of the page. This parameter is an array where each object defines a custom region with configurations.\n      - Parameters:\n        - `elementSelector` (optional, only one of the following must be provided, if this is not provided then full page will be considered as region)\n            - `boundingBox` (object): Defines the coordinates and size of the region.\n              - `x` (number): X-coordinate of the region.\n              - `y` (number): Y-coordinate of the region.\n              - `width` (number): Width of the region.\n              - `height` (number): Height of the region.\n            - `elementXpath` (string): The XPath selector for the element.\n            - `elementCSS` (string): The CSS selector for the element.\n\n        - `algorithm` (mandatory)\n            - Specifies the snapshot comparison algorithm.\n            - Allowed values: `standard`, `layout`, `ignore`, `intelliignore`.\n\n        - `configuration` (required for `standard` and `intelliignore` algorithms, ignored otherwise)\n            - `diffSensitivity` (number): Sensitivity level for detecting differences.\n            - `imageIgnoreThreshold` (number): Threshold for ignoring minor image differences.\n            - `carouselsEnabled` (boolean): Whether to enable carousel detection.\n            - `bannersEnabled` (boolean): Whether to enable banner detection.\n            - `adsEnabled` (boolean): Whether to enable ad detection.\n\n         - `assertion` (optional)\n            - Defines assertions to apply to the region.\n            - `diffIgnoreThreshold` (number): The threshold for ignoring minor differences.\n\n### Example Usage for regions\n\n```\n        Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n        params.put(\"elementXpath\", \"//div[@id='test']\");\n        params.put(\"algorithm\", \"standard\");\n        params.put(\"diffSensitivity\", 3);\n        params.put(\"imageIgnoreThreshold\", 0.2);\n        params.put(\"carouselsEnabled\", true);\n        params.put(\"bannersEnabled\", false);\n        params.put(\"adsEnabled\", true);\n        params.put(\"diffIgnoreThreshold\", 0.1);\n\n        // Call the method to create the region\n        Map\u003cString, Object\u003e regions2 = percy.createRegion(params);\n        List\u003cMap\u003cString, Object\u003e\u003e regions = Collections.singletonList(obj1);\n        Map\u003cString, Object\u003e options = new HashMap\u003c\u003e();\n        options.put(\"regions\", regions);\n\n        percy.snapshot(\"Homepage\", options); \n\n```\n\n### Creating Percy on automate build\nNote: Automate Percy Token starts with `auto` keyword. The command can be triggered using `exec` keyword.\n```sh-session\n$ export PERCY_TOKEN=[your-project-token]\n$ percy exec -- [java test command]\n[percy] Percy has started!\n[percy] [Java example] : Starting automate screenshot ...\n[percy] Screenshot taken \"Java example\"\n[percy] Stopping percy...\n[percy] Finalized build #1: https://percy.io/[your-project]\n[percy] Done!\n```\n\nRefer to docs here: [Percy on Automate](https://www.browserstack.com/docs/percy/integrate/functional-and-visual)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercy%2Fpercy-playwright-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpercy%2Fpercy-playwright-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercy%2Fpercy-playwright-java/lists"}