BDD 在本地工作,但在带有 Alpine 的 GitLab 管道中不起作用 Linux

BDD works local but doesn't work in GitLab Pipeline with Alpine Linux

我的负面测试场景方案失败了,但是当我在本地 运行 他们通过了。 根据我的 BDD,无效访问的系统消息是葡萄牙语,但我收到的是英语。预期:“Login/Senha incorreto” 得到:“访问被拒绝:凭据无效。”

My code in file: .gitlab-cy.yml
before_script: 
 - chmod +x alpine.sh
 - ./alpine.sh
 - gem install bundler --no-document

image: ruby:alpine

test:
  stage: test
  script:
  - bundle install
  - bundle exec cucumber
  
code file alpine.sh
echo "http://dl-4.alpinelinux.org/alpine/v3.9/main" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.9/community" >> /etc/apk/repositories 

apk update && \
    apk add build-base \
    libxml2-dev \
    libxslt-dev \
    curl unzip libexif udev chromium chromium-chromedriver wait4ports xvfb xorg-server dbus ttf-freefont mesa-dri-swrast \
    && rm -rf /var/cache/apk/*

message error pipeline gitlab
Scenario: Logar com credenciais invalidas
The results is: ✗
----------------------------------------------
      |   tester    |    1234     |  Login/Senha incorreto |  
  
  ----------------------------------------------, Reason:, 
  expected: "Login/Senha incorreto"
       got: "Access Denied: Invalid credentials."
  
  (compared using eql?)
  , ----------------------------------------------
      
      expected: "Login/Senha incorreto"
           got: "Access Denied: Invalid credentials."
      
      (compared using eql?)
       (RSpec::Expectations::ExpectationNotMetError)
      ./features/step_definitions/login.rb:22:in `block (2 levels) in <top (required)>'
      ./features/step_definitions/login.rb:20:in `nil'
      features/specs/login.feature:18:14:in `ele visualiza a mensagem de alerta "Login/Senha incorreto"'
true
Results:

您应该尝试强制使用 OS 语言:

export LANG=C

export LC_ALL=C

en_US.UTF-8或类似的。

因此在您的用例中:

before_script: 
 - chmod +x alpine.sh
 - export LC_ALL=C
 - ./alpine.sh
 - gem install bundler --no-document

test:
  stage: test
  script:
  - export LC_ALL=C
  - bundle install
  - bundle exec cucumber

通过查看您提供的输出,我无法理解哪个块以错误结尾。