You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/10/14 12:31:10 UTC

[GitHub] [superset] michael-s-molina commented on a diff in pull request #21805: chore: E2E Dashboards Cross-references

michael-s-molina commented on code in PR #21805:
URL: https://github.com/apache/superset/pull/21805#discussion_r995703393


##########
superset-frontend/cypress-base/cypress/integration/chart_list/list.test.ts:
##########
@@ -43,14 +47,70 @@ function confirmDelete() {
   cy.getBySel('modal-confirm-button').click();
 }
 
+function visitChartList() {
+  interceptFiltering();
+  cy.visit(CHART_LIST);
+  cy.wait('@filtering');
+}
+
 describe('Charts list', () => {
   beforeEach(() => {
     cy.preserveLogin();
   });
 
+  describe('Cross-referenced dashboards', () => {
+    beforeEach(() => {
+      visitChartList();
+    });
+
+    before(() => {
+      cy.createSampleDashboards([0, 1, 2, 3]);
+      cy.createSampleCharts([0]);
+    });
+
+    it('should the cross-referenced dashboards in the table cell', () => {
+      interceptDashboardGet();
+      cy.getBySel('table-row')
+        .first()
+        .find('[data-test="table-row-cell"]')
+        .find('[data-test="crosslinks"]')
+        .should('be.empty');
+      cy.getBySel('table-row')
+        .eq(2)
+        .find('[data-test="table-row-cell"]')
+        .find('[data-test="crosslinks"]')
+        .contains("World Bank's Data, Tabbed Dashboard");
+      cy.getBySel('table-row')
+        .eq(1)
+        .find('[data-test="table-row-cell"]')
+        .find('[data-test="crosslinks"]')
+        .contains('Tabbed Dashboard')
+        .invoke('removeAttr', 'target')
+        .click();
+      cy.wait('@get');
+    });
+
+    it('should the newly added dashboards in a tooltip', () => {

Review Comment:
   ```suggestion
       it('shows the newly added dashboards in a tooltip', () => {
   ```



##########
superset-frontend/cypress-base/cypress/integration/chart_list/list.test.ts:
##########
@@ -43,14 +47,70 @@ function confirmDelete() {
   cy.getBySel('modal-confirm-button').click();
 }
 
+function visitChartList() {
+  interceptFiltering();
+  cy.visit(CHART_LIST);
+  cy.wait('@filtering');
+}
+
 describe('Charts list', () => {
   beforeEach(() => {
     cy.preserveLogin();
   });
 
+  describe('Cross-referenced dashboards', () => {
+    beforeEach(() => {
+      visitChartList();
+    });
+
+    before(() => {
+      cy.createSampleDashboards([0, 1, 2, 3]);
+      cy.createSampleCharts([0]);
+    });
+
+    it('should the cross-referenced dashboards in the table cell', () => {

Review Comment:
   ```suggestion
       it('shows the cross-referenced dashboards in the table cell', () => {
   ```



##########
superset-frontend/cypress-base/cypress/integration/explore/chart.test.js:
##########
@@ -16,7 +16,113 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+import { CHART_LIST } from 'cypress/utils/urls';
+import { interceptGet as interceptDashboardGet } from 'cypress/integration/dashboard/utils';
 import { FORM_DATA_DEFAULTS, NUM_METRIC } from './visualizations/shared.helper';
+import {
+  interceptFiltering,
+  saveChartToDashboard,
+  visitSampleChartFromList,
+} from './utils';
+
+// SEARCH_THRESHOLD is 10. We need to add at least 11 dashboards to show search
+const SAMPLE_DASHBOARDS_INDEXES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+
+function openDashboardsAddedTo() {
+  cy.getBySel('actions-trigger').click();
+  cy.get('.ant-dropdown-menu-submenu-title')
+    .contains('Dashboards added to')
+    .trigger('mouseover');
+}
+
+function closeDashboardsAddedTo() {
+  cy.get('.ant-dropdown-menu-submenu-title')
+    .contains('Dashboards added to')
+    .trigger('mouseout');
+  cy.getBySel('actions-trigger').click();
+}
+
+function verifyDashboardsSubmenuItem(dashboardName) {
+  cy.get('.ant-dropdown-menu-submenu-popup').contains(dashboardName);
+  closeDashboardsAddedTo();
+}
+
+function verifyDashboardSearch() {
+  openDashboardsAddedTo();
+  cy.get('.ant-dropdown-menu-submenu-popup').trigger('mouseover');
+  cy.get('.ant-dropdown-menu-submenu-popup')
+    .find('input[placeholder="Search"]')
+    .type('1');
+  cy.get('.ant-dropdown-menu-submenu-popup').contains('1 - Sample dashboard');
+  cy.get('.ant-dropdown-menu-submenu-popup')
+    .find('input[placeholder="Search"]')
+    .type('Blahblah');
+  cy.get('.ant-dropdown-menu-submenu-popup').contains('No results found');
+  cy.get('.ant-dropdown-menu-submenu-popup')
+    .find('[aria-label="close-circle"]')
+    .click();
+  closeDashboardsAddedTo();
+}
+
+function verifyDashboardLink() {
+  interceptDashboardGet();
+  openDashboardsAddedTo();
+  cy.get('.ant-dropdown-menu-submenu-popup').trigger('mouseover');
+  cy.get('.ant-dropdown-menu-submenu-popup a')
+    .first()
+    .invoke('removeAttr', 'target')
+    .click();
+  cy.wait('@get');
+}
+
+function verifyMetabar(text) {
+  cy.getBySel('metadata-bar').contains(text);
+}
+
+function saveAndVerifyDashboard(number) {
+  saveChartToDashboard(`${number} - Sample dashboard`);
+  verifyMetabar(`Added to ${number} dashboard(s)`);
+  openDashboardsAddedTo();
+  verifyDashboardsSubmenuItem(`${number} - Sample dashboard`);
+}
+
+describe('Cross-referenced dashboards', () => {
+  beforeEach(() => {
+    interceptFiltering();
+
+    cy.preserveLogin();
+    cy.visit(CHART_LIST);
+    cy.wait('@filtering');
+  });
+
+  before(() => {
+    cy.createSampleDashboards(SAMPLE_DASHBOARDS_INDEXES);
+    cy.createSampleCharts([0]);
+  });
+
+  it('Shows the cross referenced dashboards', () => {

Review Comment:
   ```suggestion
     it('shows the cross-referenced dashboards', () => {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org