From 16b01629c79731e57dff5549882c59e429a1b932 Mon Sep 17 00:00:00 2001
From: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Date: Wed, 23 Jun 2021 20:59:36 +0200
Subject: [PATCH] Move smoke tests to the CircleCi (#16742)

* Move smoke tests to the CircleCi

Closes #16741.

* Remove smoketest script
---
 .circleci/config.yml                          | 10 +++++
 .github/workflows/uberjar.yml                 | 41 -------------------
 frontend/test/__runner__/run_cypress_tests.js |  4 +-
 .../scenarios/smoketest}/README.md            |  6 +--
 .../scenarios/smoketest}/admin.cy.spec.js     |  0
 .../smoketest}/admin_setup.cy.spec.js         |  0
 .../scenarios/smoketest}/user.cy.spec.js      |  0
 package.json                                  |  3 +-
 8 files changed, 16 insertions(+), 48 deletions(-)
 rename frontend/test/{metabase-smoketest => metabase/scenarios/smoketest}/README.md (74%)
 rename frontend/test/{metabase-smoketest => metabase/scenarios/smoketest}/admin.cy.spec.js (100%)
 rename frontend/test/{metabase-smoketest => metabase/scenarios/smoketest}/admin_setup.cy.spec.js (100%)
 rename frontend/test/{metabase-smoketest => metabase/scenarios/smoketest}/user.cy.spec.js (100%)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index e63c70bd8cf..813d5cc9eb5 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1169,6 +1169,16 @@ workflows:
           requires:
             - fe-deps
 
+      - fe-tests-cypress:
+          matrix:
+            parameters:
+              edition: ["ee", "oss"]
+          name: e2e-tests-smoketest-<< matrix.edition >>
+          requires:
+            - build-uberjar-<< matrix.edition >>
+          cypress-group: "smoketest-<< matrix.edition >>"
+          source-folder: frontend/test/metabase/scenarios/smoketest
+
       - fe-tests-cypress:
           matrix:
             parameters:
diff --git a/.github/workflows/uberjar.yml b/.github/workflows/uberjar.yml
index d8f0b3763ce..eaa5a4dc486 100644
--- a/.github/workflows/uberjar.yml
+++ b/.github/workflows/uberjar.yml
@@ -103,44 +103,3 @@ jobs:
 
     - name: Check API health
       run: curl -s localhost:3000/api/health
-
-  smoke:
-    runs-on: ubuntu-20.04
-    timeout-minutes: 30
-    needs: build
-    steps:
-    - uses: actions/checkout@v2
-    - name: Prepare Node.js
-      uses: actions/setup-node@v1
-      with:
-        node-version: 14.x
-    - name: Prepare JDK 8
-      uses: actions/setup-java@v1
-      with:
-        java-version: 8
-    - name: Install Clojure CLI
-      run: |
-        curl -O https://download.clojure.org/install/linux-install-1.10.1.708.sh &&
-        sudo bash ./linux-install-1.10.1.708.sh
-    - name: Check versions
-      run: |
-        echo "Node.js `node --version`"
-        echo "yarn `yarn --version`"
-        java -version
-        echo "Clojure `clojure -e "(println (clojure-version))"`"
-    - name: Get yarn cache
-      uses: actions/cache@v2
-      with:
-        path: ~/.cache/yarn
-        key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
-
-    - run: ./bin/build version
-
-    - uses: actions/download-artifact@v2
-      name: Retrieve uberjar artifact
-      with:
-        name: metabase-oss-uberjar
-    - run: yarn run test-cypress-smoketest
-      name: Run Cypress smoketest
-      env:
-        TERM: xterm
\ No newline at end of file
diff --git a/frontend/test/__runner__/run_cypress_tests.js b/frontend/test/__runner__/run_cypress_tests.js
index 5713d768b20..b7412711e58 100644
--- a/frontend/test/__runner__/run_cypress_tests.js
+++ b/frontend/test/__runner__/run_cypress_tests.js
@@ -75,10 +75,10 @@ const init = async () => {
   };
   const specsConfig = isSpecFlag && { testFiles };
   const ignoreConfig =
