protonemedia/inertiajs-events-laravel-dusk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

protonemedia/inertiajs-events-laravel-dusk

最新稳定版本:1.3.0

Composer 安装命令:

composer require --dev protonemedia/inertiajs-events-laravel-dusk

包简介

Inertia.js Events for Laravel Dusk

README 文档

README

Latest Version on Packagist run-tests Total Downloads Buy us a tree

Requirements

  • PHP 7.4+
  • Vue
  • Laravel 8.0 and 9.0

Support this package!

❤️ We proudly support the community by developing Laravel packages and giving them away for free. If this package saves you time or if you're relying on it professionally, please consider sponsoring the maintenance and development. Keeping track of issues and pull requests takes time, but we're happy to help!

Laravel Splade

Did you hear about Laravel Splade? 🤩

It's the magic of Inertia.js with the simplicity of Blade. Splade provides a super easy way to build Single Page Applications using Blade templates. Besides that magic SPA-feeling, it comes with more than ten components to sparkle your app and make it interactive, all without ever leaving Blade.

Blogpost

If you want to know more about the background of this package, please read the blogpost: A package for Laravel Dusk to wait for Inertia.js events

Installation

You can install the package via composer:

composer require protonemedia/inertiajs-events-laravel-dusk --dev

Add the inertiaEventsCount object to your main JavaScript file, somewhere above the creation of the Vue application instance.

window.inertiaEventsCount = {
    navigateCount: 0,
    successCount: 0,
    errorCount: 0,
}

In the creation of the Vue application instance, use the mounted method to register the event listeners.

import { Inertia } from '@inertiajs/inertia'

new Vue({
  mounted() {
    Inertia.on('navigate', (event) => {
      window.inertiaEventsCount.navigateCount++;
    })

    Inertia.on('success', (event) => {
      window.inertiaEventsCount.successCount++;
    })

    Inertia.on('error', (event) => {
      window.inertiaEventsCount.errorCount++;
    })
  }
})

Usage

This package provides three helper methods for your Laravel Dusk tests.

Error

The waitForInertiaError() method may be used to wait until the Error event is fired. You can use it to assert against responses where validation errors are returned.

Navigate

The waitForInertiaNavigate() method may be used to wait until the Navigate event is fired. You can use it to assert a user is redirected, for example, after submitting a form.

Success

The waitForInertiaSuccess() method may be used to wait until the Success event is fired. This is great for testing forms that don't redirect after successfully submitting a form.

Example test

<?php

namespace Tests\Browser;

use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\DuskTestCase;

class ExampleTest extends DuskTestCase
{
    use DatabaseMigrations;

    /**
     * A basic browser test example.
     *
     * @return void
     */
    public function it_can_store_a_user_and_redirect_back_to_the_index_route()
    {
        $this->browse(function ($browser) {
            $browser->loginAs(User::first())
                    ->visit(route('user.create'))
                    ->type('name', 'New User')
                    ->press('Submit')
                    ->waitForInertiaNavigate()
                    ->assertRouteIs('user.index')
                    ->assertSee('User Added!');
        });
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information about what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Other Laravel packages

  • Laravel Analytics Event Tracking: Laravel package to easily send events to Google Analytics.
  • Laravel Blade On Demand: Laravel package to compile Blade templates in memory.
  • Laravel Cross Eloquent Search: Laravel package to search through multiple Eloquent models.
  • Laravel Eloquent Scope as Select: Stop duplicating your Eloquent query scopes and constraints in PHP. This package lets you re-use your query scopes and constraints by adding them as a subquery.
  • Laravel Eloquent Where Not: This Laravel package allows you to flip/invert an Eloquent scope, or really any query constraint.
  • Laravel FFMpeg: This package provides an integration with FFmpeg for Laravel. The storage of the files is handled by Laravel's Filesystem.
  • Laravel Form Components: Blade components to rapidly build forms with Tailwind CSS Custom Forms and Bootstrap 4. Supports validation, model binding, default values, translations, includes default vendor styling and fully customizable!
  • Laravel Paddle: Paddle.com API integration for Laravel with support for webhooks/events.
  • Laravel Verify New Email: This package adds support for verifying new email addresses: when a user updates its email address, it won't replace the old one until the new one is verified.
  • Laravel WebDAV: WebDAV driver for Laravel's Filesystem.

Security

If you discover any security related issues, please email pascal@protone.media instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Treeware

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

protonemedia/inertiajs-events-laravel-dusk 适用场景与选型建议

protonemedia/inertiajs-events-laravel-dusk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20.5k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2021 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「testing」 「laravel」 「inertia」 「Laravel Dusk」 「inertiajs」 「protonemedia」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 protonemedia/inertiajs-events-laravel-dusk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 protonemedia/inertiajs-events-laravel-dusk 我们能提供哪些服务?
定制开发 / 二次开发

基于 protonemedia/inertiajs-events-laravel-dusk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 20.5k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 23
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 23
  • Watchers: 5
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-08