【发布时间】:2021-11-15 09:06:44
【问题描述】:
我已经成功地创建了一个脚本来使用与 Github Actions 集成的 Cypress 来测试 Vercel 测试部署。尽管测试有效并且达到了预期的结果,但有一个稍微令人讨厌的问题——赛普拉斯测试在 Vercel 部署尝试之前运行(并被跳过)。我在 GA 工作流 yml 中使用条件,以便赛普拉斯测试在成功测试部署后运行,因此它最终在部署后运行。我希望能够在赛普拉斯测试中省略第一次跳过的尝试。我曾尝试合并其他 Github Actions 来解决此问题,但如果部署未完成,它们会完全阻止测试运行。我也尝试过使用 repo 的设置,但无济于事。以下是我的 GA yml:
name: Cypress Testing
on: [deployment_status]
jobs:
e2e:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_AUTH_TOKEN}}" > .npmrc
- name: Setup npm package
run: npm init -y && npm install
- name: Setup node 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Run Cypress
uses: cypress-io/github-action@v2
env:
CYPRESS_BASE_URL: ${{ github.event.deployment_status.target_url }}
我们的 Vercel 项目与 Git 集成,因此每次推送都会自动部署。有没有人遇到过这个问题,赛普拉斯在部署 Vercel 之前尝试先运行?
【问题讨论】:
标签: cypress github-actions vercel