Skip to content

Commit 1cd2e28

Browse files
committed
First draft
0 parents  commit 1cd2e28

42 files changed

Lines changed: 3685 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.git* export-ignore
2+
/docs/ export-ignore
3+
/tests/ export-ignore
4+
/.php-cs-fixer.dist.php export-ignore
5+
/phpstan.dist.neon export-ignore
6+
/phpunit.dist.xml export-ignore

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [smnandre]

.github/workflows/CI.yml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
tests:
11+
name: PHP ${{ matrix.php }} / Symfony ${{ matrix.symfony }}
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
php: ['8.3', '8.4']
17+
symfony: ['7.0', '8.0']
18+
exclude:
19+
- php: '8.3'
20+
symfony: '8.0' # Symfony 8.0 requires PHP 8.4+
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
coverage: pcov
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '20'
36+
cache: 'npm'
37+
38+
- name: Install Playwright
39+
run: |
40+
npm install -g playwright@latest
41+
playwright install chromium --with-deps
42+
43+
- name: Get composer cache directory
44+
id: composer-cache
45+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
46+
47+
- name: Cache composer dependencies
48+
uses: actions/cache@v3
49+
with:
50+
path: ${{ steps.composer-cache.outputs.dir }}
51+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
52+
restore-keys: ${{ runner.os }}-composer-
53+
54+
- name: Install dependencies
55+
run: composer install --no-progress --prefer-dist --optimize-autoloader
56+
env:
57+
SYMFONY_REQUIRE: ${{ matrix.symfony }}.*
58+
59+
- name: Install app dependencies
60+
run: |
61+
cd app
62+
composer install --no-progress --prefer-dist --optimize-autoloader
63+
64+
- name: Run code style check
65+
run: composer cs-check
66+
67+
# - name: Run PHPStan
68+
# run: vendor/bin/phpstan analyse --no-progress
69+
70+
- name: Debug Playwright setup
71+
run: php bin/console debug:playwright || true
72+
73+
- name: Run unit tests
74+
run: composer test
75+
env:
76+
PLAYWRIGHT_HEADLESS: true
77+
78+
- name: Run E2E tests
79+
run: |
80+
cd app
81+
vendor/bin/phpunit
82+
env:
83+
PLAYWRIGHT_HEADLESS: true
84+
85+
- name: Generate test coverage
86+
run: composer test-coverage
87+
env:
88+
PLAYWRIGHT_HEADLESS: true
89+
90+
code-quality:
91+
name: Code Quality
92+
runs-on: ubuntu-latest
93+
94+
steps:
95+
- name: Checkout code
96+
uses: actions/checkout@v4
97+
98+
- name: Setup PHP
99+
uses: shivammathur/setup-php@v2
100+
with:
101+
php-version: '8.3'
102+
103+
- name: Install dependencies
104+
run: composer install --no-progress --prefer-dist --optimize-autoloader
105+
106+
- name: Run PHP CS Fixer (dry run)
107+
run: composer cs-check
108+
109+
- name: Run PHPStan
110+
run: vendor/bin/phpstan analyse --no-progress
111+
112+
bundle-test:
113+
name: Bundle Integration Test
114+
runs-on: ubuntu-latest
115+
116+
steps:
117+
- name: Checkout code
118+
uses: actions/checkout@v4
119+
120+
- name: Setup PHP
121+
uses: shivammathur/setup-php@v2
122+
with:
123+
php-version: '8.3'
124+
extensions: mbstring, xml, ctype, iconv, intl
125+
126+
- name: Setup Node.js
127+
uses: actions/setup-node@v4
128+
with:
129+
node-version: '18'
130+
131+
- name: Install Playwright
132+
run: |
133+
npm install -g playwright@latest
134+
playwright install chromium --with-deps
135+
136+
- name: Create test Symfony app
137+
run: |
138+
composer create-project symfony/skeleton bundle-test
139+
cd bundle-test
140+
composer require --dev phpunit/phpunit
141+
142+
- name: Add bundle to test app
143+
run: |
144+
cd bundle-test
145+
echo '{
146+
"repositories": [
147+
{
148+
"type": "path",
149+
"url": "..",
150+
"options": {"symlink": false}
151+
}
152+
]
153+
}' > composer.local.json
154+
composer require playwright-php/playwright-symfony:*
155+
156+
- name: Test bundle integration
157+
run: |
158+
cd bundle-test
159+
php bin/console debug:playwright
160+
php bin/console debug:container | grep -i playwright

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/var/
2+
/vendor/
3+
/.phpunit.cache
4+
/.php-cs-fixer.cache
5+
/coverage.xml
6+
/composer.lock
7+
/phpstan.neon
8+
/phpunit.xml

.php-cs-fixer.dist.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
$licence = <<<'EOF'
4+
This file is part of the playwright-php/playwright package.
5+
For the full copyright and license information, please view
6+
the LICENSE file that was distributed with this source code.
7+
EOF;
8+
9+
$finder = (new PhpCsFixer\Finder())
10+
->in(__DIR__);
11+
12+
return (new PhpCsFixer\Config())
13+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
14+
->setFinder($finder)
15+
->setRiskyAllowed(true)
16+
->setRules([
17+
'@PSR12' => true,
18+
'@Symfony' => true,
19+
'no_unused_imports' => true,
20+
'array_syntax' => ['syntax' => 'short'],
21+
'declare_strict_types' => true,
22+
'header_comment' => ['header' => $licence],
23+
]);

LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
MIT License
2+
3+
Copyright (c) 2025-present Simon André & Playwright PHP
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
---
24+
25+
Third-Party Notice
26+
27+
This project depends on Playwright, an open-source project by Microsoft,
28+
licensed under Apache License 2.0 (https://github.com/microsoft/playwright/blob/main/LICENSE).
29+
"Playwright" is a trademark of Microsoft. This project is independent and not
30+
affiliated with or endorsed by Microsoft.

0 commit comments

Comments
 (0)