From adcd2e376635cad43c3518ac3ebabde4b6c2b854 Mon Sep 17 00:00:00 2001 From: litesun Date: Wed, 3 Aug 2022 18:03:55 +0800 Subject: [PATCH] test: reduce fe ci time (#2557) --- .github/workflows/frontend-e2e-test.yml | 13 ++- .../workflows/frontend-plugin-e2e-test.yml | 96 ------------------- .../dashboard-smoketest.spec.js | 0 .../lang-switch-language.spec.js} | 0 ...reate-edit-delete-plugin-template.spec.js} | 0 ...create-plugin-template-with-route.spec.js} | 0 ...-create_and_edit_and_delete_proto.spec.js} | 0 ...roto-table-auto-jump-when-no-data.spec.js} | 0 .../rawDataEditor-test-rawDataEditor.spec.js} | 0 ...ervice-create-edit-delete-service.spec.js} | 0 ...reate-service-with-chash-upstream.spec.js} | 0 ...-service-with-not-select-upstream.spec.js} | 0 ...e-with-service-discovery-upstream.spec.js} | 0 ...ervice-edit-service-with-upstream.spec.js} | 0 .../service-save-paginator-status.spec.js} | 2 +- ...vice-table-auto-jump-when-no-data.spec.js} | 0 .../settings-smoketest.spec.js | 0 .../{ssl => rest}/ssl-smoketest.spec.js | 0 ...stream-create_and_delete_upstream.spec.js} | 0 ...it_upstream_with_custom_chash_key.spec.js} | 0 ...e_and_edit_upstream_with_no_nodes.spec.js} | 0 ...ream-table-auto-jump-when-no-data.spec.js} | 0 .../login.spec.js => rest/user-login.spec.js} | 0 .../user-logout.spec.js} | 0 24 files changed, 10 insertions(+), 101 deletions(-) delete mode 100644 .github/workflows/frontend-plugin-e2e-test.yml rename web/cypress/integration/{dashboard => rest}/dashboard-smoketest.spec.js (100%) rename web/cypress/integration/{lang/switch-language.spec.js => rest/lang-switch-language.spec.js} (100%) rename web/cypress/integration/{pluginTemplate/create-edit-delete-plugin-template.spec.js => rest/pluginTemplate-create-edit-delete-plugin-template.spec.js} (100%) rename web/cypress/integration/{pluginTemplate/create-plugin-template-with-route.spec.js => rest/pluginTemplate-create-plugin-template-with-route.spec.js} (100%) rename web/cypress/integration/{proto/create_and_edit_and_delete_proto.spec.js => rest/proto-create_and_edit_and_delete_proto.spec.js} (100%) rename web/cypress/integration/{proto/table-auto-jump-when-no-data.spec.js => rest/proto-table-auto-jump-when-no-data.spec.js} (100%) rename web/cypress/integration/{rawDataEditor/test-rawDataEditor.spec.js => rest/rawDataEditor-test-rawDataEditor.spec.js} (100%) rename web/cypress/integration/{service/create-edit-delete-service.spec.js => rest/service-create-edit-delete-service.spec.js} (100%) rename web/cypress/integration/{service/create-service-with-chash-upstream.spec.js => rest/service-create-service-with-chash-upstream.spec.js} (100%) rename web/cypress/integration/{service/create-service-with-not-select-upstream.spec.js => rest/service-create-service-with-not-select-upstream.spec.js} (100%) rename web/cypress/integration/{service/create-service-with-service-discovery-upstream.spec.js => rest/service-create-service-with-service-discovery-upstream.spec.js} (100%) rename web/cypress/integration/{service/edit-service-with-upstream.spec.js => rest/service-edit-service-with-upstream.spec.js} (100%) rename web/cypress/integration/{service/save-paginator-status.spec.js => rest/service-save-paginator-status.spec.js} (98%) rename web/cypress/integration/{service/table-auto-jump-when-no-data.spec.js => rest/service-table-auto-jump-when-no-data.spec.js} (100%) rename web/cypress/integration/{settings => rest}/settings-smoketest.spec.js (100%) rename web/cypress/integration/{ssl => rest}/ssl-smoketest.spec.js (100%) rename web/cypress/integration/{upstream/create_and_delete_upstream.spec.js => rest/upstream-create_and_delete_upstream.spec.js} (100%) rename web/cypress/integration/{upstream/create_and_edit_upstream_with_custom_chash_key.spec.js => rest/upstream-create_and_edit_upstream_with_custom_chash_key.spec.js} (100%) rename web/cypress/integration/{upstream/create_and_edit_upstream_with_no_nodes.spec.js => rest/upstream-create_and_edit_upstream_with_no_nodes.spec.js} (100%) rename web/cypress/integration/{upstream/table-auto-jump-when-no-data.spec.js => rest/upstream-table-auto-jump-when-no-data.spec.js} (100%) rename web/cypress/integration/{user/login.spec.js => rest/user-login.spec.js} (100%) rename web/cypress/integration/{user/logout.spec.js => rest/user-logout.spec.js} (100%) diff --git a/.github/workflows/frontend-e2e-test.yml b/.github/workflows/frontend-e2e-test.yml index 67705212ea..b6adba0b71 100644 --- a/.github/workflows/frontend-e2e-test.yml +++ b/.github/workflows/frontend-e2e-test.yml @@ -25,6 +25,10 @@ defaults: jobs: web-e2e: name: Frontend e2e test + strategy: + fail-fast: false + matrix: + folderPrefix: ['consumer', 'route', 'plugin', 'rest'] runs-on: ubuntu-latest services: etcd: @@ -63,8 +67,10 @@ jobs: ${{ runner.os }}-go- - name: Start manager-api - working-directory: ./api + working-directory: ./ run: | + make dag-lib + cd api sed -i 's@# - dubbo-proxy@- dubbo-proxy@' ./conf/conf.yaml nohup go run ./main.go & @@ -82,8 +88,7 @@ jobs: - name: Start frontend then test run: | - rm -rf cypress/integration/plugin - yarn test:e2e + yarn start-server-and-test 'cross-env SERVE_ENV=test yarn start' http-get://localhost:8000 'cross-env CYPRESS_SERVE_ENV=test yarn cypress run --spec "**/integration/${{matrix.folderPrefix}}/**.spec.js"' - name: Report e2e coverage run: npx nyc report --reporter=text-summary @@ -96,7 +101,7 @@ jobs: uses: actions/upload-artifact@v3 if: always() with: - name: cypress-report + name: cypress-report-${{matrix.folderPrefix}} path: | web/cypress/videos web/cypress/screenshots diff --git a/.github/workflows/frontend-plugin-e2e-test.yml b/.github/workflows/frontend-plugin-e2e-test.yml deleted file mode 100644 index 485410d3af..0000000000 --- a/.github/workflows/frontend-plugin-e2e-test.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Frontend e2e test for plugin -on: - push: - branches: - - master - paths-ignore: - - 'docs/**' - pull_request: - branches: - - master - paths-ignore: - - 'docs/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} - cancel-in-progress: true - -env: - CYPRESS_CACHE_FOLDER: cypress/cache -defaults: - run: - working-directory: web - -jobs: - web-e2e: - name: Frontend e2e test - runs-on: ubuntu-latest - services: - etcd: - image: bitnami/etcd:3.5.2 - ports: - - 2379:2379 - - 2380:2380 - env: - ALLOW_NONE_AUTHENTICATION: yes - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Setup Node.js environment - uses: actions/setup-node@v3 - with: - node-version: 16.x - cache: 'yarn' - cache-dependency-path: web/yarn.lock - - - name: Setup golang environment - uses: actions/setup-go@v3 - with: - go-version: '1.18' - - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Download dag-to-lua - working-directory: ./ - run: make dag-lib - - - name: Start manager-api - working-directory: ./api - run: | - sed -i 's@# - dubbo-proxy@- dubbo-proxy@' ./conf/conf.yaml - nohup go run ./main.go & - - - name: Cache Cypress binary - uses: actions/cache@v3 - id: cypress-binary-cache - with: - path: '*/cypress/cache' - key: cypress-${{ runner.os }}-cypress-cache0-${{ hashFiles('**/package.json') }} - restore-keys: | - cypress-${{ runner.os }}-cypress-cache0 - - - name: Install dependencies - run: yarn - - - name: Start frontend then test - run: yarn test-plugin:e2e - - - name: Archive code coverage results - uses: actions/upload-artifact@v3 - if: always() - with: - name: cypress-report - path: | - web/cypress/videos - web/cypress/screenshots - retention-days: 5 diff --git a/web/cypress/integration/dashboard/dashboard-smoketest.spec.js b/web/cypress/integration/rest/dashboard-smoketest.spec.js similarity index 100% rename from web/cypress/integration/dashboard/dashboard-smoketest.spec.js rename to web/cypress/integration/rest/dashboard-smoketest.spec.js diff --git a/web/cypress/integration/lang/switch-language.spec.js b/web/cypress/integration/rest/lang-switch-language.spec.js similarity index 100% rename from web/cypress/integration/lang/switch-language.spec.js rename to web/cypress/integration/rest/lang-switch-language.spec.js diff --git a/web/cypress/integration/pluginTemplate/create-edit-delete-plugin-template.spec.js b/web/cypress/integration/rest/pluginTemplate-create-edit-delete-plugin-template.spec.js similarity index 100% rename from web/cypress/integration/pluginTemplate/create-edit-delete-plugin-template.spec.js rename to web/cypress/integration/rest/pluginTemplate-create-edit-delete-plugin-template.spec.js diff --git a/web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js b/web/cypress/integration/rest/pluginTemplate-create-plugin-template-with-route.spec.js similarity index 100% rename from web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js rename to web/cypress/integration/rest/pluginTemplate-create-plugin-template-with-route.spec.js diff --git a/web/cypress/integration/proto/create_and_edit_and_delete_proto.spec.js b/web/cypress/integration/rest/proto-create_and_edit_and_delete_proto.spec.js similarity index 100% rename from web/cypress/integration/proto/create_and_edit_and_delete_proto.spec.js rename to web/cypress/integration/rest/proto-create_and_edit_and_delete_proto.spec.js diff --git a/web/cypress/integration/proto/table-auto-jump-when-no-data.spec.js b/web/cypress/integration/rest/proto-table-auto-jump-when-no-data.spec.js similarity index 100% rename from web/cypress/integration/proto/table-auto-jump-when-no-data.spec.js rename to web/cypress/integration/rest/proto-table-auto-jump-when-no-data.spec.js diff --git a/web/cypress/integration/rawDataEditor/test-rawDataEditor.spec.js b/web/cypress/integration/rest/rawDataEditor-test-rawDataEditor.spec.js similarity index 100% rename from web/cypress/integration/rawDataEditor/test-rawDataEditor.spec.js rename to web/cypress/integration/rest/rawDataEditor-test-rawDataEditor.spec.js diff --git a/web/cypress/integration/service/create-edit-delete-service.spec.js b/web/cypress/integration/rest/service-create-edit-delete-service.spec.js similarity index 100% rename from web/cypress/integration/service/create-edit-delete-service.spec.js rename to web/cypress/integration/rest/service-create-edit-delete-service.spec.js diff --git a/web/cypress/integration/service/create-service-with-chash-upstream.spec.js b/web/cypress/integration/rest/service-create-service-with-chash-upstream.spec.js similarity index 100% rename from web/cypress/integration/service/create-service-with-chash-upstream.spec.js rename to web/cypress/integration/rest/service-create-service-with-chash-upstream.spec.js diff --git a/web/cypress/integration/service/create-service-with-not-select-upstream.spec.js b/web/cypress/integration/rest/service-create-service-with-not-select-upstream.spec.js similarity index 100% rename from web/cypress/integration/service/create-service-with-not-select-upstream.spec.js rename to web/cypress/integration/rest/service-create-service-with-not-select-upstream.spec.js diff --git a/web/cypress/integration/service/create-service-with-service-discovery-upstream.spec.js b/web/cypress/integration/rest/service-create-service-with-service-discovery-upstream.spec.js similarity index 100% rename from web/cypress/integration/service/create-service-with-service-discovery-upstream.spec.js rename to web/cypress/integration/rest/service-create-service-with-service-discovery-upstream.spec.js diff --git a/web/cypress/integration/service/edit-service-with-upstream.spec.js b/web/cypress/integration/rest/service-edit-service-with-upstream.spec.js similarity index 100% rename from web/cypress/integration/service/edit-service-with-upstream.spec.js rename to web/cypress/integration/rest/service-edit-service-with-upstream.spec.js diff --git a/web/cypress/integration/service/save-paginator-status.spec.js b/web/cypress/integration/rest/service-save-paginator-status.spec.js similarity index 98% rename from web/cypress/integration/service/save-paginator-status.spec.js rename to web/cypress/integration/rest/service-save-paginator-status.spec.js index fc61eaeef2..5f6ab2eaff 100644 --- a/web/cypress/integration/service/save-paginator-status.spec.js +++ b/web/cypress/integration/rest/service-save-paginator-status.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ /* eslint-disable no-undef */ -import defaultSettings from '../../../config/defaultSettings'; +import defaultSettings from '../../../../../config/defaultSettings'; context('Save Paginator Status', () => { const timeout = 300; diff --git a/web/cypress/integration/service/table-auto-jump-when-no-data.spec.js b/web/cypress/integration/rest/service-table-auto-jump-when-no-data.spec.js similarity index 100% rename from web/cypress/integration/service/table-auto-jump-when-no-data.spec.js rename to web/cypress/integration/rest/service-table-auto-jump-when-no-data.spec.js diff --git a/web/cypress/integration/settings/settings-smoketest.spec.js b/web/cypress/integration/rest/settings-smoketest.spec.js similarity index 100% rename from web/cypress/integration/settings/settings-smoketest.spec.js rename to web/cypress/integration/rest/settings-smoketest.spec.js diff --git a/web/cypress/integration/ssl/ssl-smoketest.spec.js b/web/cypress/integration/rest/ssl-smoketest.spec.js similarity index 100% rename from web/cypress/integration/ssl/ssl-smoketest.spec.js rename to web/cypress/integration/rest/ssl-smoketest.spec.js diff --git a/web/cypress/integration/upstream/create_and_delete_upstream.spec.js b/web/cypress/integration/rest/upstream-create_and_delete_upstream.spec.js similarity index 100% rename from web/cypress/integration/upstream/create_and_delete_upstream.spec.js rename to web/cypress/integration/rest/upstream-create_and_delete_upstream.spec.js diff --git a/web/cypress/integration/upstream/create_and_edit_upstream_with_custom_chash_key.spec.js b/web/cypress/integration/rest/upstream-create_and_edit_upstream_with_custom_chash_key.spec.js similarity index 100% rename from web/cypress/integration/upstream/create_and_edit_upstream_with_custom_chash_key.spec.js rename to web/cypress/integration/rest/upstream-create_and_edit_upstream_with_custom_chash_key.spec.js diff --git a/web/cypress/integration/upstream/create_and_edit_upstream_with_no_nodes.spec.js b/web/cypress/integration/rest/upstream-create_and_edit_upstream_with_no_nodes.spec.js similarity index 100% rename from web/cypress/integration/upstream/create_and_edit_upstream_with_no_nodes.spec.js rename to web/cypress/integration/rest/upstream-create_and_edit_upstream_with_no_nodes.spec.js diff --git a/web/cypress/integration/upstream/table-auto-jump-when-no-data.spec.js b/web/cypress/integration/rest/upstream-table-auto-jump-when-no-data.spec.js similarity index 100% rename from web/cypress/integration/upstream/table-auto-jump-when-no-data.spec.js rename to web/cypress/integration/rest/upstream-table-auto-jump-when-no-data.spec.js diff --git a/web/cypress/integration/user/login.spec.js b/web/cypress/integration/rest/user-login.spec.js similarity index 100% rename from web/cypress/integration/user/login.spec.js rename to web/cypress/integration/rest/user-login.spec.js diff --git a/web/cypress/integration/user/logout.spec.js b/web/cypress/integration/rest/user-logout.spec.js similarity index 100% rename from web/cypress/integration/user/logout.spec.js rename to web/cypress/integration/rest/user-logout.spec.js