{"id":17504390,"url":"https://github.com/dab0mb/react-bobcat","last_synced_at":"2025-09-12T20:32:15.664Z","repository":{"id":43996428,"uuid":"239205906","full_name":"DAB0mB/react-bobcat","owner":"DAB0mB","description":"A library for testing navigation flows in React","archived":false,"fork":false,"pushed_at":"2023-01-05T06:46:48.000Z","size":1309,"stargazers_count":4,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-03T15:24:29.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/DAB0mB.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}},"created_at":"2020-02-08T21:19:45.000Z","updated_at":"2021-02-04T08:13:29.000Z","dependencies_parsed_at":"2023-02-03T16:32:18.953Z","dependency_job_id":null,"html_url":"https://github.com/DAB0mB/react-bobcat","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAB0mB%2Freact-bobcat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAB0mB%2Freact-bobcat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAB0mB%2Freact-bobcat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAB0mB%2Freact-bobcat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DAB0mB","download_url":"https://codeload.github.com/DAB0mB/react-bobcat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232786401,"owners_count":18576418,"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-10-20T00:22:14.737Z","updated_at":"2025-01-06T21:10:19.390Z","avatar_url":"https://github.com/DAB0mB.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bobcat 😺😼\n\nBobcat is a library for testing navigation flows in React. Its API is heavily inspired by classic testing frameworks like [Mocha](https://mochajs.org/) and [Jest](https://jestjs.io/); it has a similar `describe()` / `it()` type of syntax.\n\n\u003cp align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/7648874/74193813-b9714100-4c60-11ea-8ed3-a2fdc328dcc5.gif\"\u003e\n\u003c/p\u003e\n\n### Usage\n\nHere's a rough code snippet that demonstrates how Bobcat should be used:\n\n```jsx\nimport { useState } from 'react';\nimport { useDelayedEffect, useBobcat } from 'react-bobcat';\n\nimport MyButton from './components/MyButton';\nimport { useSignOut } from './services/auth';\n\nexport default () =\u003e {\n  const { scope, flow, trap, pass, assert } = useBobcat();\n\n  scope('MyApp', () =\u003e {\n    const signOut = useSignOut();\n\n    before(async () =\u003e {\n      await signOut();\n    });\n\n    flow('Clicking a button', () =\u003e {\n      // MyButton is a React component\n      trap(MyButton, ({ buttonRef, textRef }) =\u003e {\n        const [buttonClicked, setButtonClicked] = useState(false);\n\n        useDelayedEffect(() =\u003e () =\u003e {\n          // buttonRef is referencing a native HTML button element\n          buttonRef.current.click();\n          setButtonClicked(true);\n        }, 1000, [true]);\n\n        useDelayedEffect(() =\u003e {\n          if (!buttonClicked) return;\n\n          return () =\u003e {\n            assert(textRef.current.innerText, 'Clicked!')\n            pass(); // Go to the next scope/flow\n          };\n        }, 1000, [buttonClicked]);\n      });\n    });\n\n    scope('Another nested scope', () =\u003e {\n      flow('Another flow A', () =\u003e {\n\n      });\n\n      flow('Another flow B', () =\u003e {\n\n      });\n    });\n  });\n\n  scope('You can also define additional external scopes', () =\u003e {\n    flow('Etc', () =\u003e {\n\n    });\n  });\n};\n```\n\nA more in-depth explanation and code snippets can be found on [Medium](https://medium.com/@eytanmanor/how-to-run-react-e2e-tests-purely-with-hooks-4bc475f4bb2).\n\n### Installation\n\nThe source is available via [Github](github.com/dab0mb/react-bobcat). Alternatively you can install Bobcat via NPM:\n\n    $ npm install react-bobcat\n\nor Yarn:\n\n    $ yarn add react-bobcat\n\n**Be sure to install React@16.8 or greater*.\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdab0mb%2Freact-bobcat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdab0mb%2Freact-bobcat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdab0mb%2Freact-bobcat/lists"}