pikanji/dusktests-plugin
Composer 安装命令:
composer require pikanji/dusktests-plugin
包简介
Enables to write test using Laravel's Dusk test framework.
README 文档
README
This plugin enables to use Laravel Dusk test framework in OctoberCMS projects.
Usage
Installation
Installation options are;
- OctoberCMS UI (not yet available now)
- Composer
- Manual
git clone
With Composer
Execute below at the root of your project:
composer require --dev pikanji/dusktests-plugin
php artisan dusk:install
Manual Git Clone
Although composer is still required to install dependencies, you can install this plugin without adding it to your composer.json.
In the plugins directory of your project, create pikanji directory and simply execute git clone in it.
cd plugins
mkdir pikanji
cd pikanji
git clone git@github.com:pikanji/oc-dusktests-plugin.git dusktests
Execute below at the root of your project.
composer update
php artisan dusk:install
Executing Tests
Dusk comes with example test (tests/Browser/ExampleTest.php). You can test setup by running this test.
Fix Example Test
ExampleTest.php checks if a string "Laravel" is found in the loaded web page. Assuming that your are using fresh copy of demo theme, change "Laravel" to "October CMS" in ExampleTest.php to let the test pass.
public function testBasicExample()
{
$this->browse(function (Browser $browser) {
$browser->visit('/')
->assertSee('October CMS');
});
}
Run Tests
Assuming you are running your web server on your local machine for testing and Chrome browser is installed, execute below at the root of your project. If you are running web server on Docker container see here in addition to this instruction.
php artisan dusk
Test could be very slow. Leave it for a couple minutes to see if it has progress.
Screenshots are stored in tests/Browser/screenshots by default. There might be some configuration to change it.
Extending Timeout
If you get timeout error, you can try extending timeout like below in tests/DuskTestCase.php.
In my case, 1 minute was not enough. So, I made it 3 minutes.
return RemoteWebDriver::create(
'http://192.168.1.115:4444/wd/hub', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
), 180*1000, 180*1000
);
Using Docker Container
See here in addition to this instruction.
pikanji/dusktests-plugin 适用场景与选型建议
pikanji/dusktests-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 281 次下载、GitHub Stars 达 4, 最近一次更新时间为 2017 年 12 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pikanji/dusktests-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pikanji/dusktests-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 281
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-10