{"id":21835890,"url":"https://github.com/vtex/test-tools","last_synced_at":"2026-02-08T19:41:31.113Z","repository":{"id":38426709,"uuid":"175224833","full_name":"vtex/test-tools","owner":"vtex","description":"Add tests to your VTEX IO app in an instant 🚀","archived":false,"fork":false,"pushed_at":"2024-11-05T13:22:04.000Z","size":4342,"stargazers_count":51,"open_issues_count":56,"forks_count":11,"subscribers_count":125,"default_branch":"master","last_synced_at":"2025-10-26T06:24:34.714Z","etag":null,"topics":["srv-store-framework","xp-developer"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/vtex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2019-03-12T14:08:41.000Z","updated_at":"2024-06-25T01:03:56.000Z","dependencies_parsed_at":"2025-08-21T06:31:38.896Z","dependency_job_id":"5472d9e1-1b3d-411e-a4ba-1db045084c47","html_url":"https://github.com/vtex/test-tools","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/vtex/test-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Ftest-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Ftest-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Ftest-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Ftest-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vtex","download_url":"https://codeload.github.com/vtex/test-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Ftest-tools/sbom","scorecard":{"id":627664,"data":{"date":"2025-08-04","repo":{"name":"github.com/vtex/test-tools","commit":"2a336fa98c2cd9a41d64c856edf8d9fe411e27ee"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":3.4,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/vtex/test-tools/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/vtex/test-tools/ci.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"39 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4","Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T06:56:02.229Z","repository_id":38426709,"created_at":"2025-08-21T06:56:02.230Z","updated_at":"2025-08-21T06:56:02.230Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29240768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T19:36:48.828Z","status":"ssl_error","status_checked_at":"2026-02-08T19:27:12.336Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["srv-store-framework","xp-developer"],"created_at":"2024-11-27T20:25:55.881Z","updated_at":"2026-02-08T19:41:31.097Z","avatar_url":"https://github.com/vtex.png","language":"TypeScript","readme":"# VTEX Test Tools\n\n![Npm badge](https://img.shields.io/npm/v/@vtex/test-tools.svg?style=flat-square) ![CI](https://github.com/vtex/test-tools/workflows/CI/badge.svg?branch=master)\n\n\u003e Add tests to your VTEX IO app in an instant 🚀\n\n## Table of Contents\n\n- [Install](#Install)\n- [Usage](#Usage)\n- [API](#API)\n  - [React Component](#react-module)\n  - [React Hooks](#react-hooks)\n  - [Messages I18n](#messages)\n  - [GraphQL](#graphql)\n  - [End-to-end flows](#end-to-end-flows)\n\n## Install\n\n```sh\nyarn add -D @vtex/test-tools @apollo/react-testing@3 react-intl@3\n```\n\n## Usage\n\nAdd a new script to your `react/package.json`:\n\n```json\n{\n  \"name\": \"my-io-app\",\n  \"scripts\": {\n    \"test\": \"vtex-test-tools test\"\n  }\n}\n```\n\nAdd these lines to your `.vtexignore`:\n\n```\nreact/**/__tests__/**\nreact/**/__mocks__/**\nreact/**/__snapshots__/**\nreact/**/*.test.js\nreact/**/*.test.ts\nreact/**/*.test.tsx\n```\n\nRun in your terminal:\n\n```sh\nyarn test\n```\n\nIf you're using TypeScript there are a few [more steps](./examples/typescript/).\n\nDone! 🎉\n\nUnder the hood, we use [Jest](https://jestjs.io/), so you can pass Jest flags as parameters: [read the docs](https://jestjs.io/docs/en/cli.html).\n\n## API\n\n### `react` module\n\nThe module `react` makes it easy to test VTEX IO React apps.\n\n#### Example\n\n```jsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\nimport HelloWorld from './HelloWorld'\n\ntest('should render the Hello!', () =\u003e {\n  const { getByText } = render(\u003cHelloWorld /\u003e)\n\n  const element = getByText(/Hello!/)\n\n  expect(element).toBeDefined()\n})\n```\n\nThis module uses `@testing-library/react` (RTL) under the hood, so most of its API is the same ([read their docs here](https://testing-library.com/docs/intro)).\n\nWe added a few more features to the regular `render` function from RTL, such as a `graphql` and `locale` option. You can see more about them\ndown below.\n\n### React Hooks\n\nYou can also test your custom hooks.\n\n#### Example\n\n```js\nimport { hooks } from '@vtex/test-tools/react'\nimport useCustomHook from './useCustomHook'\n\nconst { renderHook, act } = hooks\n\nit('counter should be one', async () =\u003e {\n  const { result } = renderHook(() =\u003e useCustomHook())\n\n  // This waits for the useEffect hook to be triggered and mutate hook state\n  await act(() =\u003e Promise.resolve())\n\n  expect(result.current).toBe(1)\n})\n```\n\n\u003c!-- https://react-hooks-testing-library.com/ --\u003e\n\nThe module uses `@react-testing-library/react-hooks` under the hood, to understand the reactHook function you can read [its doc](https://react-hooks-testing-library.com/reference/api)\n\n### Messages\n\nWe will automatically wrap your component with an `IntlProvider` with your app's `messages/en-US.json` messages.\n\nYou can change the default locale being used adding a config to your `package.json`. Example:\n\n```json\n{\n  \"name\": \"my-awesome-io-app\",\n  \"vtexTestTools\": {\n    \"defaultLocale\": \"pt-BR\"\n  }\n}\n```\n\nIf you want to change the locale just in a test, you may pass the `locale` option. Example:\n\n```jsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\nimport HelloWorld from './HelloWorld'\n\ntest('should render the example translated to portuguese', () =\u003e {\n  const { getByText } = render(\u003cHelloWorld /\u003e, { locale: 'pt' })\n\n  const element = getByText(/Olá!/)\n\n  expect(element).toBeDefined()\n})\n```\n\n### GraphQL\n\nWe automatically wrap your component with an Apollo's [`MockedProvider`](https://www.apollographql.com/docs/react/development-testing/testing/).\n\nYou can pass your mocked queries to it using the `graphql` option. Example:\n\n```js\nimport React from 'react'\nimport { render, flushPromises } from '@vtex/test-tools/react'\nimport GraphqlComponent from './GraphqlComponent'\nimport GET_BOOKS from './getBooks.graphql'\n\ntest('should render mock graphql responses', async () =\u003e {\n  jest.useFakeTimers()\n\n  const bookMock = {\n    request: {\n      query: GET_BOOKS,\n    },\n    result: {\n      data: {\n        books: [\n          {\n            id: 10,\n            title: 'Hello',\n          },\n        ],\n      },\n    },\n  }\n\n  const { getByText } = render(\u003cGraphqlComponent /\u003e, {\n    graphql: { mocks: [bookMock] },\n  })\n\n  expect(getByText(/Loading/)).toBeDefined()\n\n  await flushPromises()\n  jest.runAllTimers()\n\n  expect(getByText(/Hello/)).toBeDefined()\n})\n```\n\n### End-to-end flows\n\nWe offer hooks to make writing end-to-end tests easier.\n\nExtended commands:\n\n- clickById\n- getById\n- typeById\n\nCustom methods:\n\n- goToSearchPage\n- goToProductPageByShelf\n- checkText\n- checkIfElementExists\n- openCart\n- closeCart\n- clearCart\n- fillAndCheckShippingSimulator\n- scrollToId\n\nExample:\n\n```js\nimport { openCart } from \"@vtex/test-tools/cypress\"\n\ndescribe('Searchbar', () =\u003e {\n  before(() =\u003e {\n    cy.intercept(/operationName=ProductsSuggestionsQuery/, {\n      fixture: 'product-suggestions-query.json',\n    }).as('searchSuggestionsLoad')\n  })\n\n  it('finds a very specific product using the search bar', () =\u003e {\n    cy.visit('/')\n\n    cy.getById('searchBarInput').eq(0).type('Product')\n\n    cy.getById('searchSuggestionsItem').contains('Product').click()\n\n    cy.clickById('addToCart')\n\n    openCart()\n\n    ...\n  })\n})\n```\n\nYou can check more details of these hooks in the links below:\n\n- [`cypress/support/commands`](https://github.com/vtex/test-tools/tree/master/cypress/support/commands.ts)\n- [`cypress/utils`](https://github.com/vtex/test-tools/tree/master/cypress/utils)\n\n## Examples\n\nThese are some common use cases that might be helpful to see how it's done:\n\n- [Debugging tests in VS Code](./examples/vscode/)\n\n- [Testing a React Hook](./examples/hooks/)\n\n- [Testing a React component](https://github.com/klzns/test-repo/blob/master/react/JsComponent.test.js)\n\n- [Testing a React component using Typescript](./examples/typescript/)\n\n- [Testing a component using CSS Modules](https://github.com/klzns/test-repo/blob/master/react/CssComponent.test.js)\n\n- [Testing a component using GraphQL](https://github.com/klzns/test-repo/blob/master/react/GraphqlComponent.test.js)\n\n- [Testing a component using React Hooks](https://github.com/klzns/test-repo/blob/master/react/HooksComponent.test.js)\n\n- [Testing a component translating in another locale](https://github.com/klzns/test-repo/blob/master/react/LocaleComponent.test.js)\n\n- [Testing end-to-end flows using Cypress](https://github.com/vtex/test-tools/tree/master/examples/e2e)\n\n## License\n\nMIT © [VTEX](https://www.vtex.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex%2Ftest-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvtex%2Ftest-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex%2Ftest-tools/lists"}