Start a Project

Bagisto + Pest + Playwright: A Modern Laravel Testing Stack

Bagisto Testing Overview

Bagisto ships with both Pest and Playwright in the core repository for comprehensive application testing.

Pest handles backend logic, while Playwright validates real browser-based user interactions.

Together, they provide complete testing coverage from a single codebase.

Bagisto testing with Pest and Playwright

What Each Tool Does in Bagisto Testing

Pest handles unit and feature testing for APIs, models, events, and validation.

Playwright covers end-to-end testing for the admin panel and storefront.

Pest verifies backend behavior and API responses.

Playwright verifies real user interactions in the browser.

Together, they provide complete testing coverage.

Pest in Bagisto Testing

How tests are organised

Bagisto testing — Pest code editor mockup

Pest tests live inside each package, not in a central folder:

Datasets — test all product types in one go

One of the most useful Pest features Bagisto uses is datasets. Instead of writing a separate test for each product type, one test covers all seven:

Pest runs this once per type and labels each run individually in the output.

Running Pest

Use these commands to run the test cases :

Playwright in Bagisto Testing

How tests are organised

Bagisto testing — Playwright browser mockup

Playwright tests live in tests/e2e/, split by area:

Custom fixtures — always start authenticated

Bagisto uses custom Playwright fixtures instead of the default page fixture.

These fixtures provide adminPage and shopPage contexts that are already authenticated.

This removes the need to log in before every test.

beforeEach handles navigation

All tests in a group share a beforeEach that navigates to the right page:

Running Playwright:

On failure, Playwright saves a screenshot and trace automatically. The trace viewer lets you replay the test step by step to see exactly what broke.

Thanks for reading this blog. Please comment below if you have any question.

Also you can hire laravel developers for your custom laravel projects. kindly explore our extensions.

Exit mobile version