-
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
Draft
osbre
wants to merge
160
commits into
simpleanalytics:master
Choose a base branch
from
osbre:feat/automated-browser-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 157 commits
Commits
Show all changes
160 commits
Select commit
Hold shift + click to select a range
6bac5d5
gh actions
osbre 6a7bebb
gh
osbre 232f8a8
Tests
osbre b352151
Tests
osbre 9abc618
Tests
osbre 2f4e920
Tests
osbre b36fb74
Tests
osbre ea64fca
Tests
osbre 095b385
Tests
osbre 809ee65
wip
osbre d491144
Tests
osbre 40cc2f5
wip
osbre 4eb627b
Merge remote-tracking branch 'origin/master' into feat/automated-brow…
osbre 461f811
deps
osbre 4cf8750
wip
osbre e5bc7f7
wip
osbre af4a5bd
wip
osbre 032bafb
wip
osbre 63cea2b
wip
osbre c437613
wip
osbre 0c99be1
wip
osbre 2281be0
wip
osbre 18b6af3
wip
osbre 47b9e58
wip
osbre 2bdab97
wip
osbre 00c73d6
wip
osbre 1d66d42
wip
osbre 22e31b0
wip
osbre 1275003
wip
osbre ccb8064
wip
osbre 95244ac
wip
osbre 1f3bcfb
deps
osbre 2bf491b
wip
osbre 75ca7d5
wip
osbre 2e3f7a1
wip
osbre 55cf64d
wip
osbre 3f3f5b7
wip
osbre a86a7cb
wip
osbre baf678c
wip
osbre 448c039
wip
osbre 3f6db8a
wip
osbre 59ed5b6
wip
osbre cc71bd0
wip
osbre 797144f
wip
osbre 13736fd
wip
osbre 9b3031f
wip
osbre 9736c9b
chromium only
osbre 17e3f7b
wip
osbre 504d66f
wip
osbre d2138ad
Refactor
osbre 87918a3
fix
osbre 10219e1
Merge remote-tracking branch 'origin/master' into feat/automated-brow…
osbre abece7c
fix
osbre bc45709
wip
osbre 509aab5
wip
osbre d0b5053
clarify
osbre 7876295
fix
osbre e1ac806
wip
osbre efdada9
fix
osbre 0738fba
wip
osbre 9be4526
wip
osbre 9fef902
custom domain
osbre 9e352d5
typo
osbre 48aa631
wip
osbre 29ef711
wip
osbre 76166a8
wip
osbre 248d70e
wip
osbre f1efa1d
wip
osbre 2f224d1
wip
osbre 9588940
wip
osbre 6b5c935
wip
osbre 873043a
wip
osbre ec1e164
wip
osbre cc6a48e
wip
osbre 09210ee
wip
osbre 759c27b
wip
osbre 77c2c40
wip
osbre 0b2a8d6
wip
osbre cebd00a
wip
osbre e19411a
wip
osbre 7202873
wip
osbre 42760e7
wip
osbre eac5669
wip
osbre ec5ae4e
wip
osbre 609c6db
wip
osbre 702e76c
wip
osbre 61747d5
deps
osbre 5187353
wip
osbre 1647b30
wip
osbre e5ab0c7
wip
osbre e548cfe
wip
osbre f477353
wip
osbre 950eee5
wip
osbre 06c0722
wip
osbre 94cd4d7
wip
osbre c52dbd3
wip
osbre e4ec3c7
wip
osbre 5f850c8
wip
osbre 01e2e8e
wip
osbre ee823a9
wip
osbre 062cee2
wip
osbre 288af21
wip
osbre 02c4a15
wip
osbre 8bd3b9a
wip
osbre a2712ab
wip
osbre 26333c7
wip
osbre d810ec3
wip
osbre 1f8eca8
wip
osbre ab35e08
wip
osbre d32b46e
wip
osbre c4f3d91
wip
osbre faa0ae2
wip
osbre afd5ccb
docker build
osbre 8fae523
docker build
osbre db5b27d
docker build
osbre 73f8597
docker build
osbre 56fb7a2
docker build
osbre 3e6bf96
docker build
osbre 06b6b47
docker build
osbre 35abb78
wip
osbre 431244b
wip
osbre 5116c32
wip
osbre 808c0e8
wip
osbre c78b773
wip
osbre f4a5291
wip
osbre 5e2c9d2
wip
osbre eb52920
wip
osbre fc5f5ba
wip
osbre cb53fbf
wip
osbre 01e5107
wip
osbre 1f0fe03
wip
osbre 327ec18
wip
osbre 39264ac
wip
osbre 7bf690d
wip
osbre 08255f5
wip
osbre fa6d90d
inc timeout
osbre dc5c6b9
wip
osbre 4b42108
wip
osbre 7f50e14
wip
osbre a1aeb6e
wip
osbre 8e4229a
wip
osbre 95d9c0e
wip
osbre 0a7abed
wip
osbre 407f598
move from pestphp to zenstruck/browser
osbre b9f72fa
wip
osbre a38768f
wip
osbre afd5b27
wip
osbre bc860a4
wip
osbre 219d96e
wip
osbre 5b23f49
wip
osbre a1ea9a6
wip
osbre 75d5fe7
wip
osbre a2f564d
Try to fix the E2E test with AI in Opus 4.5
adriaandotcom f9d12c6
Fix Cursor bot bugs
adriaandotcom 97276af
Fix test isolation by ensuring plugin is activated before configuring…
adriaandotcom b8f3b22
Fail fast if one version already fails
adriaandotcom 2d566f0
fix: use activatePluginIfNeeded in first test to prevent failures whe…
adriaandotcom 71d0a9f
fix: add missing --allow-root flag to wp user create commands
adriaandotcom 1b75d2f
Formatting
osbre 7386704
Revert "Try to fix the E2E test with AI in Opus 4.5"
osbre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| ARG PHP_VERSION=8.4 | ||
| FROM dunglas/frankenphp:1.9-php${PHP_VERSION} | ||
|
|
||
| RUN install-php-extensions \ | ||
| bcmath \ | ||
| exif \ | ||
| gd \ | ||
| intl \ | ||
| mbstring \ | ||
| mysqli \ | ||
| opcache \ | ||
| pdo_mysql \ | ||
| zip \ | ||
| curl \ | ||
| xml \ | ||
| dom \ | ||
| simplexml \ | ||
| tokenizer \ | ||
| json \ | ||
| fileinfo \ | ||
| sockets \ | ||
| imagick |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| e2e: | ||
| name: PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }} | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| php: ["8.2", "8.3", "8.4"] | ||
| wordpress: ["6.7", "6.8"] | ||
| exclude: | ||
| # Exclude older PHP versions with newer WordPress | ||
| - php: "7.4" | ||
| wordpress: "6.5.3" | ||
|
|
||
| services: | ||
| mysql: | ||
| image: mysql:8.0 | ||
| env: | ||
| MYSQL_DATABASE: wordpress | ||
| MYSQL_ROOT_PASSWORD: root | ||
| ports: [3306:3306] | ||
| options: >- | ||
| --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot" | ||
| --health-interval=10s | ||
| --health-timeout=5s | ||
| --health-retries=5 | ||
|
|
||
| env: | ||
| WP_VERSION: ${{ matrix.wordpress }} | ||
| 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 | ||
|
|
||
| steps: | ||
| - name: Check MySQL tables | ||
| run: | | ||
| echo "Listing databases:" | ||
| mysql -h 127.0.0.1 -uroot -proot -e "SHOW DATABASES;" | ||
|
|
||
| echo "Checking if 'wordpress' database has any tables:" | ||
| mysql -h 127.0.0.1 -uroot -proot -D wordpress -e "SHOW TABLES;" || echo "No tables found (yet)." | ||
|
|
||
| - name: Checkout plugin | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| # Note: Specified version is only for running tests, | ||
| # as the WordPress PHP version is set inside the FrankenPHP Dockerfile. | ||
| php-version: 8.4 | ||
| extensions: mysqli, zip, gd | ||
| coverage: none | ||
| tools: wp-cli | ||
|
|
||
| - name: Cache WordPress archive | ||
| id: cache-wordpress | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: /tmp/wp | ||
| key: wp-${{ matrix.wordpress }} | ||
|
|
||
| - name: Download WordPress | ||
| if: steps.cache-wordpress.outputs.cache-hit != 'true' | ||
| run: | | ||
| mkdir -p /tmp/wp | ||
| curl -O https://wordpress.org/wordpress-${WP_VERSION}.tar.gz | ||
| tar -xzf wordpress-${WP_VERSION}.tar.gz --strip-components=1 -C /tmp/wp | ||
| rm wordpress-${WP_VERSION}.tar.gz | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build FrankenPHP image (with cache) | ||
| id: build | ||
| uses: docker/build-push-action@v6 | ||
| env: | ||
| DOCKER_BUILD_SUMMARY: false | ||
| with: | ||
| context: . | ||
| file: .github/docker/Dockerfile | ||
| tags: frankenphp-${{ matrix.php }} | ||
| load: true | ||
| build-args: | | ||
| PHP_VERSION=${{ matrix.php }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Start FrankenPHP server | ||
| run: | | ||
| docker run -d \ | ||
| --name frankenphp \ | ||
| --network host \ | ||
| -p 8100:8100 \ | ||
| -v /tmp/wp:/var/www/html \ | ||
| -v $GITHUB_WORKSPACE:/var/www/html/wp-content/plugins/simpleanalytics \ | ||
| -v $GITHUB_WORKSPACE/Caddyfile:/etc/frankenphp/Caddyfile \ | ||
| frankenphp-${{ matrix.php }} | ||
|
|
||
| - name: Install WordPress | ||
| run: | | ||
| rm -f /tmp/wp/wp-config.php | ||
| wp config create \ | ||
| --dbname="$WP_DB_NAME" \ | ||
| --dbuser="$WP_DB_USER" \ | ||
| --dbpass="$WP_DB_PASS" \ | ||
| --dbhost="$WP_DB_HOST" \ | ||
| --path=/tmp/wp \ | ||
| --skip-check | ||
| wp core install \ | ||
| --url="${WP_SITE_URL}" \ | ||
| --title="Test Site" \ | ||
| --admin_user=admin \ | ||
| --admin_password=admin \ | ||
| [email protected] \ | ||
| --path=/tmp/wp \ | ||
| --skip-email \ | ||
| --allow-root | ||
| wp user create author [email protected] --role=author --user_pass=author --path=/tmp/wp | ||
| wp user create editor [email protected] --role=editor --user_pass=editor --path=/tmp/wp | ||
| wp user create subscriber [email protected] --role=subscriber --user_pass=subscriber --path=/tmp/wp | ||
cursor[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Show current config values | ||
| run: wp config list --path=/tmp/wp --allow-root | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 10 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: lts/* | ||
| cache: "pnpm" | ||
|
|
||
| - name: Install pnpm dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Cache composer dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: vendor | ||
| key: composer-${{ hashFiles('composer.lock') }} | ||
|
|
||
| - name: Run composer install | ||
| run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | ||
|
|
||
| - name: Run PHPUnit tests | ||
| run: ./vendor/bin/phpunit | ||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results-php${{ matrix.php }}-wp${{ matrix.wordpress }} | ||
| path: var/browser | ||
| retention-days: 30 | ||
|
|
||
| - name: Show FrankenPHP logs | ||
| if: always() | ||
| run: | | ||
| echo "=== FrankenPHP logs ===" | ||
| docker logs frankenphp || echo "No logs found" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,8 @@ | ||
| .svn | ||
| node* | ||
| vendor* | ||
| build | ||
| vendor/ | ||
| node_modules/ | ||
| .phpunit.result.cache | ||
| var | ||
| drivers | ||
| driver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| local_certs | ||
| auto_https off | ||
| frankenphp | ||
| } | ||
|
|
||
| :8100 { | ||
| @static { | ||
| file | ||
| path *.avif *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.woff2 *.gpx | ||
| } | ||
| header @static Cache-Control max-age=5184000 | ||
| root * /var/www/html/ | ||
| encode br zstd gzip | ||
| php_server | ||
| log { | ||
| format console | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| { | ||
| "require-dev": { | ||
| "rector/rector": "^1.2" | ||
| "rector/rector": "^1.2", | ||
| "zenstruck/browser": "^1.9", | ||
| "phpunit/phpunit": "^12", | ||
| "symfony/panther": "^2.2", | ||
| "dbrekelmans/bdi": "^1.4" | ||
| }, | ||
| "autoload": { | ||
| "psr-4": { | ||
| "Tests\\": "tests/" | ||
| } | ||
| }, | ||
| "config": { | ||
| "allow-plugins": { | ||
| "pestphp/pest-plugin": true | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.