{"id":23170168,"url":"https://github.com/gbuomprisco/caravaggio","last_synced_at":"2026-05-15T13:02:37.382Z","repository":{"id":57194289,"uuid":"76778296","full_name":"Gbuomprisco/caravaggio","owner":"Gbuomprisco","description":"Caravaggio is a simple visual regression testing plugin for Protractor.","archived":false,"fork":false,"pushed_at":"2017-05-16T10:39:56.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-09T10:02:21.426Z","etag":null,"topics":["angular","e2e","e2e-tests","protractor","screenshots-comparison","visual-regression"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gbuomprisco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-18T11:13:54.000Z","updated_at":"2018-10-18T15:51:12.000Z","dependencies_parsed_at":"2022-08-24T13:30:19.552Z","dependency_job_id":null,"html_url":"https://github.com/Gbuomprisco/caravaggio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gbuomprisco%2Fcaravaggio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gbuomprisco%2Fcaravaggio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gbuomprisco%2Fcaravaggio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gbuomprisco%2Fcaravaggio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gbuomprisco","download_url":"https://codeload.github.com/Gbuomprisco/caravaggio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247261603,"owners_count":20910108,"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":["angular","e2e","e2e-tests","protractor","screenshots-comparison","visual-regression"],"created_at":"2024-12-18T03:26:04.734Z","updated_at":"2025-10-12T19:43:24.687Z","avatar_url":"https://github.com/Gbuomprisco.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Caravaggio\n\nCaravaggio is a simple visual regression testing plugin for Protractor. \n\n## Install\n        \n    npm install caravaggio-protractor --save-dev\n\n## Quick Start\n\n### Add Caravaggio to the Protractor's configuration\n\n```javascript\n// protractor.conf\n\n// if you use typescript\nimport { Caravaggio } from 'caravaggio-protractor';\n\n// or if you use node\nconst Caravaggio = require('caravaggio-protractor').Caravaggio;\n\nexports.config = {\n    // add caravaggio to the plugins array and define its options\n    plugins: [{\n        package: 'caravaggio-protractor',\n        screenshotsPath: '/path/to/my/screenshots', // please create the 'screenshots' folder if missing\n    }],\n\n    // add caravaggio to the params object\n    params: {\n        caravaggio: new Caravaggio()\n    },\n\n    // rest of the Protractor's configuration\n};\n```\n\n### Take screenshots in your tests using Caravaggio\nWe need to retrieve Caravaggio using the Protractor's browser parameters, which we defined in the config.\nIn order to create a comparison, you can use `caravaggio.capture(name)` - and a new screenshot will be generated using the name provided.\n\n\n```javascript\nimport { browser } from 'protractor';\nconst caravaggio = browser.params.caravaggio;\n\nit('does something I expect in page \"about\"', () =\u003e {\n    caravaggio.capture('about');\n\n    clickOnButton().then(() =\u003e {\n        // target full page\n        caravaggio.capture('about-button-clicked');\n        \n        // target a specific selector\n        caravaggio.capture('about-button-clicked--header', '.header');\n    });\n});\n\n```\nEvery time a screenshot is taken for the first time, Caravaggio adds it as a baseline image.\n\nIf you think that a change in your application needs to be the new standard instead, just delete the file in the folder `screenshotsPath/standard`.    \n\nCaravaggio fully integrates with Protractor: failures will be added to the reports at the end of the tests, and so will successful tests.\n\n## API\nPlugin configuration\n\n```javascript\n{\n    package: 'caravaggio-protractor',        // name of the package (mandatory)\n    screenshotsPath: '/path/to/screenshots', // path to screenshots folder (default './screenshots')\n    tolerance: 0,                            // mismatch tolerance expressed in percentage (default 0)\n\n    onFailure: (Result) =\u003e any,              // callback when a test fails\n    onSuccess: (Result) =\u003e any,          // callback when a test passes\n    onComplete: () =\u003e any,                   // callback all tests complete\n    onNewImage: (fileName: string) =\u003e any,   // callback when a baseline image is created\n\n    // image comparison function, you can overwrite it and use your own (or using a different library)\n    // as long as it returns a Result (see interface below)\n    imageComparisonFn: (fileName: string, tolerance: number) =\u003e Result\n}\n```\n\n`Result` interface:\n\n```javascript\ninterface Result {\n    hasPassed: boolean;\n    differences: number;\n    name: string;\n}\n```\n\n### Add screenshots folder to your .gitignore\n\nAdd `${screenshotsPath}/actual` and `${screenshotsPath}/diff` as you do not want to have these images in your repository.\n\n### Image comparison\n\nThe default comparison between screenshots is based on the library [PixelDiff](https://github.com/koola/pixel-diff), but you can write your own if you prefer.\n\n### Support for other frameworks\n\nSupport for more frameworks may follow. I am planning to decouple Caravaggio from Protractor.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbuomprisco%2Fcaravaggio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgbuomprisco%2Fcaravaggio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbuomprisco%2Fcaravaggio/lists"}