Home > Software design >  BDD works local but doesn't work in GitLab Pipeline with Alpine Linux
BDD works local but doesn't work in GitLab Pipeline with Alpine Linux

Time:10-06

My scenario scheme with negative tests are failing, but when I run locally they pass. According to my BDD the system message for invalid access is Portuguese but I receive it in English. expected: "Login/Senha incorreto" got: "Access Denied: Invalid credentials."

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:

CodePudding user response:

You should try forcing the OS language with:

export LANG=C

or

export LC_ALL=C

or en_US.UTF-8 or similar.

So in your use case:

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

or

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

I'm not able to understand which block ends with error by looking at the output you provided.

  • Related