This is a simple example of how to mock MQTT messages using Playwright. See the full blog post: https://camillovisini.com/coding/mocking-mqtt-with-playwright
Install dependencies:
npm install
Run Mosquitto MQTT broker:
docker compose up
Run the demo page:
npm run dev
Run the tests (MQTT is mocked, so no need to run the broker):
npm test