conquest/inertia-testbench

An Inertia skeleton for Testbench.

v0.1.1 2024-08-30 10:37 UTC

This package is not auto-updated.

Last update: 2024-09-14 09:21:04 UTC


README

This package provides a skeleton for testing Inertia.js (with Vue) applications with Orchestra Testbench. It is designed to be installed inside a conquest/skeleton-laravel templated package, and allows for full-stack testing.

Using Skeleton with Testbench

These instructions are designed with the conquest/skeleton-laravel template, but can be applied to other Laravel projects. Install the skeleton package:

composer require --dev conquest/inertia-testbench

Autoload the package to resolve the namespace properly inside your composer.json file:

{
    "autoload-dev": {
        "psr-4": {
            "App\\": "vendor/conquest/inertia-testbench/skeleton/app/"
        }
    }
}

Add the following scripts to your composer.json file:

{
    "scripts": {
        "node": "cd vendor/conquest/inertia-testbench/skeleton && npm run dev",
        "node-install": "cd vendor/conquest/inertia-testbench/skeleton && npm i"
    },
}

Execute the command to install the node modules:

composer run node-install

Ensure you have an APP_KEY set in your test case environment. This can be added inside the testbench.yaml file:

env:
    APP_DEBUG: true
    APP_KEY: AckfSECXIvnK5r28GVIWUAxmbBSjTsmF

The server can then be run with both server and client:

composer run serve
composer run node

With Dusk

It is suggested that for full-stack testing, Dusk should be used in conjunction with this package. Testbench comes equipped with a Dusk driver that will allow you to test your application in a real browser.

composer require --dev orchestra/testbench