-    // if we're not running specific tests, avoid including db and smoketests
+    // if we're not running specific tests, avoid including db tests
     folderConfig || specsConfig
       ? null
-      : { ignoreTestFiles: "**/metabase-{smoketest,db}/**" };
+      : { ignoreTestFiles: "**/metabase-db/**" };
 
   const config = {
     ...baseConfig,
diff --git a/frontend/test/metabase-smoketest/README.md b/frontend/test/metabase/scenarios/smoketest/README.md
similarity index 74%
rename from frontend/test/metabase-smoketest/README.md
rename to frontend/test/metabase/scenarios/smoketest/README.md
index 6eddab15c1e..34bee510df0 100644
--- a/frontend/test/metabase-smoketest/README.md
+++ b/frontend/test/metabase/scenarios/smoketest/README.md
@@ -1,6 +1,6 @@
 # Metabase Smoketests
 
-These files exist to ensure that we can always do the things we expect with Metabase. :) 
+These files exist to ensure that we can always do the things we expect with Metabase. :)
 
 ## Running
 
@@ -11,7 +11,7 @@ From the root of the repository:
 - If you already have built Metabase with `./bin/build`, just run this to run all the tests.
 
 ```shell
-yarn run test-cypress-no-build --folder frontend/test/metabase-smoketest
+yarn run test-cypress-no-build --folder frontend/test/metabase/scenarios/smoketest
 ```
 
-- Active development, add `--open`
\ No newline at end of file
+- Active development, add `--open`
diff --git a/frontend/test/metabase-smoketest/admin.cy.spec.js b/frontend/test/metabase/scenarios/smoketest/admin.cy.spec.js
similarity index 100%
rename from frontend/test/metabase-smoketest/admin.cy.spec.js
rename to frontend/test/metabase/scenarios/smoketest/admin.cy.spec.js
diff --git a/frontend/test/metabase-smoketest/admin_setup.cy.spec.js b/frontend/test/metabase/scenarios/smoketest/admin_setup.cy.spec.js
similarity index 100%
rename from frontend/test/metabase-smoketest/admin_setup.cy.spec.js
rename to frontend/test/metabase/scenarios/smoketest/admin_setup.cy.spec.js
diff --git a/frontend/test/metabase-smoketest/user.cy.spec.js b/frontend/test/metabase/scenarios/smoketest/user.cy.spec.js
similarity index 100%
rename from frontend/test/metabase-smoketest/user.cy.spec.js
rename to frontend/test/metabase/scenarios/smoketest/user.cy.spec.js
diff --git a/package.json b/package.json
index 08ff1a15956..a555df49386 100644
--- a/package.json
+++ b/package.json
@@ -198,11 +198,10 @@
     "ci": "yarn ci-frontend && yarn ci-backend",
     "ci-frontend": "yarn lint && yarn test",
     "ci-backend": "lein docstring-checker && lein bikeshed && lein eastwood && lein test",
-    "test-cypress": "yarn build && ./bin/build-for-test && yarn test-cypress-no-build && yarn test-cypress-smoketest",
+    "test-cypress": "yarn build && ./bin/build-for-test && yarn test-cypress-no-build",
     "test-cypress-open": "./bin/build-for-test && yarn test-cypress-no-build --open",
     "test-cypress-open-no-backend": "E2E_HOST='http://localhost:3000' yarn test-cypress-no-build --open",
     "test-cypress-no-build": "yarn && CONFIG_FILE=frontend/test/__support__/e2e/cypress.json babel-node ./frontend/test/__runner__/run_cypress_tests.js",
-    "test-cypress-smoketest": "yarn test-cypress-no-build --folder frontend/test/metabase-smoketest",
     "prepare": "husky install"
   },
   "lint-staged": {
-- 
GitLab