Architecture Overview
The Playwright Power Platform Toolkit uses a layered architecture with factory and provider patterns to simplify testing Power Platform applications.
Quick Start: New to the toolkit? Check out the Getting Started Guide first.
Architecture Layers
The toolkit provides three levels of abstraction for different use cases:
Level 1: AppProvider (Recommended)
Best for: Testing existing apps
The simplest API for launching and testing Power Platform apps.
const provider = new AppProvider(page);
await provider.launch({ app: { id: 'app-id' }, type: AppType.Canvas });
await provider.click({ name: 'Submit' });Learn more about AppProvider →
Level 2: AppLauncherFactory (Advanced)
Best for: Custom launcher logic and advanced scenarios
Direct access to app launchers with caching and factory management.
const launcher = AppLauncherFactory.getCanvasLauncher(page);
await launcher.launchById('app-id', baseUrl, AppLaunchMode.Play);Learn more about Factory Pattern →
Level 3: Page Objects (Full Control)
Best for: Creating new apps and studio operations
Direct access to page objects for maximum control and app creation capabilities.
const powerApps = new PowerAppsPage(page);
await powerApps.canvas.createBlankCanvasApp('TestApp');Learn more about Page Objects →
System Architecture
Core Components
| Component | Purpose | Learn More |
|---|---|---|
| AppProvider | Simplest API for customers | Usage Patterns |
| AppLauncherFactory | Create and manage launchers | Usage Patterns |
| PowerAppsPage | Unified entry point | Usage Patterns |
| CanvasAppPage | Canvas-specific operations | Core Components |
| ModelDrivenAppPage | Model Driven operations | Core Components |
| IAppLauncher | Contract for all launchers | Core Components |
Key Design Principles
1. Separation of Concerns
Each layer has a specific responsibility, making the toolkit easy to understand and maintain.
2. Extensibility
Tip: Adding a new app type is easy! Just implement the
IAppLauncherinterface.
The factory pattern makes it simple to add support for new app types. See the Extension Guide for details.
3. Flexibility
Three levels of abstraction let you choose the right tool for the job:
- Simple tests? Use AppProvider
- Advanced scenarios? Use the Factory
- Maximum control? Use Page Objects directly
4. Type Safety
Full TypeScript support with interfaces and enums ensures compile-time safety and excellent IDE support.
5. Performance
Factory caching ensures launcher instances are reused for better performance.
Quick Decision Guide
Not sure which pattern to use? Here’s a quick guide:
Testing existing app by ID? → AppProvider ✅
Testing existing app by name? → AppProvider with PowerAppsPage ✅
Creating new app? → PowerAppsPage ✅
Need custom logic? → AppLauncherFactory ✅
Need maximum control? → Page Objects directly ✅
Adding new app type? → Implement IAppLauncher ✅Explore the Architecture
Core Components
Understand the classes, interfaces, and their relationships
Usage Patterns
Learn when and how to use each pattern with examples and decision trees
Sequence Diagrams
See detailed interaction flows between components
Extending
Add support for new app types with the extension guide
Additional Resources
- Quick Reference - Quick reference card for common tasks
- Architecture Diagram - Detailed system architecture diagram
- Getting Started Guide - Complete usage guide
- Example Tests - Runnable example tests
- API Reference - Complete API documentation
Architecture Status: ✅ Production Ready
Last Updated: January 2026