{"id":15817197,"url":"https://github.com/numminorihsf/get-e2e-test-classname","last_synced_at":"2025-07-22T14:34:10.277Z","repository":{"id":57250135,"uuid":"148626193","full_name":"NumminorihSF/get-e2e-test-classname","owner":"NumminorihSF","description":"Get unique classnames for e2e tests with prefix","archived":false,"fork":false,"pushed_at":"2018-12-09T10:02:50.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-09T00:45:41.169Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NumminorihSF.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}},"created_at":"2018-09-13T11:11:38.000Z","updated_at":"2018-12-09T10:02:52.000Z","dependencies_parsed_at":"2022-08-24T16:51:54.449Z","dependency_job_id":null,"html_url":"https://github.com/NumminorihSF/get-e2e-test-classname","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/NumminorihSF/get-e2e-test-classname","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NumminorihSF%2Fget-e2e-test-classname","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NumminorihSF%2Fget-e2e-test-classname/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NumminorihSF%2Fget-e2e-test-classname/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NumminorihSF%2Fget-e2e-test-classname/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NumminorihSF","download_url":"https://codeload.github.com/NumminorihSF/get-e2e-test-classname/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NumminorihSF%2Fget-e2e-test-classname/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266510687,"owners_count":23940696,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":[],"created_at":"2024-10-05T05:22:52.004Z","updated_at":"2025-07-22T14:34:10.248Z","avatar_url":"https://github.com/NumminorihSF.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# get-e2e-test-classname\n\nThis package allow to guarantee that class names used in e2e tests are unique.\nAlso it adds prefix for every classname to let QA know if some classname can be used by themselves. \n\nExample:\n```jsx harmony\nimport { getE2ETestClassName } from 'get-e2e-test-classname';\n\nconst myClass = getE2ETestClassName('my');\n\nconst ReactComp = () =\u003e \u003cbutton className={myClass}\u003etest\u003c/button\u003e;\n```\n\nIn case of using non-unique className, this package will throw an error. Example:\n```jsx harmony\nimport { getE2ETestClassName } from 'get-e2e-test-classname';\n\nconst myClass = getE2ETestClassName('my');\nconst myClass2 = getE2ETestClassName('my'); // throw new Error\n```\n\nDefault prefix is `'-'`. So `getE2ETestClassName('my') === '-my'`  \n\n### Change prefix\nTo use custom prefix, you can use next code:\n```jsx harmony\nimport { getE2ETestClassName, setPrefix } from 'get-e2e-test-classname';\n\nsetPrefix('my-prefix-');\n\ngetE2ETestClassName('name'); // 'my-prefix-name\\\n```\n\n**Warn!** Created classname is `prefix + originalClassName` without any separator. \n\n### Create scope\nTo prevent issues with hard-coding long part of classnames to make them unique, you may use scopes.\nCode without scope:\n```jsx harmony\nimport { getE2ETestClassName } from 'get-e2e-test-classname';\n\nconst e2e = {\n  firstNameInput: getE2ETestClassName('my-form-inside-application-first-name-input'),\n  lastNameInput: getE2ETestClassName('my-form-inside-application-last-name-input'),\n  emailInput: getE2ETestClassName('my-form-inside-application-email-input'),\n  passwordInput: getE2ETestClassName('my-form-inside-application-password-input'),\n};\n```\n\nIt can be replaced with:\n```jsx harmony\nimport { createScoped } from 'get-e2e-test-classname';\n\nconst getE2ETestClassName = createScoped('my-form-inside-application');\n\nconst e2e = {\n  firstNameInput: getE2ETestClassName('first-name-input'),\n  lastNameInput: getE2ETestClassName('last-name-input'),\n  emailInput: getE2ETestClassName('email-input'),\n  passwordInput: getE2ETestClassName('password-input'),\n};\n```\n\n**Warn!** Code isn't totally equal to unscoped cause created classnames will be different:\n\n| Manual | Scoped |\n|-------|------|\n| `-my-form-inside-application-first-name-input` | `-my-form-inside-application_first-name-input` |\n| `___________________________^                ` | `___________________________^                ` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumminorihsf%2Fget-e2e-test-classname","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumminorihsf%2Fget-e2e-test-classname","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumminorihsf%2Fget-e2e-test-classname/lists"}