Merge branch 'feature/design' into selectable_list_directive

This commit is contained in:
Shelby Sturgis 2016-03-18 16:17:52 -07:00
commit 00f5527f9d
10 changed files with 114 additions and 70 deletions

View file

@ -55,7 +55,7 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
npm run elasticsearch
```
- Start the development server.
- Start the development server. _On Windows, you'll need you use Git Bash, Cygwin, or a similar shell that exposes the `sh` command._
```sh
npm start
@ -146,7 +146,8 @@ Run the tests for just your particular plugin. Assuming you plugin lives outside
#### Running browser automation tests:
*The Selenium server that is started currently only runs the tests in Firefox*
*The Selenium server that is started currently only runs the tests in a recent version of Firefox.*
*You can use the `PATH` environment variable to specify which version of Firefox to use.*
The following will start Kibana, Elasticsearch and Selenium for you. To run the functional UI tests use the following commands
@ -177,7 +178,7 @@ npm run test:ui:runner
- These tests have been developed and tested with Chrome and Firefox browser. In theory, they should work on all browsers (that's the benefit of Intern using Leadfoot).
- These tests should also work with an external testing service like https://saucelabs.com/ or https://www.browserstack.com/ but that has not been tested.
- https://theintern.github.io/
- https://theintern.github.io/leadfoot/Element.html
- https://theintern.github.io/leadfoot/module-leadfoot_Element.html
#### Building OS packages

View file

@ -49,7 +49,7 @@
"test:coverage": "grunt test:coverage",
"build": "grunt build",
"build:ospackages": "grunt build --os-packages",
"start": "./bin/kibana --dev",
"start": "sh ./bin/kibana --dev",
"precommit": "grunt precommit",
"karma": "karma start",
"elasticsearch": "grunt esvm:dev:keepalive",
@ -179,6 +179,7 @@
"makelogs": "3.0.0-beta3",
"marked-text-renderer": "0.1.0",
"mocha": "2.3.0",
"ncp": "2.0.0",
"nock": "2.10.0",
"npm": "2.11.0",
"portscanner": "1.0.0",

View file

@ -48,7 +48,14 @@ module.exports = function (path) {
_.forOwn(val, function (subVal, subKey) {
apply(config, subVal, key + '.' + subKey);
});
} else {
}
else if (_.isArray(val)) {
config[key] = [];
val.forEach((subVal, i) => {
apply(config, subVal, key + '.' + i);
});
}
else {
_.set(config, key, val);
}
}

View file

