{"id":17651598,"url":"https://github.com/mohit23x/babel-plugin-format-testid","last_synced_at":"2025-03-30T09:12:44.575Z","repository":{"id":65307553,"uuid":"480219724","full_name":"mohit23x/babel-plugin-format-testid","owner":"mohit23x","description":"Babel plugin to format testID for running Appium E2E tests ","archived":false,"fork":false,"pushed_at":"2023-01-16T06:50:37.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-19T22:13:26.001Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/babel-plugin-format-testid","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/mohit23x.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":"2022-04-11T03:58:27.000Z","updated_at":"2023-11-22T06:41:55.000Z","dependencies_parsed_at":"2023-01-16T15:15:37.722Z","dependency_job_id":null,"html_url":"https://github.com/mohit23x/babel-plugin-format-testid","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/mohit23x%2Fbabel-plugin-format-testid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohit23x%2Fbabel-plugin-format-testid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohit23x%2Fbabel-plugin-format-testid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohit23x%2Fbabel-plugin-format-testid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohit23x","download_url":"https://codeload.github.com/mohit23x/babel-plugin-format-testid/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246193271,"owners_count":20738452,"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-23T11:42:41.490Z","updated_at":"2025-03-30T09:12:44.550Z","avatar_url":"https://github.com/mohit23x.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Babel Plugin to format testIDs\n\nA babel plugin to format testIDs in React Native app for running Appium E2E tests.\n\n#### INPUT:\n```\n    \u003cButton testID={variable} /\u003e\n    \u003cButton testID={\"asdf\"+2} /\u003e\n    \u003cButton testID=\"asdf\" /\u003e\n```\n\n#### OUTPUT:\n```\n    \u003cButton testID={\"prefix\" + variable} /\u003e\n    \u003cButton testID={\"prefix\" + (\"asdf\" + 2)} /\u003e\n    \u003cButton testID={\"prefix\" + \"asdf\"} /\u003e\n```\n\n\nTo setup E2E tests with Appium for the React Native app, we need to format the testIds of components with bundleID as prefix, and to keep the code simple and readable, something like\n\n```\n\u003cButton\n    testId=\"checkout-button\"\n/\u003e\n``` \n\nand not\n\n```\n\u003cButton\n    testId=\"com.example.yourapp:id/checkout-button\"\n/\u003e\n``` \nwe made this babel plugin which will format the testIds at compile time.\n\n\n\n### Setup\n\nStep 1: Install the package\n\n```\n    yarn add -D babel-plugin-format-testid\n```\n\nStep 2: Configure plugin babelrc or babel.config.js file\n\n```\nmodule.exports = {\n  presets: [ //... ],\n  plugins: [\n    [\n      'format-testid',\n      {\n        prefix: 'com.razorpay.payments.app:id/',\n        skip: process.env.JEST_WORKER_ID,\n      },\n    ],\n  ],\n};\n\n```\n\n\n- prefix (string): This paramter holds the value whihc will be prefixed before every testId\n\n- skip (boolean): This parameter tells whether the plugin should format the testID or not, for example setting the value `process.env.JEST_WORKER_ID` means do not format the values when Jest unit tests are running.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohit23x%2Fbabel-plugin-format-testid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohit23x%2Fbabel-plugin-format-testid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohit23x%2Fbabel-plugin-format-testid/lists"}