grmpyprogrammer,
@grmpyprogrammer@phpc.social avatar

Do any of my peeps have some recommendations for integrating Playwright into your testing infrastructure -- interested to hear how they handle circumstances where you need to execute PHP code as part of the tests to do things like verify data exists on third-party systems

mglaman,
@mglaman@phpc.social avatar

@grmpyprogrammer I haven't used, but have with Nightwatch and Cypress. Using custom commands we execute the CLI management tool. If one doesn't exist, then just a PHP script using execSync or whatever the Node API call is

grmpyprogrammer,
@grmpyprogrammer@phpc.social avatar

@mglaman Sounds interesting — got a link to Nightwatch?

mglaman,
@mglaman@phpc.social avatar

@grmpyprogrammer https://nightwatchjs.org/

It's the E2E test framework Drupal core uses. They have "commands" and I've used those to execute processes for test setup or tear down.

Drupal core uses it to install and uninstall sites between tests.

paladin,
@paladin@mastodon.online avatar

@grmpyprogrammer Didn't knew Playwright ... what are the pros/cons to cypress?

grmpyprogrammer,
@grmpyprogrammer@phpc.social avatar

@paladin The big one seems to be that their API has more languages supported beyond just JavaScript, which opens up the possibility of building PHP support

paladin,
@paladin@mastodon.online avatar

@grmpyprogrammer Thanks for sharing, I'll take a look at it 😉

zimzat,
@zimzat@mastodon.social avatar

@grmpyprogrammer In Symfony apps we create a APP_ENV=dev/test route that the tests can access and get JSON responses from. We've used that to create dynamic sample data, run message queues, or other specific console commands as necessary, etc.

robert,
@robert@flownative.social avatar

@grmpyprogrammer @christopher you probably have, right?

christopher,
@christopher@networkteam.social avatar

@robert @grmpyprogrammer I implemented a separate HTTP test API that is called from Playwright to set up data. Works great with https://playwright.dev/docs/test-fixtures . Could also be used to verify internal state.

sebastian,

@christopher @robert @grmpyprogrammer https://github.com/sandstorm/Sandstorm.E2ETestTools is how we are solving this :) basically sending js to control playwright to a node http server

grmpyprogrammer,
@grmpyprogrammer@phpc.social avatar

@sebastian @christopher @robert This is very helpful, I appreciate you sharing

sebastian,

@grmpyprogrammer @christopher @robert let me know if you have further questions :)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • php
  • tacticalgear
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • osvaldo12
  • Youngstown
  • ngwrru68w68
  • slotface
  • everett
  • rosin
  • thenastyranch
  • kavyap
  • GTA5RPClips
  • modclub
  • megavids
  • normalnudes
  • cubers
  • ethstaker
  • mdbf
  • Durango
  • khanakhh
  • tester
  • provamag3
  • cisconetworking
  • Leos
  • anitta
  • JUstTest
  • lostlight
  • All magazines