@ -43,8 +43,8 @@ describe('Notifier', function () {
expect(notify('error').title).to.equal('Error');
});
it('sets lifetime to Infinity', function () {
expect(notify('error').lifetime).to.equal(Infinity);
it('sets lifetime to 5 minutes', function () {
expect(notify('error').lifetime).to.equal(300000);
});
it('allows reporting', function () {

View file

@ -229,7 +229,7 @@ Notifier.prototype.error = function (err, cb) {
content: formatMsg(err, this.from),
icon: 'warning',
title: 'Error',
lifetime: Infinity,
lifetime: 300000,
actions: ['report', 'accept'],
stack: formatStack(err)
}, cb);

View file

@ -22,6 +22,7 @@ module.exports = function (grunt) {
'stop:optimizeBuild',
'_build:downloadNodeBuilds:finish',
'_build:versionedLinks',
'_build:osShellScripts',
'_build:archives',
grunt.option('os-packages') ? [
'_build:pleaseRun',

View file

@ -0,0 +1,42 @@
import {join, extname} from 'path';
import {promisify} from 'bluebird';
import {ncp} from 'ncp';
import rimraf from 'rimraf';
const pncp = promisify(ncp);
const primraf = promisify(rimraf);
export default function (grunt) {
grunt.registerTask('_build:osShellScripts', async function osShellScripts() {
const done = this.async();
const source = 'build/kibana/bin';
const platforms = grunt.config.get('platforms');
const allPlatforms = fn => invokeAllAsync(platforms, fn);
try {
await allPlatforms(platform => primraf(join(platform.buildDir, 'bin')));
await allPlatforms(platform => pncp(source, join(platform.buildDir, 'bin')));
await allPlatforms(platform => removeExtraneousShellScripts(grunt, platform));
done();
} catch (err) {
done(err);
}
});
};
function invokeAllAsync(all, fn) {
return Promise.all(all.map(fn));
}
function removeExtraneousShellScripts(grunt, platform) {
return Promise.all(grunt.file
.expand(join(platform.buildDir, 'bin', '*'))
.filter(file => isExtraneous(platform, file))
.map(file => primraf(file)));
}
function isExtraneous(platform, file) {
const ext = extname(file);
if (platform.win && ext === '') { return true; }
if (!platform.win && ext === '.bat') { return true; }
return false;
}

View file

@ -150,7 +150,7 @@ define(function (require) {
expect(labels).to.eql(yAxisLabels);
})
.then(function getAreaChartData() {
return visualizePage.getAreaChartData();
return visualizePage.getAreaChartData('Count');
})
.then(function (paths) {
common.debug('expectedAreaChartData = ' + expectedAreaChartData);

View file

@ -122,7 +122,7 @@ define(function (require) {
// sleep a bit before trying to get the chart data
return common.sleep(3000)
.then(function () {
return visualizePage.getLineChartData()
return visualizePage.getLineChartData('fill="#57c17b"')
.then(function showData(data) {
var tolerance = 10; // the y-axis scale is 10000 so 10 is 0.1%
for (var x = 0; x < data.length; x++) {

View file

@ -326,19 +326,26 @@ define(function (require) {
});
},
// saved visualizations are paginated 5 to a page!
// this starts by clicking the Load Saved Viz button, not from the
// bottom half of the "Create a new visualization Step 1" page
loadSavedVisualization: function loadSavedVisualization(vizName) {
var self = this;
return this.remote
.setFindTimeout(defaultTimeout)
.findByCssSelector('button[aria-label="Load Saved Visualization"]')
.click()
.then(function findVizByLinkedText() {
common.debug('Load Saved Vis button clicked');
return self.remote
.setFindTimeout(defaultTimeout)
.findByLinkText(vizName)
.click();
return this.clickLoadSavedVisButton()
.then(function filterVisualization() {
return self.openSavedVisualization(vizName);
});
},
// this is for starting on the
// bottom half of the "Create a new visualization Step 1" page
openSavedVisualization: function openSavedVisualization(vizName) {
var self = this;
return self.filterVisByName(vizName)
.then(function () {
return common.sleep(1000);
})
.then(function clickDashboardByLinkedText() {
return self.clickVisualizationByLinkText(vizName);
});
},
@ -384,7 +391,7 @@ define(function (require) {
** This method gets the chart data and scales it based on chart height and label.
** Returns an array of height values
*/
getAreaChartData: function getAreaChartData() {
getAreaChartData: function getAreaChartData(aggregateName) {
var self = this.remote;
var chartData = [];
@ -399,11 +406,11 @@ define(function (require) {
return this.remote
.setFindTimeout(defaultTimeout)
.findByCssSelector('div.y-axis-div-wrapper > div > svg > g > g:last-of-type')
.then(function setYAxisLabel(y) {
return y.getVisibleText();
})
.getVisibleText()
.then(function (yLabel) {
yAxisLabel = yLabel.replace(',', '');
// since we're going to use the y-axis 'last' (top) label as a number to
// scale the chart pixel data, we need to clean out commas and % marks.
yAxisLabel = yLabel.replace(/(%|,)/g, '');
common.debug('yAxisLabel = ' + yAxisLabel);
return yLabel;
})
@ -411,10 +418,8 @@ define(function (require) {
.then(function () {
return self
.setFindTimeout(defaultTimeout)
.findByCssSelector('rect.background'); // different here
})
.then(function (chartAreaObj) {
return chartAreaObj.getAttribute('height');
.findByCssSelector('rect.background') // different here
.getAttribute('height');
})
.then(function (chartH) {
yAxisHeight = chartH;
@ -422,43 +427,29 @@ define(function (require) {
})
.then(function () {
return self.setFindTimeout(defaultTimeout * 2)
.findAllByCssSelector('path')
.then(function (chartTypes) {
function getChartType(chart) {
return chart
.getAttribute('data-label')
.then(function (chartString) {
//common.debug('data-label = ' + chartString);
if (chartString === 'Count') {
return chart.getAttribute('d')
.then(function (data) {
common.debug(data);
tempArray = data.split('L');
chartSections = tempArray.length / 2;
common.debug('chartSections = ' + chartSections + ' height = ' + yAxisHeight + ' yAxisLabel = ' + yAxisLabel);
chartData[0] = Math.round((yAxisHeight - tempArray[0].split(',')[1]) / yAxisHeight * yAxisLabel);
common.debug('chartData[0] =' + chartData[0]);
for (var i = 1; i < chartSections; i++) {
chartData[i] = Math.round((yAxisHeight - tempArray[i].split(',')[1]) / yAxisHeight * yAxisLabel);
common.debug('chartData[i] =' + chartData[i]);
}
return chartData;
});
}
});
}
var getChartTypesPromises = chartTypes.map(getChartType);
return Promise.all(getChartTypesPromises);
});
.findByCssSelector('path[data-label="' + aggregateName + '"]')
.getAttribute('d');
})
.then(function (chartData) {
return chartData[1]; // MAGIC NUMBER - we find multiple 'path's and only one of them is the right one.
.then(function (data) {
common.debug(data);
// This area chart data starts with a 'M'ove to a x,y location, followed
// by a bunch of 'L'ines from that point to the next. Those points are
// the values we're going to use to calculate the data values we're testing.
// So git rid of the one 'M' and split the rest on the 'L's.
tempArray = data.replace('M','').split('L');
chartSections = tempArray.length / 2;
common.debug('chartSections = ' + chartSections + ' height = ' + yAxisHeight + ' yAxisLabel = ' + yAxisLabel);
for (var i = 0; i < chartSections; i++) {
chartData[i] = Math.round((yAxisHeight - tempArray[i].split(',')[1]) / yAxisHeight * yAxisLabel);
common.debug('chartData[i] =' + chartData[i]);
}
return chartData;
});
},
// The current test shows dots, not a line. This function gets the dots and normalizes their height.
getLineChartData: function getLineChartData() {
getLineChartData: function getLineChartData(cssPart) {
var self = this.remote;
var yAxisLabel = 0;
var yAxisHeight;
@ -467,10 +458,7 @@ define(function (require) {
return this.remote
.setFindTimeout(defaultTimeout)
.findByCssSelector('div.y-axis-div-wrapper > div > svg > g > g:last-of-type')
.then(function setYAxisLabel(y) {
return y
.getVisibleText();
})
.getVisibleText()
.then(function (yLabel) {
yAxisLabel = yLabel.replace(',', '');
common.debug('yAxisLabel = ' + yAxisLabel);
@ -481,10 +469,7 @@ define(function (require) {
return self
.setFindTimeout(defaultTimeout)
.findByCssSelector('clipPath rect')
.then(function getRectHeight(chartAreaObj) {
return chartAreaObj
.getAttribute('height');
})
.getAttribute('height')
.then(function (theHeight) {
yAxisHeight = theHeight - 5; // MAGIC NUMBER - clipPath extends a bit above the top of the y-axis and below x-axis
common.debug('theHeight = ' + theHeight);
@ -635,6 +620,13 @@ define(function (require) {
.getVisibleText();
},
getMarkdownData: function getMarkdownData() {
return this.remote
.setFindTimeout(defaultTimeout)
.findByCssSelector('visualize.ng-isolate-scope')
.getVisibleText();
},
clickColumns: function clickColumns() {
return this.remote
.setFindTimeout(defaultTimeout)