承接 rainlab/dusk-plugin 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

rainlab/dusk-plugin

Composer 安装命令:

composer require rainlab/dusk-plugin

包简介

Browser testing for October CMS, powered by Laravel Dusk.

README 文档

README

Browser testing for October CMS, powered by Laravel Dusk.

Installation Instructions

To install with Composer, run from your project root

composer require rainlab/dusk-plugin

If using the latest version of Chrome, install the latest version of ChromeDriver for your OS.

php artisan dusk:chrome-driver

Otherwise, check the version of the Chrome browser you have installed, and install a given version of ChromeDriver for your OS.

php artisan dusk:chrome-driver 86

Defining Tests

To make your first test, create a new class inside the tests/browser folder. The following will authenticate to the backend panel and sign out again.

// File: plugins/october/test/tests/browser/AuthenticationTest.php
//
class AuthenticationTest extends BrowserTestCase
{
    public function testAuthentication()
    {
        $this->browse(function($browser) {
            $browser
                ->visit('/admin')
                ->waitForLocation('/admin/backend/auth/signin')
                ->assertTitleContains('Administration Area |')
                ->type('login', env('DUSK_ADMIN_USER', 'admin'))
                ->type('password', env('DUSK_ADMIN_PASS', 'admin'))
                ->check('remember')
                ->press('Login');

            $browser
                ->waitForLocation('/admin')
                ->assertTitleContains('Dashboard |')
                ->click('#layout-mainmenu .mainmenu-account > a')
                ->clickLink('Sign Out');

            $browser
                ->waitForLocation('/admin/backend/auth/signin')
                ->assertTitleContains('Administration Area |');
        });
    }
}

Creating Environment File

The .env.dusk environment file can be used for Dusk specific configuration. It is advisable to include the application URL to test in this file.

APP_URL=http://mylocalsite.dev/

Running Tests

Use the test:dusk artisan command to run the dusk tests for a plugin code (first argument).

php artisan test:dusk <PLUGIN CODE>

The following runs tests for the October.Test plugin.

php artisan test:dusk october.test

Use the --browse to enable interactive mode.

php artisan test:dusk october.test --browse

Use the --filter option to run a single test where the value is the test class name.

php artisan test:dusk october.test --filter=PeopleTest

End to End Example

Follow these instructions to get a test up and running.

  1. Install the latest version of Chrome browser

  2. Install a fresh copy of October CMS

  3. Install this plugin composer require rainlab/dusk-plugin

  4. Install latest chrome driver php artisan dusk:chrome-driver

  5. Install Test plugin php artisan plugin:install October.Test --from=https://github.com/octobercms/test-plugin

  6. Create a file .env.dusk and include APP_URL=http://yourlocaldev.tld inside

  7. Run tests php artisan test:dusk october.test --browse

See Also

License

This plugin is an official extension of the October CMS platform and is free to use if you have a platform license. See EULA license for more details.

统计信息

  • 总下载量: 1.32k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2020-04-19