Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: "CI"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

permissions:
contents: read

jobs:
cs:
name: "Code style"
runs-on: ubuntu-latest
steps:
- name: "Git: checkout"
uses: actions/checkout@v4

- name: "PHP: setup 8.3"
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
tools: php-cs-fixer

- name: "Composer: validate"
run: composer validate --strict

- name: "Composer: install"
run: composer install --prefer-dist --no-interaction --no-progress

- name: "Php-CS-Fixer: version"
run: vendor/bin/php-cs-fixer -V

- name: "Php-CS-Fixer: check"
run: composer run cs-check

sa:
name: "Static Analysis"
runs-on: ubuntu-latest
steps:
- name: "Git: checkout"
uses: actions/checkout@v4

- name: "PHP: setup 8.4"
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: pcov
tools: phpstan

- name: "Composer: install"
run: composer install --prefer-dist --no-interaction --no-progress

- name: "PHPStan: version"
run: vendor/bin/phpstan --version

- name: "PHPStan: analyse"
run: composer run analyse

unit-tests:
name: "Unit Tests (PHP ${{ matrix.php-version }})"
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.3', '8.4']
fail-fast: false
steps:
- name: "Git: checkout"
uses: actions/checkout@v4

- name: "PHP: setup ${{ matrix.php-version }}"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
tools: phpunit

- name: "Composer: install"
run: composer install --prefer-dist --no-interaction --no-progress

- name: "PHPUnit: unit tests"
run: composer run test:unit

integration-tests:
name: "Integration Tests (PHP ${{ matrix.php-version }} ${{ matrix.dependencies }})"
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php-version: '8.3'
dependencies: 'low'
- php-version: '8.4'
dependencies: 'high'
fail-fast: false
steps:
- name: "Git: checkout"
uses: actions/checkout@v4

- name: "PHP: setup ${{ matrix.php-version }}"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
tools: phpunit

- name: "Node: setup"
uses: actions/setup-node@v4
with:
node-version: '20'

- name: "Composer: install (${{ matrix.dependencies }})"
run: |
if [ "${{ matrix.dependencies }}" == "low" ]; then
composer update --prefer-lowest --prefer-dist --no-interaction --no-progress
else
composer install --prefer-dist --no-interaction --no-progress
fi

- name: "Playwright: install browsers"
run: composer run install-browsers

- name: "PHPUnit: version"
run: vendor/bin/phpunit --version

- name: "PHPUnit: all tests with coverage"
run: composer run test -- --coverage-clover=coverage.xml

- name: "Codecov: upload coverage"
uses: codecov/codecov-action@v5
if: matrix.php-version == '8.4' && matrix.dependencies == 'high'
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/bin/pnpm-lock.yaml
/bin/package.lock
/bin/yarn.lock
/coverage/
/node_modules/
/screenshots/
/vendor/
/test-failures/
/todo/
/.php-cs-fixer.cache
/composer.lock
/coverage.xml
/package-lock.json
/playwright-server.log
/phpstan.neon
Expand Down
122 changes: 122 additions & 0 deletions TODO_DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Documentation TODO

This document outlines the planned documentation structure for Playwright PHP.

## Documentation File Tree

