Skip to content

Playwright and phpunit tests [TMZ-733] #502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

gsarig
Copy link
Contributor

@gsarig gsarig commented Jun 30, 2025

✨ PR Description

Purpose: Add PHPUnit and Playwright test infrastructure to enable automated testing for the Hello Elementor theme.

Main changes:

  • Added PHPUnit configuration and basic test structure for PHP testing
  • Implemented Playwright framework with TypeScript support for UI/E2E testing
  • Created CI workflows for test automation on GitHub Actions
  • Added utility scripts and configuration files for local test environment setup

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀

@gsarig gsarig changed the title Implements playwright and phpunit tests scaffolding Playwright and phpunit tests [TMZ-733] Jun 30, 2025
@gsarig gsarig marked this pull request as ready for review June 30, 2025 11:41
@nicoladj77 nicoladj77 self-requested a review June 30, 2025 22:37
nicoladj77
nicoladj77 previously approved these changes Jun 30, 2025
Copy link

@gitstream-cm gitstream-cm bot left a comment

Choose a reason for hiding this comment

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

✨ PR Review

The PR introduces comprehensive Playwright and PHPUnit testing infrastructure with extensive test utilities, configuration files, and page object models. The code appears well-structured but contains a few potential issues that should be addressed.

3 issues detected:

🐞 Bug - Incorrect grammar in error message reduces code professionalism and clarity.

Details: Line 6 contains a grammatical error in the error message that could confuse users trying to set up the testing environment.
File: tests/bootstrap.php (6-6)

🐞 Bug - Using for-in loop on arrays iterates over indices as strings, potentially causing incorrect array access.

Details: The deleteMedia method uses for (const id in ids) which iterates over array indices as strings, but then uses ids[id] assuming numeric indexing.
File: tests/playwright/assets/api-requests.ts (70-70)

🐞 Bug - The assignment `retry = retry++` doesn't increment the variable due to operator precedence, potentially causing an infinite loop.

Details: Line 1239 contains retry = retry++ which assigns the pre-increment value back to retry, effectively making it an infinite loop since retry never actually increments.
File: tests/playwright/pages/editor-page.ts (1239-1239)

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀

$composer_autoloader_file = __DIR__ . '/../vendor/autoload.php';

if (!file_exists($composer_autoloader_file)) {
die('Installing composer are required for running the tests.');
Copy link

Choose a reason for hiding this comment

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

🐞 Bug - Grammar Error: Change "Installing composer are required" to "Installing composer is required" or "Composer dependencies are required".

Suggested change
die('Installing composer are required for running the tests.');
die('Installing composer is required for running the tests.');

with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'PHPUnit' step
Uses Step
uses 'shivammathur/setup-php' with ref 'v2', not a pinned commit hash
Copy link

@gitstream-cm gitstream-cm bot left a comment

Choose a reason for hiding this comment

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

✨ PR Review

LGTM

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants