Pharo library for doing browser testing with Playwright using the Playwright over WebSocket (pows) host.
Via Metacello:
Metacello new
repository: 'github://tatut/pharo-Pows/src';
baseline: 'Pows';
load.
Or dependency in baseline:
spec package: 'Pows-Core' with: [ spec repository: 'github://tatut/pharo-Pows' ]
You can use the PowsConnection
directly but for testing you should subclass from PowsTestCase
which automatically sets up a connection.
Example of a test method:
testCounter
self
go: 'http://localhost:8080/examples/counter';
locate: 'div.counter' assert: [ :l | l hasText: '0' ];
locate: 'button.inc' do: #click;
locate: 'div.counter' assert: [ :l | l hasText: '1' ];
locate: 'button.dec' do: [ :b | b click; click ];
locate: 'div.counter' assert: [ :l | l hasText: '-1' ]
The PowsTestCase has methods to navigate, assert on locators or do actions on them.