Skip to content
Rishan Solutions
Rishan Solutions
  • PowerApps
  • SharePoint online
    • Uncategorized
    • Uncategorized
  • PowerAutomate
Rishan Solutions
Latest Posts
  • Agentic AI: The Dawn of Autonomous Intelligence Revolutionizing 2025 June 24, 2025
  • Recursive Queries in T-SQL May 7, 2025
  • Generating Test Data with CROSS JOIN May 7, 2025
  • Working with Hierarchical Data May 7, 2025
  • Using TRY_CAST vs CAST May 7, 2025
  • Dynamic SQL Execution with sp_executesql May 7, 2025

Automating regression tests using Playwright

Posted on April 15, 2025April 15, 2025 by Rishan Solutions

Loading

When building and maintaining PowerApps Portals, regression testing ensures that newly deployed changes do not break existing functionality. Manually testing every feature is time-consuming and error-prone. Automating regression tests using Playwright, a Node.js-based end-to-end testing tool, can significantly streamline this process by testing your portal in real browsers like Chrome, Firefox, and WebKit.

Below is a detailed, step-by-step guide on how to set up and automate regression tests using Playwright, specifically tailored for PowerApps Portals.


1. What is Playwright?

Playwright is a modern open-source automation tool developed by Microsoft. It allows:

  • End-to-end testing across Chromium, Firefox, and WebKit
  • Running tests in headless or headed mode
  • Network mocking, visual comparisons, and parallel execution

It’s ideal for automating user flows on portals where form submissions, login, navigation, and data loading need to be verified repeatedly.


2. Why Use Playwright for PowerApps Portals?

Cross-browser support
Easy to write and maintain test scripts
Excellent for complex interactions like:

  • Multi-step forms
  • JavaScript-heavy pages
  • Responsive components
    CI/CD-friendly (can be integrated into GitHub Actions, Azure DevOps)

3. Prerequisites

Before starting:

  • Install Node.js (v16 or above)
  • Have access to your PowerApps Portal URL
  • Optional: Have credentials for testing user login (if needed)

4. Setting Up Playwright

Step 1: Create a project folder

mkdir portal-tests
cd portal-tests
npm init -y

Step 2: Install Playwright

npm install -D @playwright/test
npx playwright install

This installs Chromium, Firefox, and WebKit drivers.


5. Creating Your First Test

Create a file home.spec.ts inside a tests folder:

bashCopyEditmkdir tests
touch tests/home.spec.ts

Sample test to verify homepage loads and title exists:

import { test, expect } from '@playwright/test';

test('Home Page Loads and Title is Visible', async ({ page }) => {
await page.goto('https://yourportal.powerappsportals.com/');

// Check page title
await expect(page).toHaveTitle(/Power Apps Portal/i);

// Check if a heading or banner is visible
await expect(page.locator('h1')).toBeVisible();
});

Run the test:

npx playwright test

6. Example: Testing Login and Form Submission

test('Login and Submit Contact Form', async ({ page }) => {
await page.goto('https://yourportal.powerappsportals.com/');

// Navigate to sign-in
await page.click('text=Sign In');
await page.fill('#Email', 'testuser@example.com');
await page.fill('#Password', 'P@ssword123');
await page.click('text=Login');

// Go to contact form
await page.click('text=Contact Us');
await page.fill('#fullname', 'Irfan Hasan');
await page.fill('#email', 'testuser@example.com');
await page.fill('#message', 'This is a test message.');
await page.click('button[type="submit"]');

// Verify success message
await expect(page.locator('.success-message')).toBeVisible();
});

7. Organizing Regression Tests

Suggested Folder Structure:

portal-tests/
├── tests/
│ ├── home.spec.ts
│ ├── login.spec.ts
│ ├── forms.spec.ts
│ └── navigation.spec.ts
├── utils/
│ └── loginHelper.ts
├── playwright.config.ts
└── package.json

Create helper functions for common actions like login in utils/loginHelper.ts:

export async function login(page, email, password) {
await page.goto('https://yourportal.powerappsportals.com/');
await page.click('text=Sign In');
await page.fill('#Email', email);
await page.fill('#Password', password);
await page.click('text=Login');
}

8. Configuring Playwright

Create a playwright.config.ts file:

import { defineConfig } from '@playwright/test';

export default defineConfig({
testDir: './tests',
timeout: 60000,
retries: 1,
use: {
headless: true,
viewport: { width: 1280, height: 720 },
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
{ name: 'chromium', use: { browserName: 'chromium' } },
{ name: 'firefox', use: { browserName: 'firefox' } },
{ name: 'webkit', use: { browserName: 'webkit' } },
]
});

9. Running Tests Across Browsers

npx playwright test --project=chromium
npx playwright test --project=firefox
npx playwright test --project=webkit

Or run all at once:

bashCopyEditnpx playwright test

10. Viewing Results and Reports

After the run, generate a report:

npx playwright show-report

This will open an HTML-based report showing:

  • Test status
  • Screenshots
  • Errors and logs

11. CI/CD Integration (GitHub Actions)

Create .github/workflows/playwright.yml:

name: Playwright Tests

on: [push]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm install
- run: npx playwright install --with-deps
- run: npx playwright test

12. Best Practices for Regression Testing

  • Test core features: Home, Login, Form submissions, Entity Lists
  • Use data-test-id attributes for locating elements reliably
  • Separate tests into smoke, regression, and functional suites
  • Maintain test data or use mocks if required
  • Enable headless mode for faster execution
  • Validate accessibility with axe-playwright plugin

13. Troubleshooting Tips

IssueFix
Page timeoutIncrease test timeout in config
Element not foundUse await page.waitForSelector()
Login failsConfirm test credentials and selectors
CI/CD failuresRun locally with --debug for investigation

14. When to Run Regression Tests

  • Before every release to production
  • After any major portal or platform updates
  • After modifying JavaScript, CSS, or entity lists

You can also schedule nightly builds to automatically validate your portal’s health.

Posted Under Power Pagesautomate portal tests Browser Automation cross-browser testing form submission test login automation Microsoft portal testing Node.js testing Playwright Playwright GitHub Actions Playwright test examples playwright test setup power pages automation PowerApps Portals testing Regression Testing test automation Power Platform test CI/CD integration

Post navigation

Relying solely on unit tests
Simulating user roles in test environments

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Agentic AI: The Dawn of Autonomous Intelligence Revolutionizing 2025
  • Recursive Queries in T-SQL
  • Generating Test Data with CROSS JOIN
  • Working with Hierarchical Data
  • Using TRY_CAST vs CAST

Recent Comments

  1. Michael Francis on Search , Filter and Lookup in power apps
  2. A WordPress Commenter on Hello world!

Archives

  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • March 2024
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • June 2023
  • May 2023
  • April 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • January 2022

Categories

  • Active Directory
  • AI
  • AngularJS
  • Blockchain
  • Button
  • Buttons
  • Choice Column
  • Cloud
  • Cloud Computing
  • Data Science
  • Distribution List
  • DotNet
  • Dynamics365
  • Excel Desktop
  • Extended Reality (XR) – AR, VR, MR
  • Gallery
  • Icons
  • IoT
  • Java
  • Java Script
  • jQuery
  • Microsoft Teams
  • ML
  • MS Excel
  • MS Office 365
  • MS Word
  • Office 365
  • Outlook
  • PDF File
  • PNP PowerShell
  • Power BI
  • Power Pages
  • Power Platform
  • Power Virtual Agent
  • PowerApps
  • PowerAutomate
  • PowerPoint Desktop
  • PVA
  • Python
  • Quantum Computing
  • Radio button
  • ReactJS
  • Security Groups
  • SharePoint Document library
  • SharePoint online
  • SharePoint onpremise
  • SQL
  • SQL Server
  • Template
  • Uncategorized
  • Variable
  • Visio
  • Visual Studio code
  • Windows
© Rishan Solutions 2026 | Designed by PixaHive.com.
  • Rishan Solutions
Go to mobile version