npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

codeception-module-playwright

v0.2.0

Published

🚀 This is the **first and the only module that allows [Playwright](https://playwright.dev) testing in PHP**. Playwright allows testing in Chrome, Firefox, Webkit (safari). It is faster and more reliable alternative to Selenium WebDriver. Finally it is av

Downloads

74

Readme

Playwright module for Codeception

🚀 This is the first and the only module that allows Playwright testing in PHP. Playwright allows testing in Chrome, Firefox, Webkit (safari). It is faster and more reliable alternative to Selenium WebDriver. Finally it is available in PHP!

This module does not implement Playwright API in PHP, rather proxies requests to Playwright helper of CodeceptJS. This is possible because Codeception and CodeceptJS share the same architecture principles, and the interface for web testing is quite the same.

[!Note] This module can be used as a replacement for WebDriver module. Comparing to WebDriver module, Playwright module can speed up your tests x3 times, run in headless mode, record videos, and stack traces out of the box

Requirements

  • PHP 8.1+
  • NodeJS 20+

Installation

[!Warning] This module is experimental. It is in early development stage. Please report any issues you find.

Install NodeJS part of this module, it will install Playwright and CodeceptJS

npm install codeception-module-playwright

Install Playwright browsers

npx playwright install --with-deps

Install PHP part of this module

composer require codeception/module-playwright --dev

Configuration

Enable module in codeception.yml:

modules:
    enabled:
        - Playwright:
            url: 'http://localhost'
            browser: 'chromium'
            show: true

Most common config values are:

  • url - base url to open pages from
  • browser - either chromium, firefox, webkit
  • show - (default: true) to show browser or set to false to run tests in headless mode
  • timeout - (default: 5000) timeout (in ms) for all Playwright operations
  • pw_server - (default: 'http://localhost:8191') url of Playwright Server
  • pw_debug - (default: false) print Playwright Server debug information
  • video - save video on fail
  • trace - save traces on fail

More configuration options are is listed on CodeceptJS Playwright page

[!Tip] This module is designed as drop-in WebDriver module replacement, you can change WebDriver to Playwright in your tests and try how it works!

Usage

Playwright module requires NodeJS server to be running. Start the server manually:

npx codeception-playwright-module

If you want to start server automatically, use RunProcess extension from Codeception

extensions:
    enabled:
        - Codeception\Extension\RunProcess:
            0: npx codeception-playwright-module
            sleep: 3 # wait 5 seconds for processes to boot

If you start server on different host or port, run port with --port option:

npx codeception-playwright-module --port 9999

And pass port to config

modules:
    enabled:
        - Playwright:
            url: 'http://localhost'
            browser: 'chromium'
            show: true
            pw_server: http://localhost:8191

API

This module provides the same API as WebDriver module. You can try to use it in your tests without any changes.

For the full command list see WebDriver module reference.

Playwright-specific commands are also available in CodeceptJS Playwright Helper

Example

$I->amOnPage('/');
$I->click('#first .clickable');
$I->dontSeeInTitle('Error');
$I->fillField('Username', 'John');
$I->fillField('Password', '1233456');
$I->see('Hello, world!');

License MIT