Select2.js support for the Laravel Dusk testing. Support Select2 v3 and Select2 v4 versions.
composer require --dev roquie/laravel-dusk-select2
Now, u may use it!
For default select2:
$browse->select2('@selector');
@selector
class name of your <select>
html tag.
If value not passed, it be selected automatically.
Another way, if need concrete value:
$browse->select2('@selector', 'you_text_value');
For multiple mode usage like this:
$browse->select2('@selector', ['foo', 'bar'], 5);
// the last parameter - maximum count of seconds for ajax loading before choice item.
+ select2
out of the box?.Without breaking changes.
roquie/laravel-dusk-select2
dependency to ^2.1
in your composer.json
file.laravel/dusk
package and does not depend on full Laravel Framework like before in 1.*.composer.lock
2.0
version of this package potentially has full compatibility with select2 v.3 and v.4.But, I deleted a lot of code regarding select2 v.3. Tests passed for both versions, but withsome changes.
roquie/laravel-dusk-select2
dependency to ^2.0
in your composer.json
file.konsulting/dusk-standalone
package to run tests. It more better solution, compares to download full laravel framework.7.1
(!)roquie/laravel-dusk-select2
dependency to ^1.0
in your composer.json
file. + .select2
from first parameter, also see last parameter.Believe me, it's better to run it all in Docker:
make composer test
MIT License
Copyright (c) 2017-2021 roquie0@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.
这并非laravel官方强制要求的规范,而是我们在日常开发过程中遇到的一些容易忽视的优秀实现方式。 内容 单一职责原则 一个类和一个方法应该只有一个责任。 例如: public function getFullNameAttribute() { if (auth()->user() && auth()->user()->hasRole('client') && auth()->user()
我们这里要讨论的并不是 Laravel 版的 SOLID 原则(想要了解更多 SOLID 原则细节查看这篇文章)亦或是设计模式,而是 Laravel 实际开发中容易被忽略的最佳实践。 内容概览 单一职责原则 胖模型,瘦控制器 验证 业务逻辑应该放到服务类 DRY(Don't Repeat Yourself,不要重复造轮子) 优先使用 Eloquent 而不是查询构建器和原生 SQL 查询,优先使用
单一职责原则 一个类和方法只负责一项职责。 坏代码: public function getFullNameAttribute() { if (auth()->user() && auth()->user()->hasRole('client') && auth()->user()->isVerified()) { return 'Mr. ' . $this->first_
我正在将我的Laravel5.3网站升级到5.5,无法让Dusk在我的本地主机上正常工作。我有其他单元测试可以在本地主机上正常工作,但是由于某些原因,Dusk对任何本地页面返回。本地页面似乎工作很好,在我的桌面上浏览它。 我的DuskTestCase null
介绍 Laravel Dusk 提供了富有表现力、简单易用的浏览器自动化及测试 API 。默认情况下,Dusk 不需要在你的机器上安装 JDK 或者 Selenium 。而是需要使用单独的 Chrome 驱动 进行安装。当然,你也可以自由使用其他的兼容 Selenium 的驱动程序。 安装 你应该先向你的 Composer 依赖添加 laravel/dusk : composer require
Introduction Laravel Dusk provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require you to install JDK or Selenium on your machine. Instead, Dusk uses a
Laravel 是一套简洁、优雅的PHP Web开发框架(PHP Web Framework)。它可以让你从面条一样杂乱的代码中解脱出来;它可以帮你构建一个完美的网络APP,而且每行代码都可以简洁、富于表达力。 功能特点 1、语法更富有表现力 你知道下面这行代码里 “true” 代表什么意思么? $uri = Uri::create(‘some/uri’, array(), array(), tr
我需要空间/Laravel权限的帮助。当我试图分配它给我错误哎呀,看起来像出了问题。 错误 Connection.php第761行中的QueryExcema:SQLSTATE[23000]:完整性约束冲突:1048列role_id不能为空(SQL:插入到(,)值(9,))
Laravel 作为现在最流行的 PHP 框架,其中的知识较多,所以单独拿出来写一篇。 简述 Laravel 的生命周期 Laravel 采用了单一入口模式,应用的所有请求入口都是 public/index.php 文件。 注册类文件自动加载器 : Laravel通过 composer 进行依赖管理,无需开发者手动导入各种类文件,而由自动加载器自行导入。 创建服务容器:从 bootstrap/ap