我想为组件库添加 CI 工作流程,对每个推送事件运行测试。 这是工作流程文件:
name: "UI Tests"
on: push
jobs:
interaction-and-accessibility:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18.16.0"
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Install Playwright
run: npx playwright install
- name: Build Storybook
run: npm run build-storybook --quiet
- name: Serve Storybook and run tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && npm run test-storybook"
问题
整个工作流程完美运行,但每当到达“提供 Storybook 并运行测试”部分时,就会花费很长时间,直到由于超时错误而取消操作。
我尝试使用 act 在本地运行它或使用 gitHub Actions 远程运行它,但同样的错误仍然存在。
有人遇到过同样的问题或知道如何解决这个问题吗?
谢谢!
请尝试此处的解决方案:https://github.com/storybookjs/test-runner/issues/301
这可以通过将 npx wait-on 命令更新为 npx wait-on tcp:127.0.0.1:6006 (或 http 服务器的任何正确地址)来解决