加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Laravel Phpunit和Dusk与CircleCI

发布时间:2020-12-14 19:44:44 所属栏目:大数据 来源:网络整理
导读:有没有人能够在 CircleCI上获得 Laravel Dusk. 我可以让我的构建工作并使用PHPUnit进行测试但是Laravel Dusk失败了. 我有一个安装了Dusk的Laravel基础安装.当我进入php artisan dusk命令时,我收到以下错误. 错误 1) TestsBrowserExampleTest::testBasicExa
有没有人能够在 CircleCI上获得 Laravel Dusk.

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

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

错误

1) TestsBrowserExampleTest::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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读