首页 > 解决方案 > Codeception 和 GitLab CI 无法运行

问题描述

目前我正在尝试在 GitLab CI 中配置 Codeception,但遇到了问题。

这是我的 gitlab-ci.yml

stages:
  - run


variables:
  TEST_URL: "example"


run-chrome:
  stage: run
  tags:
    - docker
  image: php:7.2-cli-alpine
  services:
    - name: selenium/standalone-chrome
      alias: chrome
  script:
    - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    - composer install
    - echo Running tests on $TEST_URL
    - vendor/bin/codecept run --env docker-chrome
  artifacts:
    paths:
      - tests/_output
    expire_in: 7 day
    when: on_failure

我在我的 composer.json 中使用 Codeception 4.0。

我的acceptance.suite.yml 看起来像:

class_name: AcceptanceTester
modules:
  enabled:
    - Helper\WebDriver
    - Helper\Acceptance

extensions:
  enable:
    - Codeception\Extension\Recorder

step_decorators:
  - \Codeception\Step\Retry
  - \Codeception\Step\TryTo

env:       
  docker-chrome:
    modules:
      config:
        Helper\WebDriver:
          browser: chrome
          host: chrome
          wait: 5
          capabilities:
            chromeOptions:
              args: ["--headless", "--disable-gpu"]

我收到的错误消息是:

[RuntimeException] 调用未定义的方法 AcceptanceTester::seeInCurrentURL

我希望有一个人可以帮助我。

标签: gitlabgitlab-cigitlab-ci-runnercodeception

解决方案


推荐阅读