diff --git a/datahub-web-react/src/app/entity/view/builder/ViewBuilderForm.tsx b/datahub-web-react/src/app/entity/view/builder/ViewBuilderForm.tsx
index 7192ad68434b0c..2d24f9efd1f176 100644
--- a/datahub-web-react/src/app/entity/view/builder/ViewBuilderForm.tsx
+++ b/datahub-web-react/src/app/entity/view/builder/ViewBuilderForm.tsx
@@ -70,6 +70,7 @@ export const ViewBuilderForm = ({ urn, mode, state, updateState }: Props) => {
hasFeedback
>
setName(event.target.value)}
disabled={mode === ViewBuilderMode.PREVIEW}
@@ -80,6 +81,7 @@ export const ViewBuilderForm = ({ urn, mode, state, updateState }: Props) => {
Write a description for your View.
setDescription(event.target.value)}
disabled={mode === ViewBuilderMode.PREVIEW}
diff --git a/smoke-test/tests/cypress/cypress.json b/smoke-test/tests/cypress/cypress.json
index 9564b0077bd277..2460418b79b928 100644
--- a/smoke-test/tests/cypress/cypress.json
+++ b/smoke-test/tests/cypress/cypress.json
@@ -6,7 +6,7 @@
"projectId": "hkrxk5",
"defaultCommandTimeout": 10000,
"retries": {
- "runMode": 2,
+ "runMode": 1,
"openMode": 0
}
}
diff --git a/smoke-test/tests/cypress/cypress/integration/glossary/glossaryTerm.js b/smoke-test/tests/cypress/cypress/integration/glossary/glossaryTerm.js
index ff8bfc456d2c80..0f24eea84ab47d 100644
--- a/smoke-test/tests/cypress/cypress/integration/glossary/glossaryTerm.js
+++ b/smoke-test/tests/cypress/cypress/integration/glossary/glossaryTerm.js
@@ -50,14 +50,8 @@ describe("glossaryTerm", () => {
cy.contains("Add Filter").click();
cy.contains(/^Tag$/).click({ force: true });
- cy.get('[data-testid="tag-term-modal-input"]').type("Cypress2");
- cy.wait(2000);
- cy.get('[data-testid="tag-term-option"]').click({ force: true });
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
- force: true,
- });
+ cy.selectOptionInTagTermModal("Cypress2");
- cy.wait(2000);
cy.contains("SampleCypressHdfsDataset");
// Only 1 result.
cy.contains("of 1");
@@ -72,13 +66,9 @@ describe("glossaryTerm", () => {
cy.contains("Advanced").click();
cy.contains("Add Filter").click();
cy.contains(/^Tag$/).click({ force: true });
- cy.get('[data-testid="tag-term-modal-input"]').type("Cypress2");
- cy.wait(2000);
- cy.get('[data-testid="tag-term-option"]').click({ force: true });
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
- force: true,
- });
- cy.wait(2000);
+
+ cy.selectOptionInTagTermModal("Cypress2")
+
cy.contains("Add Filter").click();
cy.get('[data-testid="adv-search-add-filter-description"]').click({
force: true,
@@ -105,13 +95,8 @@ describe("glossaryTerm", () => {
cy.wait(2000);
cy.contains("Add Filter").click();
cy.contains(/^Tag$/).click({ force: true });
- cy.get('[data-testid="tag-term-modal-input"]').type("Cypress2");
- cy.wait(2000);
- cy.get('[data-testid="tag-term-option"]').click({ force: true });
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
- force: true,
- });
- cy.wait(2000);
+
+ cy.selectOptionInTagTermModal("Cypress2");
cy.contains("all filters").click();
cy.contains("any filter").click({ force: true });
diff --git a/smoke-test/tests/cypress/cypress/integration/mutations/mutations.js b/smoke-test/tests/cypress/cypress/integration/mutations/mutations.js
index 58d99741a287de..2e0d73939210a4 100644
--- a/smoke-test/tests/cypress/cypress/integration/mutations/mutations.js
+++ b/smoke-test/tests/cypress/cypress/integration/mutations/mutations.js
@@ -142,16 +142,7 @@ describe("mutations", () => {
cy.contains("Add Term").click({ force: true })
);
- cy.focused().type("CypressTerm");
-
- cy.get(".ant-select-item-option-content").within(() =>
- cy.contains("CypressTerm").click({ force: true })
- );
-
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
- force: true,
- });
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').should("not.exist");
+ cy.selectOptionInTagTermModal("CypressTerm");
cy.contains("CypressTerm");
diff --git a/smoke-test/tests/cypress/cypress/integration/search/search.js b/smoke-test/tests/cypress/cypress/integration/search/search.js
index 1c3222b74f0147..71d696f1eedccf 100644
--- a/smoke-test/tests/cypress/cypress/integration/search/search.js
+++ b/smoke-test/tests/cypress/cypress/integration/search/search.js
@@ -57,16 +57,7 @@ describe("search", () => {
cy.contains("Add Term").click();
- cy.focused().type("CypressTerm");
-
- cy.get(".ant-select-item-option-content").within(() =>
- cy.contains("CypressTerm").click({ force: true })
- );
-
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
- force: true,
- });
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').should("not.exist");
+ cy.selectOptionInTagTermModal("CypressTerm");
cy.contains("CypressTerm");
cy.visit("/search?query=cypress");
@@ -86,17 +77,7 @@ describe("search", () => {
cy.contains("Column Glossary Term").click({ force: true });
- cy.get('[data-testid="tag-term-modal-input"]').type("CypressColumnInfo");
-
- cy.wait(2000);
-
- cy.get('[data-testid="tag-term-option"]').click({ force: true });
-
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
- force: true,
- });
-
- cy.wait(2000);
+ cy.selectOptionInTagTermModal("CypressColumnInfo");
// has the term in editable metadata
cy.contains("SampleCypressHdfsDataset");
@@ -120,17 +101,7 @@ describe("search", () => {
cy.contains("Column Glossary Term").click({ force: true });
- cy.get('[data-testid="tag-term-modal-input"]').type("CypressColumnInfo");
-
- cy.wait(2000);
-
- cy.get('[data-testid="tag-term-option"]').click({ force: true });
-
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
- force: true,
- });
-
- cy.wait(2000);
+ cy.selectOptionInTagTermModal("CypressColumnInfo");
cy.contains("Add Filter").click();
@@ -159,17 +130,7 @@ describe("search", () => {
cy.contains("Column Glossary Term").click({ force: true });
- cy.get('[data-testid="tag-term-modal-input"]').type("CypressColumnInfo");
-
- cy.wait(2000);
-
- cy.get('[data-testid="tag-term-option"]').click({ force: true });
-
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
- force: true,
- });
-
- cy.wait(2000);
+ cy.selectOptionInTagTermModal("CypressColumnInfo");
cy.contains("Add Filter").click();
diff --git a/smoke-test/tests/cypress/cypress/integration/siblings/siblings.js b/smoke-test/tests/cypress/cypress/integration/siblings/siblings.js
index cb19284ef9cd08..97f960a6887c0f 100644
--- a/smoke-test/tests/cypress/cypress/integration/siblings/siblings.js
+++ b/smoke-test/tests/cypress/cypress/integration/siblings/siblings.js
@@ -66,13 +66,7 @@ describe('siblings', () => {
cy.contains('Add Term').click();
- cy.focused().type('CypressTerm');
-
- cy.get('.ant-select-item-option-content').within(() => cy.contains('CypressTerm').click({force: true}));
-
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({force: true});
-
- cy.wait(2000);
+ cy.selectOptionInTagTermModal('CypressTerm');
cy.visit('/dataset/urn:li:dataset:(urn:li:dataPlatform:dbt,cypress_project.jaffle_shop.customers,PROD)/?is_lineage_mode=false');
diff --git a/smoke-test/tests/cypress/cypress/integration/views/view_select.js b/smoke-test/tests/cypress/cypress/integration/views/view_select.js
index 7475cf18f2d4e6..78977d3f00b045 100644
--- a/smoke-test/tests/cypress/cypress/integration/views/view_select.js
+++ b/smoke-test/tests/cypress/cypress/integration/views/view_select.js
@@ -1,8 +1,16 @@
+function openViewEditDropDownAndClickId(data_id) {
+ cy.openMultiSelect('view-select');
+ cy.get('[data-testid="view-select-item"]').first().trigger('mouseover')
+ cy.get('[data-testid="views-table-dropdown"]').first().trigger('mouseover');
+ cy.clickOptionWithTestId(data_id);
+}
+
describe("view select", () => {
it("click view select, create view, clear view, make defaults, clear view", () => {
- const viewName = "Test View"
- const viewDescription = "View Description"
- const newViewName = "New View Name"
+ cy.login();
+ let randomNumber = Math.floor(Math.random() * 100000);
+ const viewName = `Test View ${randomNumber}`
+ const newViewName = `New View Name ${randomNumber}`
// Resize Observer Loop warning can be safely ignored - ref. https://github.com/cypress-io/cypress/issues/22113
const resizeObserverLoopErrRe = "ResizeObserver loop limit exceeded";
@@ -12,90 +20,66 @@ describe("view select", () => {
}
});
- cy.login();
- cy.visit("/search?page=1&query=%2A&unionType=0");
+ cy.goToStarSearchList();
- // Create a View from the select
- cy.get('[data-testid="view-select"]').click();
- cy.clickOptionWithTestId("view-select-create");
+ cy.log("Create a View from the select")
+ cy.multiSelect('view-select', 'Create View');
+ cy.waitTextVisible("Create new View")
- cy.get(".ant-form-item-control-input-content > input[type='text']").first().type(viewName);
+ cy.enterTextInTestId("view-name-input", viewName);
- // Add Column Glossary Term Filter
- cy.contains("Add Filter").click();
- cy.contains("Column Glossary Term").click({ force: true });
- cy.get('[data-testid="tag-term-modal-input"]').type("CypressColumnInfo");
- cy.wait(2000);
- cy.get('[data-testid="tag-term-option"]').click({ force: true });
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
- force: true,
- });
+ cy.log("Add Column Glossary Term Filter")
+ cy.clickOptionWithText("Add Filter");
+ cy.clickOptionWithText("Column Glossary Term");
- cy.clickOptionWithTestId("view-builder-save");
- cy.waitTextVisible(viewName);
+ cy.waitTextVisible("Add Glossary Terms");
+ cy.selectOptionInTagTermModal("CypressColumnInfoType");
- cy.wait(2000); // Allow search to reload
+ cy.clickOptionWithText("Save");
+ cy.ensureTextNotPresent("Save");
+ cy.waitTextVisible(viewName);
- // Ensure the View filter has been applied correctly.
+ cy.log("Ensure the View filter has been applied correctly.")
cy.contains("SampleCypressHdfsDataset");
cy.contains("cypress_logging_events");
cy.contains("of 2 results");
- // Clear the selected view view
- cy.get('[data-testid="view-select"]').click();
- cy.clickOptionWithTestId("view-select-clear");
- cy.get("input[data-testid=search-input]").click(); // unfocus
- cy.contains(viewName).should("not.be.visible");
-
- cy.wait(2000); // Allow search to reload
+ cy.log("Clear the selected view")
+ cy.clearView(viewName);
cy.ensureTextNotPresent("of 2 results");
- // Now edit the view
- cy.get('[data-testid="view-select"]').click();
- cy.get('[data-testid="view-select-item"]').first().trigger('mouseover')
- cy.get('[data-testid="views-table-dropdown"]').first().trigger('mouseover');
- cy.get('[data-testid="view-dropdown-edit"]').click();
+ cy.log("Now edit the view")
+ openViewEditDropDownAndClickId('view-dropdown-edit');
cy.get(".ant-form-item-control-input-content > input[type='text']").first().clear().type(newViewName);
- // Update the actual filters by adding another filter
+ cy.log("Update the actual filters by adding another filter")
cy.contains("Add Filter").click();
- cy.get('[data-testid="adv-search-add-filter-description"]').click({
- force: true,
- });
- cy.get('[data-testid="edit-text-input"]').type("log event");
- cy.get('[data-testid="edit-text-done-btn"]').click();
+ cy.clickOptionWithTestId('adv-search-add-filter-description');
+ cy.enterTextInTestId('edit-text-input', "log event");
+ cy.clickOptionWithTestId('edit-text-done-btn');
- // Save View
+ cy.log("Save View")
cy.clickOptionWithTestId("view-builder-save");
- cy.wait(2000); // Allow search to reload
-
cy.contains("cypress_logging_events");
cy.contains("of 1 result");
-
- // Now set the View as the personal Default
- cy.get('[data-testid="view-select"]').click();
- cy.get('[data-testid="view-select-item"]').first().trigger('mouseover')
- cy.get('[data-testid="views-table-dropdown"]').first().trigger('mouseover');
- cy.get('[data-testid="view-dropdown-set-user-default"]').click();
- cy.get("input[data-testid=search-input]").click(); // unfocus
-
- // Now unset as the personal default
- cy.get('[data-testid="view-select"]').click();
- cy.get('[data-testid="view-select-item"]').first().trigger('mouseover')
- cy.get('[data-testid="views-table-dropdown"]').first().trigger('mouseover');
- cy.get('[data-testid="view-dropdown-remove-user-default"]').click();
- cy.get("input[data-testid=search-input]").click(); // unfocus
-
- // Now delete the View
- cy.get('[data-testid="view-select"]').click();
- cy.get('[data-testid="view-select-item"]').first().trigger('mouseover')
- cy.get('[data-testid="views-table-dropdown"]').first().trigger('mouseover');
- cy.get('[data-testid="view-dropdown-delete"]').click();
+
+ cy.log("Now set the View as the personal Default")
+ cy.clearView(viewName);
+ openViewEditDropDownAndClickId('view-dropdown-set-user-default');
+
+ cy.contains("of 1 result");
+ cy.clearView(newViewName);
+ cy.log("Now unset as the personal default")
+ openViewEditDropDownAndClickId('view-dropdown-remove-user-default');
+
+ cy.log("Now delete the View")
+ cy.clearView(newViewName);
+ openViewEditDropDownAndClickId('view-dropdown-delete');
cy.clickOptionWithText("Yes");
- // Ensure that the view was deleted.
- cy.ensureTextNotPresent(viewName);
- cy.wait(2000); // Allow search to reload
+ cy.log("Ensure that the view was deleted.")
+ cy.goToViewsSettings();
+ cy.ensureTextNotPresent(newViewName);
cy.ensureTextNotPresent("of 1 result");
});
diff --git a/smoke-test/tests/cypress/cypress/support/commands.js b/smoke-test/tests/cypress/cypress/support/commands.js
index 156c75573c816f..9eb940de91fceb 100644
--- a/smoke-test/tests/cypress/cypress/support/commands.js
+++ b/smoke-test/tests/cypress/cypress/support/commands.js
@@ -10,6 +10,11 @@
//
//
// -- This is a parent command --
+
+function selectorWithtestId (id) {
+ return '[data-testid="' + id +'"]';
+}
+
Cypress.Commands.add('login', () => {
cy.request({
method: 'POST',
@@ -95,7 +100,7 @@ Cypress.Commands.add("goToStarSearchList", () => {
})
Cypress.Commands.add("openThreeDotDropdown", () => {
- cy.get('[data-testid="entity-header-dropdown"]').click();
+ cy.clickOptionWithTestId("entity-header-dropdown")
});
Cypress.Commands.add("clickOptionWithText", (text) => {
@@ -131,18 +136,29 @@ Cypress.Commands.add("waitTextVisible", (text) => {
return cy.contains(text);
})
+Cypress.Commands.add("openMultiSelect", (data_id) => {
+ let selector = `${selectorWithtestId(data_id)}`
+ cy.get(`.ant-select${selector} > .ant-select-selector > .ant-select-selection-search`).click();
+})
+
+Cypress.Commands.add( 'multiSelect', (within_data_id , text) => {
+ cy.openMultiSelect(within_data_id);
+ cy.waitTextVisible(text);
+ cy.clickOptionWithText(text);
+});
+
Cypress.Commands.add("enterTextInTestId", (id, text) => {
- cy.get('[data-testid="' + id +'"]').type(text);
+ cy.get(selectorWithtestId(id)).type(text);
})
Cypress.Commands.add("clickOptionWithTestId", (id) => {
- cy.get('[data-testid="' + id +'"]').click({
+ cy.get(selectorWithtestId(id)).click({
force: true,
});
})
Cypress.Commands.add("clickFirstOptionWithTestId", (id) => {
- cy.get('[data-testid="' + id +'"]').first().click({
+ cy.get(selectorWithtestId(id)).first().click({
force: true,
});
})
@@ -151,19 +167,28 @@ Cypress.Commands.add("hideOnboardingTour", () => {
cy.get('body').type("{ctrl} {meta} h");
});
+Cypress.Commands.add("clearView", (viewName) => {
+ cy.clickOptionWithTestId("view-select");
+ cy.clickOptionWithTestId("view-select-clear");
+ cy.get("input[data-testid='search-input']").click();
+ cy.contains(viewName).should("not.be.visible");
+})
+
Cypress.Commands.add('addTermToDataset', (urn, dataset_name, term) => {
cy.goToDataset(urn, dataset_name);
cy.clickOptionWithText("Add Term");
- cy.focused().type(term);
- cy.get(".ant-select-item-option-content").within(() =>
- cy.contains(term).click({ force: true })
- );
- cy.clickOptionWithTestId('add-tag-term-from-modal-btn');
- cy.get('[data-testid="add-tag-term-from-modal-btn"]').should("not.exist");
-
+ cy.selectOptionInTagTermModal(term);
cy.contains(term);
});
+Cypress.Commands.add('selectOptionInTagTermModal', (text) => {
+ cy.enterTextInTestId("tag-term-modal-input", text);
+ cy.clickOptionWithTestId("tag-term-option");
+ let btn_id = "add-tag-term-from-modal-btn";
+ cy.clickOptionWithTestId(btn_id);
+ cy.get(selectorWithtestId(btn_id)).should("not.exist");
+});
+
Cypress.Commands.add("removeDomainFromDataset", (urn, dataset_name, domain_urn) => {
cy.goToDataset(urn, dataset_name);
cy.get('.sidebar-domain-section [href="/domain/' + domain_urn + '"] .anticon-close').click();