{"id":13802022,"url":"https://github.com/katat/vbot","last_synced_at":"2025-10-14T18:44:14.726Z","repository":{"id":72091945,"uuid":"77106276","full_name":"katat/vbot","owner":"katat","description":"JSON based visual regression testing library. Liberate creativity, minimize repeated works :v:","archived":false,"fork":false,"pushed_at":"2018-02-12T07:08:54.000Z","size":3027,"stargazers_count":97,"open_issues_count":6,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-13T12:49:25.676Z","etag":null,"topics":["agile","chrome","devops","frontend-web","javascript","nodejs","test-automation","visual-regression"],"latest_commit_sha":null,"homepage":"https://vbot.io","language":"JavaScript","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/katat.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-12-22T03:02:08.000Z","updated_at":"2025-04-08T23:50:33.000Z","dependencies_parsed_at":"2023-11-04T00:45:11.493Z","dependency_job_id":null,"html_url":"https://github.com/katat/vbot","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/katat/vbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katat%2Fvbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katat%2Fvbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katat%2Fvbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katat%2Fvbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katat","download_url":"https://codeload.github.com/katat/vbot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katat%2Fvbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020360,"owners_count":26086867,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["agile","chrome","devops","frontend-web","javascript","nodejs","test-automation","visual-regression"],"created_at":"2024-08-04T00:01:33.425Z","updated_at":"2025-10-14T18:44:14.691Z","avatar_url":"https://github.com/katat.png","language":"JavaScript","readme":"# VBot\n\u003e A visual regression testing library/tool, aims to quickly automate browser-based tests with minimum development overhead.\n\nThe [article](http://katat.me/2017/01/09/vbot/) describes more details behind the motivation.\n\n## Features\n - **JSON-based**\n test steps, clearer to have one to one action mapping to browser interactions\n - **Chrome**\n  is used to automate the testings, can run in headless mode or with a visible browser window during testing\n - **Programming or CLI mode**\n support testing with frameworks like mocha, or with VBot's command line tool\n - **Screenshot Comparison**\n done automatically by comparing with previous screenshots, no more eye workouts!\n\n ![diff](img/8_reload_page_diff.png)\n\n## Preview\n![vbot cli](img/vbot-cli.gif)\n\n## Requirements\n - Node 6 or later\n - Chrome 59 or later\n\n## Install\n`npm install vbot`\n\n## Test modes\nVBot supports testings in both programming mode or CLI mode.\n\n### Programming mode\nTo test flexibly in different testing scenarios, either testing against web UI wired with backends or just static web page, VBot exposes API to be used with testing frameworks like [mocha](https://mochajs.org/) or [ava](https://github.com/avajs/ava) etc. Therefore, the test data variables can be updated according to different conditions, in order to decouple from real backends and avoid false negative results.\n\n------------\n#### Mocha example\n\n```javascript\ndescribe('examples', () =\u003e {\n  let vbot\n  afterEach((done) =\u003e {\n    //close chrome instance after each test case\n    vbot.close().then(done)\n  });\n  it('todo', function (done) {\n    vbot = new VBot({\n      imgdir    : `${testPath}/tmp/screenshots`,//specify custom screenshots' file paths\n      rebase    : process.env.REBASE,// rebase, default false\n      verbose   : true, //verbose logs, default true\n      showWindow: process.env.WINDOW// show Chrome window, default false\n    })\n    //pass in the playbook JSON\n    vbot.start({\n      //web page url to open in chrome instance before testing\n      url: `file:///${testPath}/fixtures/todo/index.html`,\n      //name for this test case. If imgdir option is not specified, it will use this name as a screenshot folder\n      scenario: \"todo\",\n      //size for the chrome instance window\n      size: {width: 375, height: 677},\n      //test steps that will be executed in order\n      actions: [\n        //For all the support actions types and related attributes, please refer to the action tests\n        {type: \"click\", selector:\"input#item\"},\n        {type: \"typing\", value: \"drink milk\", enter:true, tab:false},\n        {type: \"typing\", value: \"drink coffee\", enter:true, tab:false},\n        {type: \"typing\", value: \"go to work\", enter:false, tab:false},\n        {type: \"click\", selector:\"button#add\u003esvg\"},\n        //comment will be used as the screenshot file name, otherwise selectorstring will be used\n        {type: \"click\", comment: \"done milk\", selector:\"ul#todo\u003eli:nth-child(3)\u003ediv\u003ebutton:nth-child(2)\u003esvg\", screenshot:true},\n        {type: \"click\", comment: \"done coffee\", selector:\"ul#todo\u003eli:nth-child(2)\u003ediv\u003ebutton:nth-child(2)\u003esvg\", screenshot:true},\n        {type: \"click\", comment: \"remove work\", selector:\"ul#todo\u003eli\u003ediv\u003ebutton:nth-child(1)\u003esvg\", screenshot:true},\n        {type: \"reload\", comment: \"reload page\", screenshot:true}\n      ]\n    })\n    vbot.on('action.executed', (log) =\u003e {})//event when an action executed successfully\n    vbot.on('screenshot.diff', (data) =\u003e {})//event when there are differences from screenshot comparison\n    vbot.on('action.fail', (log) =\u003e {})//event when an action failed to execute\n    vbot.on('end', () =\u003e {//event when test case ended\n      done()\n    })\n  });\n});\n```\n\nLet me demo by testing a nice todo app created by [themaxsandelin](https://github.com/themaxsandelin/todo). The code above is from the [test case](test/src/example-todo.js).\n\nTo see how this example work in action, you can clone code of this repository and go to the folder in command line, install the node modules by `npm install`.\n\nThen you can get a feeling of how it works by running following test commands that runs mocha tests.\n\n##### *Headless mode*\nTo run the demo todo app test and take screenshot:\n\n`npm test -- -g \"todo\"`\n\nIt will execute the test with Chrome in headless mode. You should see the verbose logs, and screenshots taken in folder `/test/tmp/screenshots/todo`\n\n##### *Visible mode*\nTo see the tests running on Chrome visibly:\n\n`WINDOW=true npm test -- -g \"todo\"`\n\n##### *Screenshot comparison*\nThe result of the screenshot comparison are the screenshots with difference highlighted. Let's modify the [TODO](test/fixtures/todo) app to disable the `localStorage` related logics, and run the example above again in headless mode.\n\nNow there should be one `diff` screenshot created for the last action step, which is the screenshot after reloaded the web page, because of the modified code leading to a different `test` screenshot:\n\n![baseline](img/diff.png)\n\n##### *Rebase*\nTry to update tests or the code in the demo todo app and VBot should automatically highlight the differences of the screenshots between previous and current version.\n\nTo rebase screenshots:\n\n`REBASE=true npm test -- -g \"todo\"`\n\n--------------------\n\n### Playbook schema\nThe schema is defined using [ajv](https://github.com/epoberezkin/ajv). For the schema details, please refer to [playbook schema definitions](src/schema/playbook.json)\n\n### Supported actions\nPlease refer to respective [mocha tests](test/src/actions.js)\n\n### Screenshot directory\n```\n├── scenario name\n      ├── base //baseline screenshots\n      ├── test //screenshots from last test\n      └── diff //screenshots with differences highlighted\n```\n\n### Events\n\n - `action.executed` when an action executed successfully\n - `screenshot.diff` when there are differences from screenshot comparison\n - `action.fail` when an action failed to execute\n - `end` when test case ended\n\n### CLI mode\nPlease see [CLI readme](cli.md)\n\n## Online Playbook Editor\nThere is an [web UI](https://app.vbot.io) to facilitate creating/editing a playbook. The playbook created on the [app.vbot.io](https://app.vbot.io) can be downloaded and run the test on your local machine using command:\n\n`vbot download --client-key=yourclientkey --scenario-id=yourscenarioid`\n\n## Chrome extension\nThere is a [Chrome extension](https://chrome.google.com/webstore/detail/vbot-recorder/nngcjjhpjbaofdokebbcgcnkeebnidij?utm_source=chrome-ntp-icon) to facilitate recording the interactions in a web page using the [playbook](#playbook-schema) schema. The playbook JSON exported can be run in either the programming mode as shown in above example or in CLI mode.\n\n![vbot chrome extension](img/vbot-chrome.gif)\n\nTo run in CLI mode with the exported JSON file, just run:\n\n`vbot -f /path/to/playbook/json/file -d`\n\nIt will bring up a Chrome browser and you can see the tests in action.\nOr you can run it without the `-d` argument, so that it will execute the tests in headless mode which that will take screenshots and do comparisons with the previous tests:\n\n`vbot -f /path/to/playbook/json/file`\n\n## Contributions\nWelcome any feedbacks, questions or contributions, just feel free to post issues.\n\n## License\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatat%2Fvbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatat%2Fvbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatat%2Fvbot/lists"}