【发布时间】:2021-06-01 18:41:43
【问题描述】:
我想做什么?
我想为我的 Nuxt 项目在 CircleCI 上运行 Cypress 测试
我有什么问题?
在本地模式下它工作正常,但我无法让它在 CircleCI 中工作
我已经尝试过 CircleCI orb cypress-io / cypress @ 1.28.0,但只是使用 wait-on 测试在 npm run dev 完成之前开始。
- cypress / running:
requires:
- ramp up
start: npm start
wait: 'http: // localhost: 8181'
cache-key:> -
v1-dependencies - {{checksum "package.json"}}
filters:
Marking:
only: /.*/
branches:
only: /.*/
CircleCI 也没有启动应用程序,我不知道为什么:(
我认为发生了什么?
我尝试了这个命令 bash curl -o /dev /null -u localhost:8181 /login -Isw '%{http_code}\n'localhost:8181 /login,即使 Nuxt 正在编译它们也会返回代码 200,所以我认为 Nuxt 成为可用的路由,即使它没有被编译。
帮助
有谁知道任何配置了 Cypress 和 CircleCI 的 Nuxt 项目供我查看?
这个打印意味着访问成功执行并且断言失败?
import { Response } from 'miragejs'
context('Login', () => {
it('should login after button click', () => {
cy.login({
username: 'titular@ampa.ro',
password: 'password',
})
cy.url()
.should('eq', 'http://localhost:8181/')
})
it('should return invalid credentials', () => {
cy.mirage((server) => {
server.post('session', () => new Response(400, {}, {
errorCode: 'credential_invalid',
type: 'badRequestError',
errorMessage: 'Credential invalid',
errors: {},
}))
})
cy.login({
username: 'titular@ampa.ro',
password: 'password',
})
cy.get('body').should('include.text', 'Credenciais inválidas')
})
})
【问题讨论】:
标签: testing configuration nuxt.js cypress circleci