ArchitectureOverview

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:

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

ComponentPurposeLearn More
AppProviderSimplest API for customersUsage Patterns
AppLauncherFactoryCreate and manage launchersUsage Patterns
PowerAppsPageUnified entry pointUsage Patterns
CanvasAppPageCanvas-specific operationsCore Components
ModelDrivenAppPageModel Driven operationsCore Components
IAppLauncherContract for all launchersCore 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 IAppLauncher interface.

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 ✅

See detailed decision tree →

Explore the Architecture

Additional Resources


Architecture Status: ✅ Production Ready

Last Updated: January 2026