From 4f37d5607a2e6d0a73e1fecaf005ac983fcb6f1a Mon Sep 17 00:00:00 2001
From: Kamil Mielnik <kamil@kamilmielnik.com>
Date: Mon, 27 May 2024 18:11:20 +0700
Subject: [PATCH] Enable running tagged tests defined in TS (#43172)

* Update & tag a test

* Run tests also on TS files

* Update mongo test
---
 .github/workflows/e2e-tests.yml               |  8 +++----
 .../question/notebook-data-source.cy.spec.ts  | 21 +++++++------------
 ...notebook-native-preview-sidebar.cy.spec.ts |  5 +++--
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml
index dd25ed9d5f1..58688e53d0a 100644
--- a/.github/workflows/e2e-tests.yml
+++ b/.github/workflows/e2e-tests.yml
@@ -144,7 +144,7 @@ jobs:
         run: |
           yarn run test-cypress-run \
           --env grepTags=@OSS,grepOmitFiltered=true \
-          --spec './e2e/test/scenarios/**/*.cy.spec.js' \
+          --spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
           --browser 'replay-chromium'
 
       - name: Run slow and resource-intensive Cypress tests
@@ -152,7 +152,7 @@ jobs:
         run: |
           yarn run test-cypress-run \
           --env grepTags="@slow",grepOmitFiltered=true \
-          --spec './e2e/test/scenarios/**/*.cy.spec.js' \
+          --spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
           --browser 'replay-chromium'
 
       - name: Run Flaky Cypress tests
@@ -160,7 +160,7 @@ jobs:
         run: |
           yarn run test-cypress-run \
           --env grepTags="@flaky --@quarantine",grepOmitFiltered=true \
-          --spec './e2e/test/scenarios/**/*.cy.spec.js' \
+          --spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
           --browser 'replay-chromium'
 
       - name: Run EE Cypress tests on ${{ matrix.name }}
@@ -176,7 +176,7 @@ jobs:
         run: |
           yarn run test-cypress-run \
           --env grepTags="@mongo --@quarantine",grepOmitFiltered=true \
-          --spec './e2e/test/scenarios/**/*.cy.spec.js' \
+          --spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
           --browser 'replay-chromium'
         env:
           CYPRESS_QA_DB_MONGO: true
diff --git a/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts b/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts
index 320730dff97..0c35c2e044d 100644
--- a/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts
+++ b/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts
@@ -418,7 +418,7 @@ describe("scenarios > notebook > data source", () => {
   });
 });
 
-describeOSS("scenarios > notebook > data source", () => {
+describeOSS("scenarios > notebook > data source", { tags: "@OSS" }, () => {
   beforeEach(() => {
     restore("setup");
     cy.signInAsAdmin();
@@ -433,19 +433,12 @@ describeOSS("scenarios > notebook > data source", () => {
     });
 
     startNewQuestion();
-    popover().within(() => {
-      cy.findByPlaceholderText("Search for some data…");
-      cy.findAllByTestId("data-bucket-list-item")
-        .as("sources")
-        .should("have.length", 2);
-      cy.get("@sources")
-        .first()
-        .should("contain", "Models")
-        .and("have.attr", "aria-selected", "false");
-      cy.get("@sources")
-        .last()
-        .should("contain", "Raw Data")
-        .and("have.attr", "aria-selected", "false");
+    entityPickerModal().within(() => {
+      cy.findAllByRole("tab").should("have.length", 2);
+      entityPickerModalTab("Recents").should("not.exist");
+      entityPickerModalTab("Models").and("have.attr", "aria-selected", "true");
+      entityPickerModalTab("Tables").should("exist");
+      entityPickerModalTab("Saved questions").should("not.exist");
     });
   });
 });
diff --git a/e2e/test/scenarios/question/notebook-native-preview-sidebar.cy.spec.ts b/e2e/test/scenarios/question/notebook-native-preview-sidebar.cy.spec.ts
index 0e186b8b416..4e91ddeb453 100644
--- a/e2e/test/scenarios/question/notebook-native-preview-sidebar.cy.spec.ts
+++ b/e2e/test/scenarios/question/notebook-native-preview-sidebar.cy.spec.ts
@@ -26,6 +26,7 @@ import {
   expectGoodSnowplowEvents,
   expectNoBadSnowplowEvents,
   entityPickerModal,
+  entityPickerModalTab,
 } from "e2e/support/helpers";
 
 const { ORDERS, ORDERS_ID } = SAMPLE_DATABASE;
@@ -281,8 +282,8 @@ describe(
 
     it("should work for both simple and nested questions based on previously converted GUI query", () => {
       startNewQuestion();
-      popover().within(() => {
-        cy.findByText("Raw Data").click();
+      entityPickerModal().within(() => {
+        entityPickerModalTab("Tables").click();
         cy.findByText(MONGO_DB_NAME).click();
         cy.findByText("Products").click();
       });
-- 
GitLab