diff --git a/server/webdriver/shared_tests/place_explorer_test.py b/server/webdriver/shared_tests/place_explorer_test.py index 6560e9e681..d3e943bc17 100644 --- a/server/webdriver/shared_tests/place_explorer_test.py +++ b/server/webdriver/shared_tests/place_explorer_test.py @@ -294,4 +294,27 @@ def test_ranking_chart_redirect_link(self): # Check the title text page_title = self.driver.find_element(By.ID, 'place-name').text - self.assertEqual(page_title, place_name_text) \ No newline at end of file + self.assertEqual(page_title, place_name_text) + + def test_export_chart_data(self): + """Tests the export chart data button works correctly for group bar charts.""" + # Load CA housing page + ca_housing_url = CA_URL + "?category=Housing" + self.driver.get(self.url_ + ca_housing_url) + + # Wait for trend chart to load + trend_chart = EC.presence_of_element_located( + (By.CSS_SELECTOR, '[data-testclass~="is-snapshot"]')) + WebDriverWait(self.driver, self.TIMEOUT_SEC).until(trend_chart) + + # Find and click export link for group bar chart + export_link = self.driver.find_element( + By.XPATH, + "//*[@data-testclass='is-snapshot chart-type-GROUP_BAR']//div[contains(@class,'outlinks')]//a[text()='Export']" + ) + export_link.click() + + # Wait for entity DCID text to appear in dialog + entity_dcid_present = EC.text_to_be_present_in_element( + (By.CLASS_NAME, "copy-svg"), "Entity DCID") + WebDriverWait(self.driver, self.TIMEOUT_SEC).until(entity_dcid_present) diff --git a/static/js/place/chart.tsx b/static/js/place/chart.tsx index f6cbbe0eb7..73bd0542d7 100644 --- a/static/js/place/chart.tsx +++ b/static/js/place/chart.tsx @@ -248,7 +248,16 @@ class Chart extends React.Component { ); }); return ( -
+
{ entities, fieldDelimiter: CSV_FIELD_DELIMITER, transformHeader: transformCsvHeader, - variables: this.props.statsVars, + variables: this.statsVars, }); } else if (this.props.parentPlaceDcid && this.props.enclosedPlaceType) { // Ranking & map charts set parentPlaceDcid and rankingPlaceType @@ -455,7 +464,7 @@ class Chart extends React.Component { fieldDelimiter: CSV_FIELD_DELIMITER, parentEntity: this.props.parentPlaceDcid, transformHeader: transformCsvHeader, - variables: this.props.statsVars, + variables: this.statsVars, }); } // All other charts should fetch data about specific entities and @@ -465,7 +474,7 @@ class Chart extends React.Component { entities, fieldDelimiter: CSV_FIELD_DELIMITER, transformHeader: transformCsvHeader, - variables: this.props.statsVars, + variables: this.statsVars, }); }, this.svgContainerElement.current.offsetWidth,