Skip to content

fix: Refactor Playwright E2E tests for sequential execution and reliability - #2219

Merged
NoumaanAhamed merged 13 commits into
developfrom
fix/update-playwright-tests-specs
Dec 3, 2025
Merged

NoumaanAhamed merged 13 commits into
developfrom
fix/update-playwright-tests-specs

Conversation

@NoumaanAhamed

@NoumaanAhamed NoumaanAhamed commented Nov 24, 2025 •

Copy link
Copy Markdown
Collaborator

Description

This PR comprehensively refactors the Playwright E2E test suite to ensure stability, reliability, and consistent CI execution.

Changes Made

1. Sequential Test Execution (Commit: da0108ec2)

File: playwright.config.ts

  • Changed workers: 3 → workers: 1 to run tests sequentially
  • Prevents race conditions where multiple tests modify the same WordPress settings

2. Cleanup Test Suite (Commits: 164019173, 2315ed238)

File: specs/cleanup.spec.js

3. Test Refinements and Fixes (Commit: 176c01332)

Files: Multiple test specs

BuddyPress Tests (01_integrated-features.spec.js):

  • Fixed "Enable media in group" test
  • Fixed "Enable media Likes" test

Display Tests (01_single-media-view.spec.js):

  • Removed masonry support as it's not working ( FIX )

User Terms (02_user_terms.spec.js):

  • Removed redundant cleanup code
  • Streamlined test flow

Test Utils (activity.js):

  • added await for async method

Prerequisite and Media(prerequisite.spec.js and media_size.spec.js)

  • Added enable upload options for media in prerequisite
  • Fixed media sizes for medium size images with regex.

4. CI Integration (Commit: 18dbae622)

File: package.json

  • Added test-e2e:playwright:prod script for CI environments
  • Configured proper reporter for CI execution

Test Coverage

All tests have been validated and pass consistently:

Total: 21 E2E tests passing consistently

Breaking Changes

None. All changes are backward compatible.

Testing

Local Testing

cd tests/wp-e2e-playwright
npm install
npm run test-e2e:playwright:prod

Benefits for Dependabot

This fix directly enables merging of Dependabot PRs:

  1. Consistent Test Results: Dependabot PRs no longer fail due to flaky tests
  2. Security Updates: Critical security patches no longer get blocked by test failures
  3. Reduced Maintenance: No manual intervention needed for dependency updates

Related Issues

Fixes #2220

Screenshots/Recordings

Before: Parallel Execution with Conflicts

image
workers: 3
✗ Enable media toggle - FAILED (race condition)
✗ Validate photo type - FAILED (settings conflict)
✗ Enable privacy - FAILED (timing issue)

After: Sequential Execution with Cleanup

image
workers: 1
✓ 00_prerequisite - Enable all of the prerequisite
✓ 01_types - Validate photo type
✓ 01_types - Validate video type
✓ 01_types - Validate Music type
✓ 02_media_size - Enter photo size
✓ 02_media_size - Validate video size
✓ buddypress/01 - Enable media toggle
✓ buddypress/01 - Enable media in group
... (all 21 tests pass)

@NoumaanAhamed NoumaanAhamed changed the title Fix/update playwright tests specs fix: Refactor Playwright E2E tests for sequential execution and reliability Nov 25, 2025
@NoumaanAhamed
NoumaanAhamed marked this pull request as ready for review November 25, 2025 06:31
Copilot AI review requested due to automatic review settings November 25, 2025 06:31

This comment was marked as resolved.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

expect(await activity.getPhotoSize()).toContain(expectedMediumSize);
expect(await activity.getPhotoSize()).toMatch(regex);

//validting large Photo size

Copilot AI Nov 25, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: "validting" should be "validating"

Suggested change
//validting large Photo size
//validating large Photo size

Copilot uses AI. Check for mistakes.
@NoumaanAhamed
NoumaanAhamed merged commit edceb52 into develop Dec 3, 2025
6 checks passed
@NoumaanAhamed
NoumaanAhamed deleted the fix/update-playwright-tests-specs branch January 8, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Fix Playwright E2E Tests: Sequential Execution, Test Cleanup, and CI Stability

3 participants