ruby - BDD 在本地工作,但在带有 Alpine Linux 的 GitLab Pipeline 中不起作用
问题描述
我的带有负面测试的场景方案失败了,但是当我在本地运行时它们通过了。根据我的 BDD,无效访问的系统消息是葡萄牙语,但我收到的是英语。预期:“登录/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:
解决方案
您应该尝试使用以下命令强制操作系统语言:
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
通过查看您提供的输出,我无法理解哪个块以错误结尾。
推荐阅读
- ios - Xcode 10 迁移错误
- php - 我的 WordPress 插件执行时间过长
- elasticsearch - 匹配有效时,简单的术语查询不适用于弹性
- r - ggplot2:在绘图区域外绘制 geom_segment()
- powershell - 为什么powershell会容忍`cd`和`..`之间没有空格?
- networking - DHCP 请求消息是广播还是单播?
- powershell - 我可以绕过 Powershell 中的权限吗?
- sql - VBA SQL Sum-group by 语句最多只占用两位十进制值
- android - 使用 Retrofit 上传大文件
- python-3.x - 在python中计算条件概率