```
docs/
├── README.md # Documentation overview and navigation
├── getting-started/
│ ├── installation.md # Installation guide (PHP 8.3+, Node.js 20+)
│ ├── quick-start.md # Basic usage examples
│ ├── configuration.md # Configuration and setup
│ └── troubleshooting.md # Common issues and solutions
├── guides/
│ ├── browser-automation.md # Core browser automation concepts
│ ├── page-interactions.md # Working with pages and elements
│ ├── locators.md # Finding and interacting with elements
│ ├── assertions.md # Jest-style expect() assertions
│ ├── file-uploads-downloads.md # Handling file operations
│ ├── network-requests.md # Intercepting and mocking network
│ ├── mobile-emulation.md # Mobile device testing
│ └── multi-browser-testing.md # Testing across browsers
├── testing/
│ ├── phpunit-integration.md # PHPUnit test framework integration
│ ├── test-helpers.md # Convenient testing utilities
│ ├── test-organization.md # Structuring test suites
│ ├── parallel-testing.md # Running tests in parallel
│ ├── screenshots-videos.md # Visual testing and debugging
│ └── ci-cd-integration.md # Continuous integration setup
├── api-reference/
│ ├── overview.md # API structure overview
│ ├── playwright.md # Main Playwright class
│ ├── browser/
│ │ ├── browser.md # Browser interface
│ │ ├── browser-context.md # BrowserContext interface
│ │ └── browser-type.md # BrowserType (Chromium, Firefox, WebKit)
│ ├── page/
│ │ ├── page.md # Page interface and methods
│ │ ├── frame.md # Frame handling
│ │ └── response.md # HTTP response handling
│ ├── locators/
│ │ ├── locator.md # Locator interface
│ │ └── frame-locator.md # FrameLocator for iframe handling
│ ├── input/
│ │ ├── keyboard.md # Keyboard input simulation
│ │ ├── mouse.md # Mouse interaction
│ │ └── touchscreen.md # Touch input for mobile
│ ├── network/
│ │ ├── request.md # Network request handling
│ │ ├── response.md # Network response handling
│ │ └── route.md # Request routing and mocking
│ ├── dialogs/
│ │ └── dialog.md # Alert, confirm, prompt dialogs
│ ├── console/
│ │ └── console-message.md # Browser console interaction
│ ├── events/
│ │ └── event-handling.md # Event listeners and handling
│ └── exceptions/
│ └── error-handling.md # Exception types and handling
├── configuration/
│ ├── browser-configuration.md # Browser launch options
│ ├── context-configuration.md # Browser context settings
│ ├── playwright-config.md # Main configuration file
│ └── environment-variables.md # Environment-based configuration
├── examples/
│ ├── basic-navigation.md # Simple page navigation
│ ├── form-interactions.md # Form filling and submission
│ ├── element-interactions.md # Clicking, typing, selecting
│ ├── waiting-strategies.md # Auto-wait and custom waits
│ ├── data-extraction.md # Scraping content from pages
│ ├── authentication.md # Login flows and session handling
│ ├── advanced-scenarios.md # Complex automation scenarios
│ └── real-world-examples.md # Complete application examples
├── best-practices/
│ ├── reliable-selectors.md # Writing maintainable selectors
│ ├── test-data-management.md # Managing test data and fixtures
│ ├── performance-optimization.md # Optimizing test execution speed
│ ├── debugging-techniques.md # Debugging failed tests
│ └── maintenance-strategies.md # Keeping tests maintainable
├── migration/
│ ├── from-selenium.md # Migrating from Selenium WebDriver
│ ├── from-other-tools.md # Migrating from other automation tools
│ └── version-upgrades.md # Upgrading between versions
└── contributing/
├── development-setup.md # Setting up development environment
├── coding-standards.md # PHP coding standards and conventions
├── testing-guidelines.md # How to test the library itself
└── release-process.md # Release and versioning process
```

## Priority Order

### Phase 1 (Essential)
1. **getting-started/** - Critical for new users
2. **guides/browser-automation.md** - Core functionality
3. **guides/page-interactions.md** - Basic usage patterns
4. **api-reference/playwright.md** - Main entry point
5. **examples/basic-navigation.md** - Practical examples

### Phase 2 (Important)
1. **testing/phpunit-integration.md** - Key differentiator
2. **api-reference/page/page.md** - Most used interface
3. **api-reference/locators/locator.md** - Core concept
4. **guides/locators.md** - Essential for reliable tests
5. **examples/form-interactions.md** - Common use case

### Phase 3 (Complete Coverage)
1. Complete all api-reference sections
2. Advanced guides and examples
3. Best practices documentation
4. Migration guides
5. Contributing documentation

## Notes

- Each markdown file should include practical code examples
- API reference should include method signatures, parameters, and return types
- Examples should be runnable and tested
- Cross-link related concepts between documents
- Include screenshots/diagrams where helpful
- Maintain consistency with Playwright's official documentation patterns
4 changes: 4 additions & 0 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
debug-dispatch.log
playwright-server.log
screenshot_*
pnpm-lock.yaml
Loading
Loading