diff --git a/test/functional/apps/visualize/_visualize_screenshots.js b/test/functional/apps/visualize/_visualize_screenshots.js new file mode 100644 index 000000000000..dfde04fc5cd4 --- /dev/null +++ b/test/functional/apps/visualize/_visualize_screenshots.js @@ -0,0 +1,247 @@ +import expect from 'expect.js'; + +export default function ({ getService, getPageObjects, updateBaselines }) { + const log = getService('log'); + const esArchiver = getService('esArchiver'); + const screenshot = getService('screenshots'); + const PageObjects = getPageObjects(['common', 'visualize', 'header']); + const remote = getService('remote'); + + + describe('visualize app', function describeIndexTests() { + let initialize = true; + let initialSize; + + before(async function () { + await esArchiver.load('visualization_screenshots'); + await PageObjects.common.navigateToApp('visualize'); + + // can see from properties of baseline images + const baselineImageSize = { width: 1280, height: 686 }; + await calibrateForScreenshots(baselineImageSize); + }); + + after(async function () { + await remote.setWindowSize(initialSize.width, initialSize.height); + }); + + /* + Although the baseline images were captured with the window set to 1280 x 800 + the actual baseline images for this test are 1280 x 686 because Chrome has a + banner at the top that says the browser is being controlled by automated + software. The comparePngs function will try to scale images of mismatched + sizes before doing the comparison, but the matching is much more accurate if + the images are in the exact same aspect ratio. + To accomadate for different browsers on different OSs, we can take a temp + screenshot, get it's size, and then adjust our window size so that the screenshots + will be an exact match (if the user's display scaling is 100%). + If the display scaling is not 100%, we need to figure out what it is and use + that in our new window size calculation. For example, If I run this test with + my display scaling set to 200%, the comparePngs will log this; + expected height 686 and width 1280 + actual height 1372 and width 2560 + But that's OK, because that's exactly 200% of the baseline image size. + */ + async function calibrateForScreenshots(baselineImageSize) { + // CALIBRATION STEP + initialSize = await remote.getWindowSize(); + // take a sample screenshot and get the size + let currentSize = await screenshot.getScreenshotSize(); + log.debug(`################## initial screenshot Size: ${currentSize.width} x ${currentSize.height}`); + // determine if there is display scaling and if so, what it is + log.debug(`current width / 1280 = ${currentSize.width / 1280}`); + log.debug(`current width / 1252 = ${currentSize.width / 1252}`); + + await remote.setWindowSize(initialSize.width + 100, initialSize.height); + const tempSize = await screenshot.getScreenshotSize(); + log.debug(`################ temp screenshot Size: ${currentSize.width} x ${currentSize.height}`); + const ratio = (tempSize.width - currentSize.width) / 100; + log.debug(`################ display scaling ratio = ${ratio}`); + + // calculate the new desired size using that ratio. + const newSize = { width: (initialSize.width) + (baselineImageSize.width) - currentSize.width / ratio, + height: (initialSize.height) + (baselineImageSize.height) - currentSize.height / ratio }; + log.debug(`################## setting window size to ${newSize.width} x ${newSize.height}`); + log.debug(`################## delta size to ${newSize.width - initialSize.width} x ${newSize.height - initialSize.height}`); + await remote.setWindowSize(newSize.width, newSize.height); + + // check again. + currentSize = await screenshot.getScreenshotSize(); + log.debug(`################## second screenshot Size: ${currentSize.width} x ${currentSize.height}`); + } + + + it('should compare visualization screenshot for bar chart with count metric agg and date histogram with terms', async function () { + const expectedSavedVizName = 'screenshot_area_chart_bar'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for area chart with legend position and grid lines', async function () { + const expectedSavedVizName = 'screenshot_area_chart_options'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for bar chart with percentile ranks metric agg with date histogram', async function () { + const expectedSavedVizName = 'screenshot_barchart_percentile'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for horizontal bar chart with top hits metric agg with date histogram', async function () { + const expectedSavedVizName = 'screenshot_barchart_tophit'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for data table with average metric agg with histogram', async function () { + const expectedSavedVizName = 'screenshot_datatable_average'; + await compareScreenshot(expectedSavedVizName, 0.07); + }); + + it('should compare visualization screenshot for data table with minimum bucket metric agg and geohash', async function () { + const expectedSavedVizName = 'screenshot_datatable_options'; + await compareScreenshot(expectedSavedVizName, 0.07); + }); + + it('should compare visualization screenshot for data table with count metric agg and significant terms bucket', async function () { + const expectedSavedVizName = 'screenshot_datatable_significant'; + await compareScreenshot(expectedSavedVizName, 0.07); + }); + + it('should compare visualization screenshot for gauge chart displayes as circles with sum bucket agg and terms', async function () { + const expectedSavedVizName = 'screenshot_gaugecircle_options'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for goal chart with color options and count metric agg', async function () { + const expectedSavedVizName = 'screenshot_goal_chart_options'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for heatmap with all options with standard deviation and date range', async function () { + const expectedSavedVizName = 'screenshot_heatmap_alloptions'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for bar chart with cumulative sum metrics agg and date histogram', async function () { + const expectedSavedVizName = 'screenshot_horizontal_bar_chart'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for input controls', async function () { + const expectedSavedVizName = 'screenshot_inputcontrol_options'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for line chart with unique count agg and terms', async function () { + const expectedSavedVizName = 'screenshot_line_chart_options'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for line chart with Max bucket and terms', async function () { + const expectedSavedVizName = 'screenshot_line_chart_parent'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for line chart with bubbles', async function () { + const expectedSavedVizName = 'screenshot_linechart_bubbles'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for line chart with derivative agg and date histogram', async function () { + const expectedSavedVizName = 'screenshot_linechart_derivative'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for line chart with serial diff agg and date histogram', async function () { + const expectedSavedVizName = 'screenshot_linechart_serial'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for mark down with text', async function () { + const expectedSavedVizName = 'screenshot_markdown_options'; + await compareScreenshot(expectedSavedVizName, 0.07); + }); + + it('should compare visualization screenshot for metric viz with median metric agg and filters', async function () { + const expectedSavedVizName = 'screenshot_metrictable_median'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for pie chart in donut mode with sum metric agg and range', async function () { + const expectedSavedVizName = 'screenshot_piechart_donut'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for pie chart in regular mode with unique count metric agg and terms', async function () { + const expectedSavedVizName = 'screenshot_piechart_unique_count'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for region map in regular mode with unique count agg', async function () { + const expectedSavedVizName = 'screenshot_regionmap_options'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for tag cloud with terms agg and default options', async function () { + const expectedSavedVizName = 'screenshot_tagcloud_single'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for tile map with shaded geo hash map type and legend in bottom left', async function () { + const expectedSavedVizName = 'screenshot_tilemap_geohash'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for tile map with heatmap map type and legend in top left', async function () { + const expectedSavedVizName = 'screenshot_tilemap_heatmap'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for tile map with circle markers map type and max bytes agg', async function () { + const expectedSavedVizName = 'screenshot_tilemap_options'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for timelion', async function () { + const expectedSavedVizName = 'screenshot_timelion_colors'; + await compareScreenshot(expectedSavedVizName, 0.08); + }); + + it('should compare visualization screenshot for vertical bar chart with percentiles metric agg and IPV4 Range', async function () { + const expectedSavedVizName = 'screenshot_vertical_bar_chart_options'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for vertical bar chart with moving average agg and histogram', async function () { + const expectedSavedVizName = 'screenshot_vertical_movingagg'; + await compareScreenshot(expectedSavedVizName); + }); + + it('should compare visualization screenshot for vertical bar chart with average bucket metric agg and terms', async function () { + const expectedSavedVizName = 'screenshot_verticalbar_average'; + await compareScreenshot(expectedSavedVizName); + }); + + async function compareScreenshot(expectedSavedVizName, threshold = 0.065) { + + if(initialize) { + initialize = false; + const fromTime = '2015-09-19 06:31:44.000'; + const toTime = '2015-09-23 18:31:44.000'; + await PageObjects.common.navigateToApp('visualize'); + await PageObjects.visualize.openSavedVisualization(expectedSavedVizName); + log.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); + await PageObjects.header.setAbsoluteRange(fromTime, toTime); + } else { + await PageObjects.visualize.loadSavedVisualization(expectedSavedVizName); + } + + + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.common.sleep(1000); + const percentDifferent = await screenshot.compareAgainstBaseline(expectedSavedVizName, updateBaselines); + expect(percentDifferent).to.be.lessThan(threshold); + + } + + }); +} diff --git a/test/functional/apps/visualize/index.js b/test/functional/apps/visualize/index.js index ca6edba9b8bf..d4fc2cb75875 100644 --- a/test/functional/apps/visualize/index.js +++ b/test/functional/apps/visualize/index.js @@ -53,5 +53,6 @@ export default function ({ getService, loadTestFile }) { loadTestFile(require.resolve('./_histogram_request_start')); loadTestFile(require.resolve('./_vega_chart')); loadTestFile(require.resolve('./_lab_mode')); + loadTestFile(require.resolve('./_visualize_screenshots')); }); } diff --git a/test/functional/fixtures/es_archiver/visualization_screenshots/data.json.gz b/test/functional/fixtures/es_archiver/visualization_screenshots/data.json.gz new file mode 100644 index 000000000000..1f76b780cd95 Binary files /dev/null and b/test/functional/fixtures/es_archiver/visualization_screenshots/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/visualization_screenshots/mappings.json b/test/functional/fixtures/es_archiver/visualization_screenshots/mappings.json new file mode 100644 index 000000000000..e361618c814a --- /dev/null +++ b/test/functional/fixtures/es_archiver/visualization_screenshots/mappings.json @@ -0,0 +1,269 @@ +{ + "type": "index", + "value": { + "index": ".kibana", + "settings": { + "index": { + "number_of_shards": "1", + "auto_expand_replicas": "0-1", + "number_of_replicas": "0" + } + }, + "mappings": { + "doc": { + "dynamic": "strict", + "properties": { + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + }, + "dateFormat:tz": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "defaultIndex": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + } + } + }, + "dashboard": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "optionsJSON": { + "type": "text" + }, + "panelsJSON": { + "type": "text" + }, + "refreshInterval": { + "properties": { + "display": { + "type": "keyword" + }, + "pause": { + "type": "boolean" + }, + "section": { + "type": "integer" + }, + "value": { + "type": "integer" + } + } + }, + "timeFrom": { + "type": "keyword" + }, + "timeRestore": { + "type": "boolean" + }, + "timeTo": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "index-pattern": { + "dynamic": "strict", + "properties": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { + "type": "keyword" + }, + "title": { + "type": "text" + } + } + }, + "search": { + "dynamic": "strict", + "properties": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "server": { + "dynamic": "strict", + "properties": { + "uuid": { + "type": "keyword" + } + } + }, + "timelion-sheet": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "timelion_chart_height": { + "type": "integer" + }, + "timelion_columns": { + "type": "integer" + }, + "timelion_interval": { + "type": "keyword" + }, + "timelion_other_interval": { + "type": "keyword" + }, + "timelion_rows": { + "type": "integer" + }, + "timelion_sheet": { + "type": "text" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "type": { + "type": "keyword" + }, + "updated_at": { + "type": "date" + }, + "url": { + "dynamic": "strict", + "properties": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } + } + } + }, + "visualization": { + "dynamic": "strict", + "properties": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchId": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { + "type": "text" + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/test/functional/page_objects/visualize_page.js b/test/functional/page_objects/visualize_page.js index 679096c88b47..5b706a7c2a3f 100644 --- a/test/functional/page_objects/visualize_page.js +++ b/test/functional/page_objects/visualize_page.js @@ -623,7 +623,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) { } async filterVisByName(vizName) { - const input = await find.byCssSelector('input[name="filter"]'); + const input = await find.byCssSelector('input[aria-label="Filter"]'); await input.click(); // can't uses dashes in saved visualizations when filtering // or extended character sets @@ -650,6 +650,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) { } async openSavedVisualization(vizName) { + await this.filterVisByName(vizName); await this.clickVisualizationByName(vizName); } diff --git a/test/functional/screenshots/baseline/screenshot_area_chart_bar.png b/test/functional/screenshots/baseline/screenshot_area_chart_bar.png new file mode 100644 index 000000000000..e7096d586125 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_area_chart_bar.png differ diff --git a/test/functional/screenshots/baseline/screenshot_area_chart_options.png b/test/functional/screenshots/baseline/screenshot_area_chart_options.png new file mode 100644 index 000000000000..ae4b82968693 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_area_chart_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_barchart_percentile.png b/test/functional/screenshots/baseline/screenshot_barchart_percentile.png new file mode 100644 index 000000000000..604935719b02 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_barchart_percentile.png differ diff --git a/test/functional/screenshots/baseline/screenshot_barchart_tophit.png b/test/functional/screenshots/baseline/screenshot_barchart_tophit.png new file mode 100644 index 000000000000..ad375d60a136 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_barchart_tophit.png differ diff --git a/test/functional/screenshots/baseline/screenshot_datatable_average.png b/test/functional/screenshots/baseline/screenshot_datatable_average.png new file mode 100644 index 000000000000..5347682d3f02 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_datatable_average.png differ diff --git a/test/functional/screenshots/baseline/screenshot_datatable_options.png b/test/functional/screenshots/baseline/screenshot_datatable_options.png new file mode 100644 index 000000000000..3d88001ce858 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_datatable_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_datatable_significant.png b/test/functional/screenshots/baseline/screenshot_datatable_significant.png new file mode 100644 index 000000000000..8a8b4e14c155 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_datatable_significant.png differ diff --git a/test/functional/screenshots/baseline/screenshot_gaugecircle_options.png b/test/functional/screenshots/baseline/screenshot_gaugecircle_options.png new file mode 100644 index 000000000000..0c17365027d4 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_gaugecircle_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_goal_chart_options.png b/test/functional/screenshots/baseline/screenshot_goal_chart_options.png new file mode 100644 index 000000000000..b21da9cab5dd Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_goal_chart_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_heatmap_alloptions.png b/test/functional/screenshots/baseline/screenshot_heatmap_alloptions.png new file mode 100644 index 000000000000..94da55724b8c Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_heatmap_alloptions.png differ diff --git a/test/functional/screenshots/baseline/screenshot_horizontal_bar_chart.png b/test/functional/screenshots/baseline/screenshot_horizontal_bar_chart.png new file mode 100644 index 000000000000..624ca99f823d Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_horizontal_bar_chart.png differ diff --git a/test/functional/screenshots/baseline/screenshot_inputcontrol_options.png b/test/functional/screenshots/baseline/screenshot_inputcontrol_options.png new file mode 100644 index 000000000000..ca72fe2b89df Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_inputcontrol_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_line_chart_options.png b/test/functional/screenshots/baseline/screenshot_line_chart_options.png new file mode 100644 index 000000000000..f1d22669dad9 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_line_chart_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_line_chart_parent.png b/test/functional/screenshots/baseline/screenshot_line_chart_parent.png new file mode 100644 index 000000000000..b84526544c73 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_line_chart_parent.png differ diff --git a/test/functional/screenshots/baseline/screenshot_linechart_bubbles.png b/test/functional/screenshots/baseline/screenshot_linechart_bubbles.png new file mode 100644 index 000000000000..b5e3d74c76a8 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_linechart_bubbles.png differ diff --git a/test/functional/screenshots/baseline/screenshot_linechart_derivative.png b/test/functional/screenshots/baseline/screenshot_linechart_derivative.png new file mode 100644 index 000000000000..265a61e3b045 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_linechart_derivative.png differ diff --git a/test/functional/screenshots/baseline/screenshot_linechart_serial.png b/test/functional/screenshots/baseline/screenshot_linechart_serial.png new file mode 100644 index 000000000000..a371801ae326 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_linechart_serial.png differ diff --git a/test/functional/screenshots/baseline/screenshot_markdown_options.png b/test/functional/screenshots/baseline/screenshot_markdown_options.png new file mode 100644 index 000000000000..501ad28ecc5e Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_markdown_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_metrictable_median.png b/test/functional/screenshots/baseline/screenshot_metrictable_median.png new file mode 100644 index 000000000000..6e635e3a2261 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_metrictable_median.png differ diff --git a/test/functional/screenshots/baseline/screenshot_piechart_donut.png b/test/functional/screenshots/baseline/screenshot_piechart_donut.png new file mode 100644 index 000000000000..35cfae77d62b Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_piechart_donut.png differ diff --git a/test/functional/screenshots/baseline/screenshot_piechart_unique_count.png b/test/functional/screenshots/baseline/screenshot_piechart_unique_count.png new file mode 100644 index 000000000000..ae9ae02a1170 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_piechart_unique_count.png differ diff --git a/test/functional/screenshots/baseline/screenshot_regionmap_options.png b/test/functional/screenshots/baseline/screenshot_regionmap_options.png new file mode 100644 index 000000000000..21b84e719644 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_regionmap_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_tagcloud_single.png b/test/functional/screenshots/baseline/screenshot_tagcloud_single.png new file mode 100644 index 000000000000..92dfbd40ba80 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_tagcloud_single.png differ diff --git a/test/functional/screenshots/baseline/screenshot_tilemap_geohash.png b/test/functional/screenshots/baseline/screenshot_tilemap_geohash.png new file mode 100644 index 000000000000..7241039d138e Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_tilemap_geohash.png differ diff --git a/test/functional/screenshots/baseline/screenshot_tilemap_heatmap.png b/test/functional/screenshots/baseline/screenshot_tilemap_heatmap.png new file mode 100644 index 000000000000..55452e045a63 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_tilemap_heatmap.png differ diff --git a/test/functional/screenshots/baseline/screenshot_tilemap_options.png b/test/functional/screenshots/baseline/screenshot_tilemap_options.png new file mode 100644 index 000000000000..6b477792fc1b Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_tilemap_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_timelion_colors.png b/test/functional/screenshots/baseline/screenshot_timelion_colors.png new file mode 100644 index 000000000000..5553feff8340 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_timelion_colors.png differ diff --git a/test/functional/screenshots/baseline/screenshot_vertical_bar_chart_options.png b/test/functional/screenshots/baseline/screenshot_vertical_bar_chart_options.png new file mode 100644 index 000000000000..a8bc90a1f067 Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_vertical_bar_chart_options.png differ diff --git a/test/functional/screenshots/baseline/screenshot_vertical_movingagg.png b/test/functional/screenshots/baseline/screenshot_vertical_movingagg.png new file mode 100644 index 000000000000..8d6ca5ac3aff Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_vertical_movingagg.png differ diff --git a/test/functional/screenshots/baseline/screenshot_verticalbar_average.png b/test/functional/screenshots/baseline/screenshot_verticalbar_average.png new file mode 100644 index 000000000000..cbb60954e56b Binary files /dev/null and b/test/functional/screenshots/baseline/screenshot_verticalbar_average.png differ diff --git a/test/functional/services/lib/compare_pngs.js b/test/functional/services/lib/compare_pngs.js index 7f9ab50fab71..c858584b07cd 100644 --- a/test/functional/services/lib/compare_pngs.js +++ b/test/functional/services/lib/compare_pngs.js @@ -55,3 +55,10 @@ export async function comparePngs(sessionPath, baselinePath, diffPath, sessionDi } return percent; } + + +export async function getSize(sessionPath, sessionDirectory) { + console.log(`comparePngs: ${sessionPath} ${sessionDirectory}`); + const session = (await Jimp.read(sessionPath)).clone(); + return { width: session.bitmap.width, height: session.bitmap.height }; +} diff --git a/test/functional/services/screenshots.js b/test/functional/services/screenshots.js index 9c4b9a931788..8cfe0ecae33f 100644 --- a/test/functional/services/screenshots.js +++ b/test/functional/services/screenshots.js @@ -22,7 +22,7 @@ import { writeFile, readFileSync } from 'fs'; import { fromNode as fcb, promisify } from 'bluebird'; import mkdirp from 'mkdirp'; import del from 'del'; -import { comparePngs } from './lib/compare_pngs'; +import { comparePngs, getSize } from './lib/compare_pngs'; const mkdirAsync = promisify(mkdirp); const writeFileAsync = promisify(writeFile); @@ -63,6 +63,14 @@ export async function ScreenshotsProvider({ getService }) { } } + + async getScreenshotSize() { + log.debug('getScreenshotSize'); + const sessionPath = resolve(SESSION_DIRECTORY, 'temp.png'); + await this._take(sessionPath); + return await getSize(sessionPath, SESSION_DIRECTORY); + } + async take(name) { return await this._take(resolve(SESSION_DIRECTORY, `${name}.png`)); }