-
Notifications
You must be signed in to change notification settings - Fork 4
Automated browser tests #12
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
base: master
Are you sure you want to change the base?
Automated browser tests #12
Conversation
15s
Run ./vendor/bin/phpunit
./vendor/bin/phpunit
shell: /usr/bin/bash -e {0}
env:
WP_VERSION: 6.7
WP_SITE_URL: http://localhost:8100
WP_DB_NAME: wordpress
WP_DB_USER: root
WP_DB_PASS: root
WP_DB_HOST: 127.0.0.1
COMPOSER_PROCESS_TIMEOUT: 0
COMPOSER_NO_INTERACTION: 1
COMPOSER_NO_AUDIT: 1
PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
PHPUnit 12.4.0 by Sebastian Bergmann and contributors.
Runtime: PHP 8.4.14
Configuration: /home/runner/work/wordpress-plugin/wordpress-plugin/phpunit.xml
.E 2 / 2 (100%)
Saved Browser Artifacts:
test_adds_script_with_ignored_pages
Saved Source Files:
* ./var/browser/source/error_Tests-Browser-PluginSettingsTest__test_adds_script_with_ignored_pages__0.html:
Saved Console Logs:
* ./var/browser/console-logs/error_Tests-Browser-PluginSettingsTest__test_adds_script_with_ignored_pages__0.log:
Saved Screenshots:
* ./var/browser/screenshots/error_Tests-Browser-PluginSettingsTest__test_adds_script_with_ignored_pages__0.png:
Time: 00:14.918, Memory: 22.00 MB
There was 1 error:
1) Tests\Browser\PluginSettingsTest::test_adds_script_with_ignored_pages
Behat\Mink\Exception\ElementNotFoundException: Form field with id|name|label|value|placeholder "simpleanalytics_ignore_pages" not found.
/home/runner/work/wordpress-plugin/wordpress-plugin/vendor/behat/mink/src/Element/TraversableElement.php:163
/home/runner/work/wordpress-plugin/wordpress-plugin/vendor/zenstruck/browser/src/Browser.php:214
/home/runner/work/wordpress-plugin/wordpress-plugin/tests/Browser/PluginSettingsTest.php:25
ERRORS!
Tests: 2, Assertions: 6, Errors: 1.
Error: Process completed with exit code 2.
|
Hey @osbre, I fixed the bug with AI, but I have no clue if it also broke something. Would you mind checking? |
… settings The `test_adds_script_with_ignored_pages` test assumed the plugin was already active from a previous test, but PHPUnit tests run in isolation and execution order isn't guaranteed. - Add `activatePluginIfNeeded()` helper to BrowserTestCase that conditionally activates the plugin only if not already active - Update `test_adds_script_with_ignored_pages` to use the helper This ensures the test works regardless of execution order or whether the plugin is already activated.
|
I'll take it from here, thank you @adriaandotcom! It's nice to see the CI pass at this stage. Here's a bit history on the previous progress: At first, I completed all the test cases in PestPHP's newest browsing testing feature, which uses Playwright underneath. Unfortunately, I had some of the weirdest instability issues and browser failures where they shouldn't have been. The tests were passing, but once I re-ran them 8 times on GitHub CI, they would start failing. I couldn't figure out what was the reason for spontaneous timeouts, so I started by replacing the web server from PHP's built-in one to FrankenPHP. It didn't solve it. I made the decision to move away from anything powered by Playwright. Currently, I'm in the process of rewriting it to Symfony's Panther and zenstruck/browser library and seeing whether I'd be able to get rid of random timeouts this way. Although now that I look at it, the shadow dom likely played a role here. |
|
Sounds good @osbre, let me know if you need any help! |
This reverts commit a2f564d.

(In progress. Will force-push and mark as "Ready" when finished)
Note
Introduce full E2E testing pipeline and browser tests, while refactoring plugin internals (settings/hooks, tracking rules, script registry, admin page) and scoping the settings UI.
E2E TestsGitHub Actions workflow running WordPress on FrankenPHP with MySQL, PHPUnit, Panther/Zenstruck Browser; caches WP/composer; uploads artifacts..github/docker/DockerfileandCaddyfilefor FrankenPHP; introducephpunit.xml.TrackingPolicy→TrackingRulesandScriptManager→ScriptRegistry; introduceWordPressHooksandWordPressSettingsfor WP integration.Page→Settings/AdminPageand enhanceWordPressPageIntegrationcontract; wire up insimple-analytics.php.Pluginto DI-based boot flow, activation/uninstall using new settings/hooks; script registration via new registry; add role/IP exclusion logic..sa-settings; remove declarative shadow DOM wrapper; link stylesheet directly; setimportantintailwind.config.js.resources/css/settings.cssand UI layout accordingly.tests/Browser/*and test kernel; composer dev deps for PHPUnit/Panther/Zenstruck;.gitignoreadditions.Written by Cursor Bugbot for commit 71d0a9f. This will update automatically on new commits. Configure here.