Comprehensive testing framework for Microsoft Power Platform with Playwright - includes Page Object Models, test fixtures, API testing, accessibility testing, and authentication utilities for Power Apps, Dataverse, and Power Platform applications
npm install playwright-power-platform-toolkit





Enterprise Test Automation Framework for Microsoft Power Platform
A production-ready, comprehensive testing framework library for Power Platform applications built on Playwright. Supports Canvas Apps, Model-Driven Apps, and Power Platform services with robust authentication, API testing, accessibility testing, and intelligent reporting capabilities.
This project follows a clean separation between the Enterprise Test Automation Framework (this library) and Consumer Test Infrastructure (your test projects).
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Consumer Test Infrastructure β
β (Your Test Projects) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββββββββββββββββββββββββ β
β β Utils β β Test Infrastructure β β
β ββββββββββββββββ€ ββββββββββββββββββββββββββββββββββββββ€ β
β β β’ Fixtures β β β’ Test Setup β’ Test Scripts β β
β β β’ Functions β β β’ Test Utils β’ Shared Steps β β
β β β’ Annotationsβ β β’ Test Teardown β β
β ββββββββββββββββ β β’ Globals (setup & teardown) β β
β ββββββββββββββββββββββββββββββββββββββ β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Configurations β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β
β β β’ Environments β’ Accounts/Teams β β
β β β’ playwright.config.ts (with globalSetup/Teardown) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β imports
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Enterprise Test Automation Framework (This Library) β
β playwright-power-platform-toolkit β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββ
β β Page Object Model β β Accessibility β β API Testing ββ
β ββββββββββββββββββββββββ€ ββββββββββββββββββββββββ€ ββββββββββββββββββ€β
β β β’ Page Classes β β β’ WCAG Rules β β β’ Endpoints ββ
β β β’ Locators Repo β β β’ Axe-Core β β β’ Assertions ββ
β β β’ Utils β β β’ Assertions β β β’ API Recorder ββ
β β β’ Auth Helper β β β’ Violations Report β β β’ Dataverse ββ
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β uses
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Authentication (playwright-ms-auth) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Cert-based Auth β’ Password Auth β’ Token Refresh β
β β’ Storage State Management β’ KeyVault Management β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β built on
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Playwright Core Libraries and Test Runner β
β (@playwright/test package) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β outputs to
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Reporting Layer (playwright-ai-reporter) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Trace Logs β’ Screenshots & Videos β’ AI-powered Analysis β
β β’ Test Suite Logs β’ Email Notifications β’ Bug Tracking Integration β
β β’ Test Failure Suggestions & Fix β’ Reporting & Dashboard β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
#### Page Object Model
- PowerAppsPage: Full POM for Power Apps Maker Portal
- Locators Repository: Maintainable selector management
- Object Repository: Constants and locators organized by page
- Utilities: Common helper functions for page interactions
- Auth Helper: Microsoft authentication integration
#### API Testing
- REST API Testing: Full HTTP methods support (GET, POST, PATCH, DELETE)
- Endpoints: Pre-defined Power Platform API endpoints
- Assertions: Validation helpers for API responses
- API Recorder: Record and replay browser API calls
- Dataverse: Dataverse-specific API utilities
#### Accessibility Testing
- WCAG Rules: Complete WCAG 2.0/2.1 compliance testing
- Axe-Core Integration: Industry-standard accessibility engine
- Assertions: Accessibility-specific validation
- Violations Reporting: Detailed accessibility reports
:
- Certificate-based authentication
- Password-based authentication
- Automatic token refresh
- Storage state management
- Azure KeyVault integrationπ Features
- β
Page Object Model: Pre-built POMs for Power Apps Portal
- β
Microsoft Authentication: Certificate & password auth via playwright-ms-auth
- β
API Testing: Comprehensive REST API testing utilities
- β
Accessibility Testing: WCAG 2.0/2.1 compliance validation
- β
API Recorder: Capture and analyze browser API calls
- β
Test Logger: Colored console output for better debugging
- β
AI-Powered Reporting: Intelligent test failure analysis
- β
TypeScript Support: Full type definitions
- β
Path Aliases: Clean imports (@pages, @locators, @utils, @auth)
- β
Best Practices: Follows Playwright recommended patterns
π¦ Installation
`bash
npm install playwright-power-platform-toolkit --save-dev
`$3
`bash
npm install @playwright/test playwright-ms-auth @axe-core/playwright dotenv --save-dev
`π― Quick Start
$3
`typescript
import {
PowerAppsPage,
ApiTestHelper,
AccessibilityTestHelper,
ConfigHelper,
TestLogger,
} from 'playwright-power-platform-toolkit';
`$3
`typescript
import { test } from '@playwright/test';
import { PowerAppsPage } from 'playwright-power-platform-toolkit';test('Navigate to Apps', async ({ page }) => {
const powerAppsPage = new PowerAppsPage(page);
await powerAppsPage.navigateToApps();
});
`$3
`typescript
import { test } from '@playwright/test';
import { ApiTestHelper, ConfigHelper } from 'playwright-power-platform-toolkit';test('Test Power Apps API', async ({ request }) => {
const config = ConfigHelper.getInstance();
const apiHelper = new ApiTestHelper(request, config);
const response = await apiHelper.get('/providers/Microsoft.PowerApps/apps');
await apiHelper.validateStatusCode(response, 200);
});
`$3
`typescript
import { test, expect } from '@playwright/test';
import { AccessibilityTestHelper } from 'playwright-power-platform-toolkit';test('Check WCAG compliance', async ({ page }) => {
await page.goto('https://make.powerapps.com');
const a11yHelper = new AccessibilityTestHelper(page);
const results = await a11yHelper.scanPage();
expect(results.violations).toHaveLength(0);
});
`π API Reference
$3
Navigation:
-
navigateToHome() - Navigate to Maker home
- navigateToApps() - Navigate to Apps page
- navigateToSolutions() - Navigate to Solutions pageWait Methods:
-
waitForHomePageLoad() - Wait for home page load
- waitForAppsPageLoad() - Wait for Apps page load
- waitForSolutionsPageLoad() - Wait for Solutions page loadApp Management:
-
createApp(appType) - Create new app
- findApp(appName) - Find app by name
- deleteApp(appType, appName) - Delete appUtilities:
-
dismissTeachingBubble() - Dismiss teaching bubbles$3
HTTP Methods:
-
get(endpoint, options?) - GET request
- post(endpoint, data?, options?) - POST request
- patch(endpoint, data?, options?) - PATCH request
- delete(endpoint, options?) - DELETE requestValidation:
-
validateStatusCode(response, code) - Validate HTTP status
- validateResponseTime(response, maxMs) - Validate response time
- validateJsonResponse(response) - Validate JSON responseDataverse:
-
getDataverseRecords(table, options?) - Query Dataverse
- createDataverseRecord(table, data) - Create record
- updateDataverseRecord(table, id, data) - Update record
- deleteDataverseRecord(table, id) - Delete record$3
Scanning:
-
scanPage(options?) - Scan entire page
- scanElement(selector, options?) - Scan specific elementAssertions:
-
assertNoViolations(results) - Assert zero violations
- assertNoCriticalViolations(results) - Allow minor issuesKeyboard Testing:
-
testKeyboardNavigation(elements[]) - Test keyboard access
- testTabOrder(selectors[]) - Test tab sequenceARIA:
-
assertAriaLabel(locator, expected) - Check ARIA label
- checkColorContrast(selector) - Validate contrastReporting:
-
generateReport(results) - Generate text report
- saveReport(results, path) - Save report to file$3
Configuration:
-
getInstance() - Get singleton instance
- getPowerAppsBaseUrl() - Get base URL
- getAuthEmail() - Get auth email
- getTenantId() - Get tenant ID
- getBapApiUrl() - Get BAP API URL
- getAuthToken() - Extract auth token
- checkStorageStateExpiration() - Check token validity$3
Logging:
-
info(message) - Info message (cyan)
- success(message) - Success message (green)
- error(message, error?) - Error message (red)
- warning(message) - Warning message (yellow)
- debug(message) - Debug message (gray)
- step(num, message) - Step message (numbered)$3
Recording:
-
startRecording() - Start recording APIs
- stopRecording() - Stop recording
- saveToFile(path) - Save to JSON
- getStatistics() - Get recording statsOptions:
-
urlFilter - Filter by URL pattern
- resourceTypes - Filter by type (xhr, fetch)$3
CommonUtils:
-
TimeOut - Timeout constants
- waitForCondition() - Wait for condition
- scrollToElement() - Scroll to element
- randomAlphaNumeric() - Generate random string
- delay() - Async delay
- retryWithBackoff() - Retry with exponential backoffColors:
-
colors.fgCyan - Cyan text
- colors.fgGreen - Green text
- colors.fgYellow - Yellow text
- colors.fgRed - Red text
- colors.reset - Reset colorπ Authentication
This library uses
playwright-ms-auth for Microsoft authentication.$3
`env
MS_AUTH_EMAIL=user@domain.com
MS_AUTH_CREDENTIAL_TYPE=certificate
MS_AUTH_CLIENT_ID=your-client-id
MS_AUTH_CERTIFICATE_PATH=./cert.pem
MS_AUTH_CERTIFICATE_KEY_PATH=./key.pem
MS_AUTH_CERTIFICATE_THUMBPRINT=thumbprint
AZURE_TENANT_ID=tenant-id
`$3
`env
MS_AUTH_EMAIL=user@domain.com
MS_AUTH_CREDENTIAL_TYPE=password
MS_USER_PASSWORD=password
AZURE_TENANT_ID=tenant-id
`π Documentation
For comprehensive documentation, see:
- docs/QUICKSTART.md - Getting started guide
- docs/QUICK-REFERENCE.md - Code snippets & cheat sheet
- docs/API-ACCESSIBILITY-GUIDE.md - Advanced features
- docs/FIXTURES-GUIDE.md - Test fixtures guide
- CLAUDE.md - Complete project overview for AI assistants
π§ͺ Example Test Project
See the
e2e-tests/ directory for a complete example of how to use this library in your test project. The example includes:- Test fixtures with auto-injection of library utilities
- Global setup/teardown hooks for test lifecycle management
- Environment-based test filtering (local, dev, test, staging, prod)
- Pre-configured test types (smoke, nightly, API, accessibility, E2E)
- Complete playwright.config.ts with all optimizations
`bash
cd e2e-tests
npm install
npm run auth:headful
npm test
`The example project demonstrates best practices for organizing tests, using fixtures, and structuring a consumer test infrastructure that leverages this library.
ποΈ Building the Library
`bash
Build TypeScript to lib/
npm run buildBuild and watch
npm run build:watchClean build artifacts
npm run clean
`π€ Contributing
$3
1. Clone the repository
`bash
git clone https://github.com/deepakkamboj/playwright-power-platform-toolkit.git
cd playwright-power-platform-toolkit
`2. Install library dependencies
`bash
npm install
`3. Make changes to library source
- Edit files in
src/ directory
- Update exports in src/index.ts if adding new features4. Build the library
`bash
npm run build
`
This compiles TypeScript to JavaScript in the lib/ directory.5. Test your changes
`bash
cd e2e-tests
npm install # Installs the library from parent directory
npm run auth:headful # Authenticate (first time only)
npm test # Run all tests
`6. Verify and document
- Check
src/index.ts exports are correct
- Update documentation if adding new features
- Run npm run format to format code$3
- Library code: Located in
src/, compiled to lib/
- Test code: Located in e2e-tests/
- Build command: Only run npm run build in the root directory
- e2e-tests: Consumes the built library, doesn't need its own buildπ License
MIT
π Related Projects
- Playwright - Browser automation framework
- playwright-ms-auth - Microsoft authentication
- playwright-ai-reporter - AI-powered reporting
π‘ Tips
1. Use the library as a dependency: Install via npm in your test projects
2. Create custom fixtures: Extend the library with your own fixtures in your test project
3. Organize tests: Separate library code from test code
4. Handle auth properly: Run authentication once, reuse storage state
5. Leverage API testing: Use ApiTestHelper for backend validation
6. Check accessibility: Run AccessibilityTestHelper early and often
7. Record APIs: Use ApiRecorder to understand application behavior
8. Use colored logging: TestLogger helps debug issues faster
π Troubleshooting
$3
Make sure the library is properly installed:
`bash
npm install playwright-power-platform-toolkit
`$3
- Verify credentials in
.env
- Check certificate/password is correct
- Ensure MFA is handled if required$3
- Ensure
@playwright/test peer dependency is installed
- Check TypeScript version compatibility
- Verify path aliases in your tsconfig.jsonπ Support
For issues and questions:
- Open an issue on GitHub
- Check the documentation
- Review example tests in
e2e-tests/`