{"id":20435942,"url":"https://github.com/d4nyll/cucumber-socket","last_synced_at":"2026-05-01T20:31:53.237Z","repository":{"id":86820946,"uuid":"149451325","full_name":"d4nyll/cucumber-socket","owner":"d4nyll","description":"In a Cucumber/Gherkin test, cucumber-socket gives you the ability to wait for Socket.io events to be received before moving on to the next step.","archived":false,"fork":false,"pushed_at":"2018-12-05T13:44:03.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T06:43:44.898Z","etag":null,"topics":["async","asynchronous","bdd","cucumber","gherkin","socket-io","testing","websocket"],"latest_commit_sha":null,"homepage":"","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/d4nyll.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,"dei":null}},"created_at":"2018-09-19T13:00:25.000Z","updated_at":"2021-12-26T18:32:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"b27ae0b2-896c-40e4-9b0a-8dce52177690","html_url":"https://github.com/d4nyll/cucumber-socket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/d4nyll/cucumber-socket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4nyll%2Fcucumber-socket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4nyll%2Fcucumber-socket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4nyll%2Fcucumber-socket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4nyll%2Fcucumber-socket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d4nyll","download_url":"https://codeload.github.com/d4nyll/cucumber-socket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4nyll%2Fcucumber-socket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32512662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["async","asynchronous","bdd","cucumber","gherkin","socket-io","testing","websocket"],"created_at":"2024-11-15T08:38:34.169Z","updated_at":"2026-05-01T20:31:53.208Z","avatar_url":"https://github.com/d4nyll.png","language":"JavaScript","readme":"# `cucumber-socket`\n\nIn a Cucumber/Gherkin test, `cucumber-socket` gives you the ability to wait for Socket.io events to be received before moving on to the next step.\n\n## Installation\n\n[![NPM](https://nodei.co/npm/cucumber-socket.png?compact=true)](https://nodei.co/npm/cucumber-socket/)\n\n`cucumber-socket` is published at [npmjs.com](https://www.npmjs.com/), and can be installed using [`npm`](https://docs.npmjs.com/cli/npm) or [`yarn`](https://yarnpkg.com/lang/en/).\n\n```bash\n$ npm install cucumber-socket  # npm\n$ yarn add cucumber-socket     # yarn\n```\n\n```js\nimport CucumberSocket from 'cucumber-socket';       // ES6+\nconst CucumberSocket = require('cucumber-socket');  // ES5\n```\n\n\n## Usage\n\n`cucumber-socket` provides a `CucumberSocket` class, which, when instantiated, returns a _manager_. The manager will keep track of all the sockets, events to listen to, and the callbacks to execute in response of these events.\n\nBefore Cucumber runs the tests, should should call the `register` method from the manager.\n\n```js\nBefore(function () {\n  this.manager = new CucumberSocket();\n  this.socket = io('http://hostname/', { ...options });\n  return this.manager.register(this.socket);\n});\n```\n\nThis will modify the `onevent` method of the socket to notify the manager whenever it receives a new event.\n\nThen, inside your step definitions, use the `waitFor` method to halt execution of the next step until the specified event is received.\n\n```js\nWhen('description', function (callback) {\n  this.socket.emit('login');\n  this.manager.waitFor(this.socket, 'success', callback);\n});\n```\n\nIn the example above, the step after `description` would only run after the `success` event is received on the Socket.io client.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd4nyll%2Fcucumber-socket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd4nyll%2Fcucumber-socket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd4nyll%2Fcucumber-socket/lists"}