如何通过 github 操作和本地使 cypress 与 aurelia 一起工作?

xen*_*ide 6 continuous-integration github aurelia cypress github-actions

好的,所以我在配置过程中将 cypress 添加到 aurelia 并且它运行良好。当我在 github 上设置 cypress 作为一个命令时,我无法让它将 puppeteer 识别为浏览器。因此,我改为使用 cypress 的官方 github 操作,并且有效

      - name: test
        uses: cypress-io/github-action@v1
        with:
          start: yarn start
          browser: ${{matrix.browser}}
          record: true
        env:
          # pass the Dashboard record key as an environment variable
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Run Code Online (Sandbox Code Playgroud)

但是我必须将我的设置cypress.json如下

{
  "baseUrl": "http://localhost:8080",
  "fixturesFolder": "test/e2e/fixtures",
  "integrationFolder": "test/e2e/integration",
  "pluginsFile": "test/e2e/plugins/index.js",
  "screenshotsFolder": "test/e2e/screenshots",
  "supportFile": "test/e2e/support/index.js",
  "videosFolder": "test/e2e/videos",
  "projectId": "..."
}
Run Code Online (Sandbox Code Playgroud)

现在运行yarn e2e不起作用,因为没有服务器站起来,因为它不再通过cypress.config.js

      - name: test
        uses: cypress-io/github-action@v1
        with:
          start: yarn start
          browser: ${{matrix.browser}}
          record: true
        env:
          # pass the Dashboard record key as an environment variable
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Run Code Online (Sandbox Code Playgroud)

我怎样才能让它yarn e2e像以前一样工作,并让它在 github 上工作?(我不在乎等式的哪一边被改变)

这里yarn e2e不确定非盟在幕后做什么。

    "e2e": "au cypress",
Run Code Online (Sandbox Code Playgroud)

xen*_*ide 4

实现这一目标的最简单方法是创建一个test/e2e/cypress-config.json

{
  "baseUrl": "http://localhost:8080",
  "fixturesFolder": "test/e2e/fixtures",
  "integrationFolder": "test/e2e/integration",
  "pluginsFile": "test/e2e/plugins/index.js",
  "screenshotsFolder": "test/e2e/screenshots",
  "supportFile": "test/e2e/support/index.js",
  "videosFolder": "test/e2e/videos",
  "projectId": "1234"
}
Run Code Online (Sandbox Code Playgroud)

,然后像这样设置 github 操作。

      - name: test
        uses: cypress-io/github-action@v1
        with:
          config-file: tests/e2e/cypress-config.json
          start: yarn start
          browser: ${{matrix.browser}}
          record: true
        env:
          # pass the Dashboard record key as an environment variable
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Run Code Online (Sandbox Code Playgroud)

路径并不重要,只要配置相同即可。只要确保它不与 aurelia 想要的重叠即可。