How seldomqa/auto-wing works
Project Type and Purpose
• Type: An open‑source Python library that integrates LLM (Large Language Model) calls into existing UI automation frameworks (Playwright, Selenium, Appium).
• Purpose: Provide ai_action, ai_query, and ai_assert fixtures that let test authors drive UI tests via AI prompts, with caching for repeat prompts and support for multiple LLM providers (OpenAI, DeepSeek, Qwen, Doubao).
File Structure
• Top‑level: autowing/ package, docs/, examples/, config files (pyproject.toml, .gitignore).
• Sub‑packages:
• autowing/appium/, autowing/playwright/, autowing/selenium/: framework–specific fixture entry points.
• autowing/core/: the heart of the library, containing:
– ai_context.py: orchestrates fixture calls.
– ai_fixture_base.py: defines the common fixture interface.
– cache/cache_manager.py: caching layer for prompt results.
– llm/: LLM abstraction with factory.py, base.py, plus provider‐specific clients in client/.
• autowing/utils/transition.py: transforms LLM responses into UI actions or assertions.
• Examples: show integration with pytest/unittest + .env for configuration.
Extract Additional Insights from README
• Supported frameworks: Playwright, Selenium, Appium.
• Supported LLMs: OpenAI, DeepSeek, Qwen, Doubao.
• Integration: “No‑pain” with pytest/unittest; environment variables or .env via python‑dotenv.
• Cache: first‐call caching for efficiency.
Main Components & Interactions
a. Test Suite Layer
• Your pytest/unittest tests import and invoke the ai fixture.
• Example tests call ai.ai_action(), ai.ai_query(), ai.ai_assert().
b. Framework Fixture Layer
• Three parallel components: Playwright Fixture, Selenium Fixture, Appium Fixture.
• Each wraps objects/contexts from their respective automation library.
c. Core Engine Layer
• AI Fixture Base: shared fixture API.
• AI Context: orchestrator that receives calls from the fixture, applies prompting tips, calls the cache or LLM client.
• Cache Manager: checks/stores prompt → result mappings.
• LLM Factory: reads AUTOWING_MODEL_PROVIDER, instantiates a concrete client.
• LLM Client Plugins: OpenAIClient, DeepSeekClient, QwenClient, DouBaoClient.
d. External Services
• HTTP endpoints of each LLM provider.
e. Utilities
• transition.py: post‑process LLM outputs into actionable test commands or assertions.
Architectural Patterns & Design Principles
• Plugin/Factory Pattern for LLM clients—decouples provider logic.
• Layered Architecture separating:
• UI framework integration
• Core orchestration (caching, context)
• External API clients
• Single‑Responsibility & Open‑Closed: new frameworks/LLMs can plug in without changing core.
Step‑by‑Step Construction
• AI Fixture Base
• AI Context