Laravel Phpunit和Dusk与CircleCI

前端之家收集整理的这篇文章主要介绍了Laravel Phpunit和Dusk与CircleCI前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
有没有人能够在 CircleCI上获得 Laravel Dusk.

我可以让我的构建工作并使用PHPUnit进行测试但是Laravel Dusk失败了.

我有一个安装了Dusk的Laravel基础安装.当我进入PHP artisan dusk命令时,我收到以下错误.

错误

1) Tests\Browser\ExampleTest::testBasicExample
Did not see expected text [Laravel] within element [body].
Failed asserting that false is true.

所以它正在启动chromebrowser,但没有进入网站.

我尝试使用Dusk的chromedriver-linux,circleci的chromedriver,不使用PHP服务和其他各种调整.到目前为止,我没有运气.

这是repo链接,相关文件发布在下面.

这是我的circle.yml文件.

machine:
  hosts:
    dusk.dev: 127.0.0.1
  timezone: America/Los_Angeles
  services:
    - MysqL
  environment:
      APP_ENV: testing
      APP_KEY: randomq2VjceHV2t1Usdskeksa9yUI6a
  post:
    - chromedriver:
        background: true
dependencies:
  override:
    - composer install --prefer-dist --no-interaction
  post:
    - mv .env.example .env

test:
  override:
    - vendor/bin/PHPunit
#    - ./vendor/laravel/dusk/bin/chromedriver-linux:
#          background: true
    - sudo PHP artisan serve --host=localhost --port=80:
          background: true
    - PHP artisan dusk

.env.example我复制到.env

APP_ENV=local
APP_KEY=base64:BaGXvpvUWnUbGA1RiOapw45K2UCK8AeYM3o62IDV9Qw=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

屏幕截图(从circleci拉出来并没有太大帮助).

我发现这些文章很有帮助,但它们对我不起作用.

> Running Dusk tests on Travis CI and
CircleCI

> Testing with Laravel Dusk +
CircleCI

以下代码为我们工作.试试这个

circle.yml文件.

machine:
      pre:
        - sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
        - sudo apt-get update
        - sudo apt-get install google-chrome-stable
      services:
        - MysqL
    dependencies:
      override:
        - composer install --prefer-dist --no-interaction
      post:
        - mv .env.testing .env
    test:
      override:
        - vendor/bin/PHPunit
        - ./vendor/laravel/dusk/bin/chromedriver-linux:
              background: true
        - PHP artisan serve:
              background: true
        - PHP artisan dusk

.env.testing

APP_ENV=local
APP_KEY=base64:BaGXvpvUWnUbGA1RiOapw45K2UCK8AeYM3o62IDV9Qw=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost:8000

DB_CONNECTION=MysqL
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

输出Checkout here

原文链接:https://www.f2er.com/laravel/133818.html

猜你在找的Laravel相关文章