{"id":16726063,"url":"https://github.com/tatut/drtest","last_synced_at":"2025-10-26T12:14:16.921Z","repository":{"id":62435131,"uuid":"189614692","full_name":"tatut/drtest","owner":"tatut","description":"Declarative Reagent testing library","archived":false,"fork":false,"pushed_at":"2020-08-19T08:17:35.000Z","size":73,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T09:11:33.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tatut.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":"2019-05-31T15:11:15.000Z","updated_at":"2020-08-19T08:17:37.000Z","dependencies_parsed_at":"2022-11-01T21:02:31.287Z","dependency_job_id":null,"html_url":"https://github.com/tatut/drtest","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/tatut%2Fdrtest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatut%2Fdrtest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatut%2Fdrtest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatut%2Fdrtest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tatut","download_url":"https://codeload.github.com/tatut/drtest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199086,"owners_count":21063641,"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-12T22:52:00.457Z","updated_at":"2025-10-26T12:14:11.889Z","avatar_url":"https://github.com/tatut.png","language":"Clojure","readme":"# drtest\n\n[![Clojars Project](https://img.shields.io/clojars/v/webjure/drtest.svg)](https://clojars.org/webjure/drtest)\n\nDeclarative Reagent testing library.\n\nThe test runner can take screenshots after each action when combined with `clj-chrome-devtools` test\nrunner. The screenshots will contain a HUD showing test progression and what the step was.\n\nIn drtest you define your UI test as a series of steps. Steps are either user defined functions or\nmaps defining a `:drtest.step/type` which dispatches to a multimethod. You can also define your\nown step types by simply using `defmethod` and hook it to your favorite framework.\n\n### Basic usage example\n\n```clojure\n;; define-drtest macros is a convenience for\n;; deftest + async invocation. You can also run\n;; drtest.core/run-steps directly in your test.\n\n(define-drtest my-component-test\n  ;; Options map\n  {:screenshots? true\n   :initial-context {:app (r/atom {}}}\n\n  ;; Steps\n  ;; `drtest.step/step` function is a convenience for creating\n  ;; step descriptor maps.\n  ;;\n  ;; It takes the step type and optional human readable label (shown in screenshots)\n  ;; and the keys/values required by the step type.\n\n  (step :render \"Render component\"\n        :component (fn [{app :app}]\n                     [my-component app]))\n\n  (step :click \"Click the doit button\"\n        :selector \"#doit\")\n\n  (step :expect \"Expect loading indicator to be present\"\n        :selector \"div.loading\")\n\n  (step :wait \"Wait for results\"\n        :ms 2000)\n\n  ;; A function can also be a test step. It must return boolean (success value)\n  ;; or a new context map.\n  ^{:drtest.step/label \"Check results in app state\"}\n  (fn [{app :app}]\n    (= 2 (count (:results @app))))\n\n  (step :expect-count \"Check results are rendered\"\n        :selector \"li.result\" :count 2))\n```\n\n## Pics\n\n![drtest in action](/drtest.png?raw=true)\n\n## Steps\n\nSteps are user defined functions or defined as maps containing `:drtest.step/type` (required), `drtest.step/label` (optional)\nand type specific keys.\n\n## Builtin step types\n\n| Type | Description |\n| --- | --- |\n| `:render` | Render the reagent `:component` to new container. |\n| `:expect` | Check element with `:selector` exists. Can also check that is has `:text`, `:value` and `:attributes` present. |\n| `:expect-no` | Check that no element with `:selector` exists. |\n| `:expect-count` | Check that `:count` amount of elements are found with `:selector`. Adds element vector to context if `:as` is specified. |\n| `:click` | Simulate click event on `:element` or `:selector`. |\n| `:type` | Simulate typing `:text` event on `:element` or `:selector`. If `:overwrite?` is true replaces text, otherwise appends. |\n| `:wait` | Wait for `:ms` milliseconds before continuing. |\n| `:wait-promise` | Wait for `:promise` to be resolved. If `:as` key is specified, the promise value is added to the context with that key. Fails if promise is rejected. |\n\n\n## User defined functions as steps\n\nYou can provide a function as a test step, the function will be invoked with one argument:\nthe current context. The function must return either a new context map or a boolean value\ndescribing success or failure.\n\nReturning false from a function will fail the test and consequent steps will not run.\n\nTo provide a label for a function step, use a metadata map with `:drtest.step/label` key.\n\n## Changes\n\n### 20190611\n* Bug fix (missing reagent require)\n* Always add `:drtest.step/cleanup` as the last step\n\n### 20190605\n* Fix bug in `:wait-promise`\n* Add `:timeout` (default 2000ms) to `:expect`\n* Add `:drtest.step/wait-render?` meta to function steps\n\n### 20190603\n* Support `:as` in `:expect-count`\n\n### 20190601\n* Initial version","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftatut%2Fdrtest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftatut%2Fdrtest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftatut%2Fdrtest/lists"}