{"id":18000116,"url":"https://github.com/defactosoftware/test_selector","last_synced_at":"2025-06-18T19:35:45.922Z","repository":{"id":22757571,"uuid":"97237901","full_name":"DefactoSoftware/test_selector","owner":"DefactoSoftware","description":"Elixir library to help selecting the right elements in your tests.","archived":false,"fork":false,"pushed_at":"2024-06-27T15:45:48.000Z","size":63,"stargazers_count":14,"open_issues_count":4,"forks_count":2,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-30T12:17:40.566Z","etag":null,"topics":["elixir","phoenix","selectors","test"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/DefactoSoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"publiccode":null,"codemeta":null}},"created_at":"2017-07-14T13:41:40.000Z","updated_at":"2023-11-29T09:47:13.000Z","dependencies_parsed_at":"2024-03-14T20:25:37.443Z","dependency_job_id":"8a671b9b-aa20-4e99-aabb-7ef632e7d97f","html_url":"https://github.com/DefactoSoftware/test_selector","commit_stats":{"total_commits":50,"total_committers":6,"mean_commits":8.333333333333334,"dds":0.4,"last_synced_commit":"0626f97304a2971da6b8203e25f3942f076ef5fa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefactoSoftware%2Ftest_selector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefactoSoftware%2Ftest_selector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefactoSoftware%2Ftest_selector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefactoSoftware%2Ftest_selector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DefactoSoftware","download_url":"https://codeload.github.com/DefactoSoftware/test_selector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252833943,"owners_count":21811280,"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":["elixir","phoenix","selectors","test"],"created_at":"2024-10-29T23:09:41.534Z","updated_at":"2025-05-07T07:33:27.871Z","avatar_url":"https://github.com/DefactoSoftware.png","language":"Elixir","readme":"# TestSelector\n\n[![CircleCI](https://circleci.com/gh/DefactoSoftware/test_selector/tree/master.svg?style=shield)](https://circleci.com/gh/DefactoSoftware/test_selector)\n[![Module Version](https://img.shields.io/hexpm/v/test_selector.svg)](https://hex.pm/packages/test_selector)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/test_selector/)\n[![Total Download](https://img.shields.io/hexpm/dt/test_selector.svg)](https://hex.pm/packages/test_selector)\n[![License](https://img.shields.io/hexpm/l/test_selector.svg)](https://github.com/DefactoSoftware/test_selector/blob/master/LICENSE.md)\n[![Last Updated](https://img.shields.io/github/last-commit/DefactoSoftware/test_selector.svg)](https://github.com/DefactoSoftware/test_selector/commits/master)\n\nA set of Elixir helpers to set/get test selectors to/from elements in a Phoenix app (when `Mix.env == :test`). These selectors are hashed (scoped to the view module they are used in) for accurate selection and \"leakage\" prevention. See our [Wiki](https://github.com/DefactoSoftware/test_selector/wiki) for examples.\n\n**Why?** Because we prefer reserving classes for styling, and id's have limitations because they have to be unique.\n\n## Dependencies\n\n- [Floki](https://github.com/philss/floki) v0.25.x and higher\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:test_selector, \"~\u003e 0.3.3\"}\n  ]\nend\n```\n\nUse `TestSelector.HTML.Helpers` to your web.ex.\n\n- In phoenix 1.2.0 at `web/web.ex`\n- In newer Phoenix versions `lib/your_project/web/web.ex`\n\nAdd somewhere along:\n\n```elixir\ndef view(opts \\\\ []) do\n  quote do\n    ...\n    use Phoenix.HTML\n\n    use TestSelector.HTML.Helpers\n    ...\n  end\nend\n```\n\n**Testing with Floki**\n\nIn the tests import the `TestSelector.Test.FlokiHelpers`:\n\n```elixir\ndefmodule Project.Web.MyTest do\n  ...\n\n  import TestSelector.Test.FlokiHelpers\n  ...\nend\n```\n\n\n## Tests\n\nRun the tests:\n```\nmix test\n```\n\n## Copyright and License\n\nCopyright (c) 2017 Defacto\n\nReleased under the MIT License, which can be found in the repository in\n[LICENSE.md](./LICENSE.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefactosoftware%2Ftest_selector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefactosoftware%2Ftest_selector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefactosoftware%2Ftest_selector/lists"}