{"id":15233870,"url":"https://github.com/autoflowlabs/autoflow","last_synced_at":"2025-04-10T06:11:36.288Z","repository":{"id":216310919,"uuid":"740997063","full_name":"AutoFlowLabs/autoflow","owner":"AutoFlowLabs","description":"Add AI intelligence to your tests with AutoFlow","archived":false,"fork":false,"pushed_at":"2024-04-05T11:26:41.000Z","size":85,"stargazers_count":59,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T18:18:22.569Z","etag":null,"topics":["e2e","e2e-testing","e2e-tests","playwright","test","test-automation","testing","testing-tools"],"latest_commit_sha":null,"homepage":"https://autoflow.tools","language":"TypeScript","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/AutoFlowLabs.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":"2024-01-09T13:46:39.000Z","updated_at":"2025-02-25T09:46:32.000Z","dependencies_parsed_at":"2024-02-04T17:08:40.708Z","dependency_job_id":"4e137097-0105-436f-b80e-b991a38513ef","html_url":"https://github.com/AutoFlowLabs/autoflow","commit_stats":null,"previous_names":["autoflowlabs/autoflow"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutoFlowLabs%2Fautoflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutoFlowLabs%2Fautoflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutoFlowLabs%2Fautoflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutoFlowLabs%2Fautoflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AutoFlowLabs","download_url":"https://codeload.github.com/AutoFlowLabs/autoflow/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166925,"owners_count":21058481,"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":["e2e","e2e-testing","e2e-tests","playwright","test","test-automation","testing","testing-tools"],"created_at":"2024-09-29T06:08:44.389Z","updated_at":"2025-04-10T06:11:36.233Z","avatar_url":"https://github.com/AutoFlowLabs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource\n      srcset=\"https://github.com/AutoFlowLabs/autoflow/assets/40566635/6cc95ead-0fea-49f9-b58d-cc5d4720c0fe\"\n      media=\"(prefers-color-scheme: dark)\"\n      alt=\"Autoflow Logo\"\n      height=\"100\" width=\"400\"\n    /\u003e\n    \u003cimg\n      src=\"https://github.com/AutoFlowLabs/autoflow/assets/40566635/5592e09e-eea8-4c93-9051-c47b1f55495e\"\n      alt=\"Autoflow Logo\"\n      height=\"100\" width=\"400\"\n    /\u003e\n  \u003c/picture\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \n  [![GitHub stars](https://img.shields.io/github/stars/AutoFlowLabs/autoflow.svg?style=social\u0026label=Star\u0026maxAge=2592000)](https://github.com/AutoFlowLabs/autoflow/stargazers/)\n  [![GitHub forks](https://img.shields.io/github/forks/AutoFlowLabs/autoflow.svg?style=social\u0026label=Fork\u0026maxAge=2592000)](https://GitHub.com/AutoFlowLabs/autoflow/network/)\n\n  [![Npm package total downloads](https://badgen.net/npm/dt/@autoflowlabs/playwright)](https://npmjs.com/package/@autoflowlabs/playwright)\n  \n  [![Discord](https://badgen.net/badge/icon/discord?icon=discord\u0026label)](https://discord.gg/TtDMA5CU)\n\n\u003c/div\u003e\n\n---\n# AutoFlow\n\nAdd superpowers to your end-to-end tests with AutoFlow's open-source library. Learn more at https://autoflow.tools\n\n## Setup\n\n### 1. Install the @autoflowlabs/playwright dependency\n\nYou can add the @autoflowlabs/playwright package to your project by executing the following command in your terminal:\n\nInstall Autoflow using [`yarn`](https://yarnpkg.com/en/package/@autoflowlabs/playwright):\n\n```bash\nyarn add --dev @autoflowlabs/playwright @playwright/test\n```\n\nOr [`npm`](https://www.npmjs.com/package/@autoflowlabs/playwright):\n\n```bash\nnpm install -D @autoflowlabs/playwright @playwright/test\n```\n\n\n### 2. Setting up the API Key/Token\nThis library requires access to a specific environment variable that contains your AutoFlow token, which is essential for the playwright process. This token can be found in your account on https://autoflow.tools. You can expose this variable in various ways. One option is to set it as an environment variable, as demonstrated below:\n\n ```sh\n $ export AUTOFLOW_TOKEN=\"\u003cyour token here\u003e\"\n ```\n\nAlternatively, you can store this token in a configuration file named `autoflow.config.json` located in your project's root directory, structured like this:\n\n ```json\n {\n   \"TOKEN\": \"\u003cyour token here\u003e\"\n }\n ```\n\n### 3. Get Set Flow!\n\nUtilize and incorporate the `autoflow()` function into your codebase by importing it as shown:\n\n```ts\nimport { test } from \"@playwright/test\";\nimport { autoflow } from \"@autoflowlabs/playwright\";\n\ntest(\"autoflow example\", async ({ page }) =\u003e {\n  await page.goto(\"https://google.com/\");\n\n  // An object with page and test must be passed into every call\n  const testArgs = { page, test };\n  const searchButtonText = await autoflow(\"Get the search button text\", testArgs);\n  await page.goto(\"https://google.com/\");\n  await autoflow(`Type \"${searchButtonText}\" in the search box`, testArgs, {flowType: \"action\"});\n  await autoflow(\"Press enter\", testArgs, {flowType: \"action\"});\n});\n```\n\n## Usage\n\nTo employ the `autoflow()` function, you require a basic text prompt and an argument that includes your`page`and `test` objects. \n\nMoreover, you can also specify a `flowType`, which presently includes support for `action`, `query` and `assert`.\n\n```ts\nautoflow(\"\u003cyour prompt\u003e\", { page, test }, {flowType: \"action\"});\n```\n\n### Tip\n\nThe test invocations are cached for convenience to the users. If you're getting undesired results and want to invalidate the cache, use the `cacheBypass` option.\n\n```ts\nautoflow(\"\u003cyour prompt\u003e\", { page, test }, {cacheBypass: true});\n```\n\n## Supported Browsers\n\nThe functionality provided by this package is limited to performing `autoflow()` actions exclusively within Chromium browsers.\n\n## Type of Flows\n\nThere are 3 types of `flowType` supported. If a `flowType` is not provided, it is inferred from the statement.\n\nExample \n- With `flowType`\n```ts\nawait autoflow(\"Click the link\", { page, test }, {flowType: \"action\"});\n```\n\n- With implicit `flowType`\n```ts\nawait autoflow(\"Click the link\", { page, test });\n```\n\n\n### 1. Action\nVersion: [![BETA](https://img.shields.io/badge/BETA-darkgreen.svg)](https://shields.io/)\n\nReturn Type: `undefined`\n\nAn action, such as a \"click,\" represents a simulated user interaction with the webpage, like clicking a link. If necessary, it will scroll to accomplish the designated task but prioritizes elements visible in the current viewport. Successful actions will return undefined, while failures will trigger an error, as shown below:\n\n```ts\ntry {\n  await autoflow(\"Click the link\", { page, test }, {flowType: \"action\"});\n} catch (e) {\n  console.error(\"Failed to click the link\");\n}\n```\n\nAction prompts will result in one or multiple browser actions, including:\n\n- Clicking elements\n- Inputting text\n- Pressing the 'Enter' key\n- Navigating to a new URL\n\n### 2. Query\nVersion: [![BETA](https://img.shields.io/badge/BETA-darkgreen.svg)](https://shields.io/)\n\nReturn Type: `string`\n\nA query will provide requested data from the visible section of the page as a string, for instance:\n\n```ts\nconst linkText = await autoflow(\n  \"Get the text of the first link\", { page, test }, {flowType: \"query\"});\nconsole.log(\"The link text is\", linkText);\n```\n\n### 3. Assert\nVersion: [![ALPHA](https://img.shields.io/badge/Alpha-blue.svg)](https://shields.io/)\n\nReturn Type: `bool`\n\nAssert will evaluate whether something exists on the page and return a `true` or `false`\n\n```ts\nconst linkText = await autoflow(\n  \"Is there a dog on this page?\", { page, test }, {flowType: \"assert\"});\nconsole.log(\"The link text is\", linkText);\n```\n\n\n\u003e It must be noted that the assert is more inclined towards how something looks or whether something is present on the page or not VS query is about how something reads.\n\n## Don't have tests yet? Test out AutoFlow on examples\n\nWithin this repository, there exists a demo allowing quick experimentation with the `autoflow()` function. To begin using it, follow these steps:\n\n1. Build the local version of the @autoflow/playwright package.\n\n```sh\ncd packages/playwright\nnpm install\nnpm run build\n```\n\n2. Install the @autoflow/playwright dependency within the examples directory.\n\n```sh\ncd ../../examples/playwright\nnpm install\n```\n\n3.  Make the `AUTOFLOW_TOKEN` environment variable or configuration value accessible (refer to the \"Setup\" section above).\n\n4.  Run the tests, with or without UI mode\n\n### Without UI Mode\n```sh\n$ npm run test\n```\n\n\n### With UI Mode\n```sh\n$ npm run test-ui\n```\nThis is an alias for `npx playwright test --ui`\n\n## Tips\n\n- If the Chromium binary is not already installed, utilize the following command to install the necessary browsers.\n```sh\n$ npx playwright install\n```\n\n\n- To ensure your prompts function correctly, here are recommended best practices for Autoflow AI prompts\n\n  - Construct prompts using complete English sentences. Minute grammatical errors are allowed but should be avoided\n  - Enclose any text that should display precisely as stated within quotation marks. For instance, `Click on the \"Login\" button`\n  - Avoid incorporating CSS/XPath selectors or any implementation-level specifics in your prompts.\n  - Create prompts that match your specific needs. Having a bit of uncertainty can be okay and sometimes even preferred. For instance, a prompt like `Find and click the \"Learn More\" button` remains effective even if there are multiple buttons with that label or if the page has undergone a complete redesign.\n  - A single prompt should have a single instruction. Avoid merging multiple instructions within a single prompt. For instance, refrain from phrases like 'Type in the \"Search bar\" and then click on the \"Menu\"'. Instead, ensure that each prompt distinctly focuses on one action or query.\n\n## Testing Limitations in Free Tier\n\u003cs\u003eIn our commitment to offer a generous free tier to maximum users possible, we support sequential test runs only. For optimal performance, kindly run tests using the following commands:\n\nHeadless tests: `npx playwright test --workers=1`\nTests with a graphical user interface: `npx playwright test --ui --workers=1`\u003c/s\u003e\n\nAt AutoFlow, we're committed to delivering a top-tier experience to the community by leveraging cutting-edge technology. With this vision in mind, we've fine-tuned our systems and services to accommodate a high volume of parallel connections and testing, ensuring that everyone enjoys a seamless and efficient experience.\n\n\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003cbr\u003e\n\n![GitHub stars](https://img.shields.io/badge/Made%20With%20%F0%9F%92%95-By%20Developers,%20For%20Everyone-FAAD1B)\n\n\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautoflowlabs%2Fautoflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautoflowlabs%2Fautoflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautoflowlabs%2Fautoflow/lists"}