Package: qualiti
Qualiti.ai Python Tools and Package🔗 Qualiti.aiis a very powerful paid platform. This repo is calledqualitibut is a free, open-source Python Package and Command Line Interface (CLI) for you to build your own automated pipelines using AI and see examples of what can be done with AI.This package provides easy-to-use tools that can benefit developers and testers! Just take a look below to see what's available.RequirementsInstallationToolsConfigurationAttributerRequirements🐍 Python3.8.12or higher📦Poetryas package manager if you are contributingHaving access to both allows you to use all features and examples, so note which you'll need:🔑 Access toOpenAIvia API Key🔑 Access to🤗 HuggingFacevia Access TokenInstallationThis project currently supports these models and providers, but you must have access to them:OpenAI (gpt-3.5-turbois the default model)Installqualitiwith your favorite package manager:pipinstallqualitiSet up the model and/or provider you want to use.OpenAISet yourOPENAI_API_KEYEnvironment Variable. You can use thequaliti set-envcommand if needed:qualiticonfset-envOPENAI_API_KEY<your-api-key>💡 You can also use a.envfile or manage Environment Variables your own way! Use theexample.envtemplate as an example🤗 HuggingFaceSet yourHUGGINGFACE_ACCESS_TOKENEnvironment Variable. You can use thequaliti set-envcommand if needed:qualiticonfset-envHUGGINGFACE_ACCESS_TOKEN<your-access-token>💡 Make sure tosourcethe config file or restart the Terminal to register the changesThen start usingqualitiin the CLI or as a package in your project:qualiti--helpfromqualitiimportaiPROMPT="""Write a one-sentence greeting as a{0}"""openai_response=ai.get_completion(PROMPT.format("pirate"))ConfigurationThis tool allows you to Set and Get key-value pairs in your Environment Variables or thequaliti.conf.json.💡 This is shown in Step 2 of theInstallationsectionUsagequaliticonf[COMMAND][OPTIONS]ExamplesThis is helpful if you know that your elements are in specific files. This makes tools likeAttributerfaster and cheaper since the AI will only look at files that you care about.For example, in Angular, you may know that your HTML only exists in these file patterns:*.component.ts*.component.htmlWe can set theGLOB_PATTERNvalue to only look for component files.qualiticonfset-confGLOB_PATTERN"*.component.*"💡 See the Pythonglob and fnmatchdocs for details on how to create glob patternsAttributerUse AI to auto-adddata-testidattributes to HTML code.🤖 Usagequalitiattrtestid[PATH][OPTIONS]💡 You can enter a path to a single file or to a directory.IfPATHis a directory, it will recursively look forall supported filesin that directory and its subdirectories.Seequaliti.conf.jsonfor the default supported file types 👀You can update this list usingset-conf:qualiticonfset-confSUPPORTED_FILES"[.html, .tsx]"Examples:# filequalitiattrtestidexamples/StoryView.tsx# directoryqualitiattrtestidexamples/SubComponents🤕 ProblemAlthough it's "best practice" for Web Pages to have dedicated attributes for Test Automation and Accessibility (a11y), it seems to be an afterthought and is not commonly followed.❌ This makes the websiteinaccessiblefor a large group of people (ie screen readers, keyboard navigation)❌ This makes it difficult to design and create Test Automation for the UI (ie component, end-to-end)Ideally, developers would design their UI and components with these attributes in mindas they codesince adding them is simple -- especially with a properDesign System-- but imagine a developer inheriting an existing project because they're a new hire, moving teams, or jumping into a project to help out. Spending the time and energy to do all of this manually isn't as simple:Find the appropriate files (could be dozens or hundreds!)Locate the relevant elements in each fileAdd these attributes with helpful names for each element✅ SolutionUsing AI, we can do all 3 steps automatically!Provide the file(s) like afilename.tsxor a folder like/ComponentsAI adds adata-testidto each relevant elementThe new file is saved and can now be compared to the original in case the dev wants to make any changes💡 Theoretically, this approach should work for any Web Framework like Angular, React, Vue, etc!💭 ConsiderationsSeeattributer.pyfor the prompt and commands used.OpenAI ain't free, so be cognizant of how many files you target since each file will invoke the AIUsegitso you get a diff before you push the updated files.