mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge branch 'master' into issue4366
This commit is contained in:
commit
95114865b9
38 changed files with 3665 additions and 3363 deletions
36
.github/ISSUE_TEMPLATE.md
vendored
Normal file
36
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
<!--
|
||||
GitHub is reserved for bug reports and feature requests. The best place
|
||||
to ask a general question is at the Elastic Discourse forums at
|
||||
https://discuss.elastic.co. If you are in fact posting a bug report or
|
||||
a feature request, please include one and only one of the below blocks
|
||||
in your new issue.
|
||||
-->
|
||||
|
||||
<!--
|
||||
If you are filing a bug report, please remove the below feature
|
||||
request block and provide responses for all of the below items.
|
||||
-->
|
||||
|
||||
**Kibana version**:
|
||||
|
||||
**OS version**:
|
||||
|
||||
**Original install method (e.g. download page, yum, from source, etc.)**:
|
||||
|
||||
**Description of the problem including expected versus actual behavior**:
|
||||
|
||||
**Steps to reproduce**:
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
**Errors in browser console (if relevant)**:
|
||||
|
||||
**Provide logs and/or server output (if relevant)**:
|
||||
|
||||
<!--
|
||||
If you are filing a feature request, please remove the above bug
|
||||
report block and provide responses for all of the below items.
|
||||
-->
|
||||
|
||||
**Describe the feature**:
|
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!--
|
||||
Thank you for your interest in and contributing to Kibana! There
|
||||
are a few simple things to check before submitting your pull request
|
||||
that can help with the review process. You should delete these items
|
||||
from your submission, but they are here to help bring them to your
|
||||
attention.
|
||||
-->
|
||||
|
||||
- Have you signed the [contributor license agreement](https://www.elastic.co/contributor-agreement)?
|
||||
- Have you followed the [contributor guidelines](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md)?
|
||||
- If submitting code, have you included unit tests that cover the changes?
|
||||
- If submitting code, have you tested and built your code locally prior to submission with `npm test && npm run build`?
|
||||
- If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed.
|
822
STYLEGUIDE.md
822
STYLEGUIDE.md
|
@ -1,767 +1,9 @@
|
|||
This is a collection of style guides for Kibana projects. The include guides for the following:
|
||||
|
||||
- [JavaScript](#javascript-style-guide)
|
||||
- [Kibana Project](#kibana-style-guide)
|
||||
- [Html](#html-style-guide)
|
||||
|
||||
# JavaScript Style Guide
|
||||
|
||||
## 2 Spaces for indention
|
||||
|
||||
Use 2 spaces for indenting your code and swear an oath to never mix tabs and
|
||||
spaces - a special kind of hell is awaiting you otherwise.
|
||||
|
||||
## Newlines
|
||||
|
||||
Use UNIX-style newlines (`\n`), and a newline character as the last character
|
||||
of a file. Windows-style newlines (`\r\n`) are forbidden inside any repository.
|
||||
|
||||
## No trailing whitespace
|
||||
|
||||
Just like you brush your teeth after every meal, you clean up any trailing
|
||||
whitespace in your JS files before committing. Otherwise the rotten smell of
|
||||
careless neglect will eventually drive away contributors and/or co-workers.
|
||||
|
||||
## Use Semicolons
|
||||
|
||||
According to [scientific research][hnsemicolons], the usage of semicolons is
|
||||
a core value of our community. Consider the points of [the opposition][], but
|
||||
be a traditionalist when it comes to abusing error correction mechanisms for
|
||||
cheap syntactic pleasures.
|
||||
|
||||
[the opposition]: http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding
|
||||
[hnsemicolons]: http://news.ycombinator.com/item?id=1547647
|
||||
|
||||
## 120 characters per line
|
||||
|
||||
Try to limit your lines to 80 characters. If it feels right, you can go up to 120 characters.
|
||||
|
||||
## Use single quotes
|
||||
|
||||
Use single quotes, unless you are writing JSON.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var foo = 'bar';
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var foo = "bar";
|
||||
```
|
||||
|
||||
## Opening braces go on the same line
|
||||
|
||||
Your opening braces go on the same line as the statement.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
if (true) {
|
||||
console.log('winning');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (true)
|
||||
{
|
||||
console.log('losing');
|
||||
}
|
||||
```
|
||||
|
||||
Also, notice the use of whitespace before and after the condition statement.
|
||||
|
||||
## Always use braces for multi-line code
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (err)
|
||||
return cb(err);
|
||||
```
|
||||
|
||||
## Prefer multi-line conditionals
|
||||
|
||||
But single-line conditionals are allowed for short lines
|
||||
|
||||
*Preferred:*
|
||||
|
||||
```js
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
```
|
||||
|
||||
*Allowed:*
|
||||
|
||||
```js
|
||||
if (err) return cb(err);
|
||||
```
|
||||
|
||||
## Declare one variable per var statement
|
||||
|
||||
Declare one variable per var statement, it makes it easier to re-order the
|
||||
lines. However, ignore [Crockford][crockfordconvention] when it comes to
|
||||
declaring variables deeper inside a function, just put the declarations wherever
|
||||
they make sense.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var keys = ['foo', 'bar'];
|
||||
var values = [23, 42];
|
||||
|
||||
var object = {};
|
||||
while (keys.length) {
|
||||
var key = keys.pop();
|
||||
object[key] = values.pop();
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var keys = ['foo', 'bar'],
|
||||
values = [23, 42],
|
||||
object = {},
|
||||
key;
|
||||
|
||||
while (keys.length) {
|
||||
key = keys.pop();
|
||||
object[key] = values.pop();
|
||||
}
|
||||
```
|
||||
|
||||
[crockfordconvention]: http://javascript.crockford.com/code.html
|
||||
|
||||
## Use lowerCamelCase for variables, properties and function names
|
||||
|
||||
Variables, properties and function names should use `lowerCamelCase`. They
|
||||
should also be descriptive. Single character variables and uncommon
|
||||
abbreviations should generally be avoided.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var adminUser = db.query('SELECT * FROM users ...');
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var admin_user = db.query('SELECT * FROM users ...');
|
||||
```
|
||||
|
||||
## Use UpperCamelCase for class names
|
||||
|
||||
Class names should be capitalized using `UpperCamelCase`.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
function BankAccount() {
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
function bank_Account() {
|
||||
}
|
||||
```
|
||||
|
||||
## Use UPPERCASE for Constants
|
||||
|
||||
Constants should be declared as regular variables or static class properties,
|
||||
using all uppercase letters.
|
||||
|
||||
Node.js / V8 actually supports mozilla's [const][const] extension, but
|
||||
unfortunately that cannot be applied to class members, nor is it part of any
|
||||
ECMA standard.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var SECOND = 1 * 1000;
|
||||
|
||||
function File() {
|
||||
}
|
||||
File.FULL_PERMISSIONS = 0777;
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
const SECOND = 1 * 1000;
|
||||
|
||||
function File() {
|
||||
}
|
||||
File.fullPermissions = 0777;
|
||||
```
|
||||
|
||||
[const]: https://developer.mozilla.org/en/JavaScript/Reference/Statements/const
|
||||
|
||||
## Magic numbers
|
||||
|
||||
These are numbers (or other values) simply used in line in your code. **Do not use these**, give them a variable name so they can be understood and changed easily.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var minWidth = 300;
|
||||
|
||||
if (width < minWidth) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (width < 300) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Global definitions
|
||||
|
||||
Don't do this. Everything should be wrapped in a module that can be depended on by other modules. Even things as simple as a single value should be a module.
|
||||
|
||||
## Function definitions
|
||||
|
||||
Prefer the use of function declarations over function expressions. Function expressions are allowed, but should usually be avoided.
|
||||
|
||||
Also, keep function definitions above other code instead of relying on function hoisting.
|
||||
|
||||
*Preferred:*
|
||||
|
||||
```js
|
||||
function myFunc() {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
*Allowed:*
|
||||
|
||||
```js
|
||||
var myFunc = function () {
|
||||
...
|
||||
};
|
||||
```
|
||||
|
||||
## Object / Array creation
|
||||
|
||||
Use trailing commas and put *short* declarations on a single line. Only quote
|
||||
keys when your interpreter complains:
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var a = ['hello', 'world'];
|
||||
var b = {
|
||||
good: 'code',
|
||||
'is generally': 'pretty'
|
||||
};
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var a = [
|
||||
'hello', 'world'
|
||||
];
|
||||
var b = {"good": 'code'
|
||||
, is generally: 'pretty'
|
||||
};
|
||||
```
|
||||
|
||||
## Object / Array iterations, transformations and operations
|
||||
|
||||
Use native ES5 methods to iterate and transform arrays and objects where possible. Do not use `for` and `while` loops.
|
||||
|
||||
Use descriptive variable names in the closures.
|
||||
|
||||
Use a utility library as needed and where it will make code more comprehensible.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var userNames = users.map(function (user) {
|
||||
return user.name;
|
||||
});
|
||||
|
||||
// examples where lodash makes the code more readable
|
||||
var userNames = _.pluck(users, 'name');
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var userNames = [];
|
||||
for (var i = 0; i < users.length; i++) {
|
||||
userNames.push(users[i].name);
|
||||
}
|
||||
```
|
||||
|
||||
## Use the === operator
|
||||
|
||||
Programming is not about remembering [stupid rules][comparisonoperators]. Use
|
||||
the triple equality operator as it will work just as expected.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var a = 0;
|
||||
if (a !== '') {
|
||||
console.log('winning');
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var a = 0;
|
||||
if (a == '') {
|
||||
console.log('losing');
|
||||
}
|
||||
```
|
||||
|
||||
[comparisonoperators]: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Comparison_Operators
|
||||
|
||||
## Only use ternary operators for small, simple code
|
||||
|
||||
And **never** use multiple ternaries together
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var foo = (a === b) ? 1 : 2;
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var foo = (a === b) ? 1 : (a === c) ? 2 : 3;
|
||||
```
|
||||
|
||||
## Do not extend built-in prototypes
|
||||
|
||||
Do not extend the prototype of native JavaScript objects. Your future self will
|
||||
be forever grateful.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var a = [];
|
||||
if (!a.length) {
|
||||
console.log('winning');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
Array.prototype.empty = function() {
|
||||
return !this.length;
|
||||
}
|
||||
|
||||
var a = [];
|
||||
if (a.empty()) {
|
||||
console.log('losing');
|
||||
}
|
||||
```
|
||||
|
||||
## Use descriptive conditions
|
||||
|
||||
Any non-trivial conditions should be assigned to a descriptively named variables, broken into
|
||||
several names variables, or converted to be a function:
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var thing = ...;
|
||||
var isShape = thing instanceof Shape;
|
||||
var notSquare = !(thing instanceof Square);
|
||||
var largerThan10 = isShape && thing.size > 10;
|
||||
|
||||
if (isShape && notSquare && largerThan10) {
|
||||
console.log('some big polygon');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (
|
||||
thing instanceof Shape
|
||||
&& !(thing instanceof Square)
|
||||
&& thing.size > 10
|
||||
) {
|
||||
console.log('bigger than ten?? Woah!');
|
||||
}
|
||||
```
|
||||
|
||||
## Name regular expressions
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var validPasswordRE = /^(?=.*\d).{4,}$/;
|
||||
|
||||
if (password.length >= 4 && validPasswordRE.test(password)) {
|
||||
console.log('password is valid');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (password.length >= 4 && /^(?=.*\d).{4,}$/.test(password)) {
|
||||
console.log('losing');
|
||||
}
|
||||
```
|
||||
|
||||
## Write small functions
|
||||
|
||||
Keep your functions short. A good function fits on a slide that the people in
|
||||
the last row of a big room can comfortably read. So don't count on them having
|
||||
perfect vision and limit yourself to ~15 lines of code per function.
|
||||
|
||||
## Return early from functions
|
||||
|
||||
To avoid deep nesting of if-statements, always return a function's value as early
|
||||
as possible.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
function isPercentage(val) {
|
||||
if (val < 0) return false;
|
||||
if (val > 100) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
function isPercentage(val) {
|
||||
if (val >= 0) {
|
||||
if (val < 100) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or for this particular example it may also be fine to shorten things even
|
||||
further:
|
||||
|
||||
```js
|
||||
function isPercentage(val) {
|
||||
var isInRange = (val >= 0 && val <= 100);
|
||||
return isInRange;
|
||||
}
|
||||
```
|
||||
|
||||
## Chaining operations
|
||||
|
||||
When using a chaining syntax (jquery or promises, for example), do not indent the subsequent chained operations, unless there is a logical grouping in them.
|
||||
|
||||
Also, if the chain is long, each method should be on a new line.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
$('.someClass')
|
||||
.addClass('another-class')
|
||||
.append(someElement)
|
||||
```
|
||||
|
||||
```js
|
||||
d3.selectAll('g.bar')
|
||||
.enter()
|
||||
.append('thing')
|
||||
.data(anything)
|
||||
.exit()
|
||||
.each(function() ... )
|
||||
```
|
||||
|
||||
```js
|
||||
$http.get('/info')
|
||||
.then(({ data }) => this.transfromInfo(data))
|
||||
.then((transformed) => $http.post('/new-info', transformed))
|
||||
.then(({ data }) => console.log(data));
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
$('.someClass')
|
||||
.addClass('another-class')
|
||||
.append(someElement)
|
||||
```
|
||||
|
||||
```js
|
||||
d3.selectAll('g.bar')
|
||||
.enter().append('thing').data(anything).exit()
|
||||
.each(function() ... )
|
||||
```
|
||||
|
||||
```js
|
||||
$http.get('/info')
|
||||
.then(({ data }) => this.transfromInfo(data))
|
||||
.then((transformed) => $http.post('/new-info', transformed))
|
||||
.then(({ data }) => console.log(data));
|
||||
```
|
||||
|
||||
## Name your closures
|
||||
|
||||
Feel free to give your closures a descriptive name. It shows that you care about them, and
|
||||
will produce better stack traces, heap and cpu profiles.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
req.on('end', function onEnd() {
|
||||
console.log('winning');
|
||||
});
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
req.on('end', function() {
|
||||
console.log('losing');
|
||||
});
|
||||
```
|
||||
|
||||
## No nested closures
|
||||
|
||||
Use closures, but don't nest them. Otherwise your code will become a mess.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
setTimeout(function() {
|
||||
client.connect(afterConnect);
|
||||
}, 1000);
|
||||
|
||||
function afterConnect() {
|
||||
console.log('winning');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
setTimeout(function() {
|
||||
client.connect(function() {
|
||||
console.log('losing');
|
||||
});
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
## Use slashes for comments
|
||||
|
||||
Use slashes for both single line and multi line comments. Try to write
|
||||
comments that explain higher level mechanisms or clarify difficult
|
||||
segments of your code. **Don't use comments to restate trivial things**.
|
||||
|
||||
***Exception:*** Comment blocks describing a function and its arguments (docblock) should start with `/**`, contain a single `*` at the beginning of each line, and end with `*/`.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
// 'ID_SOMETHING=VALUE' -> ['ID_SOMETHING=VALUE', 'SOMETHING', 'VALUE']
|
||||
var matches = item.match(/ID_([^\n]+)=([^\n]+)/));
|
||||
|
||||
/**
|
||||
* Fetches a user from...
|
||||
* @param {string} id - id of the user
|
||||
* @return {Promise}
|
||||
*/
|
||||
function loadUser(id) {
|
||||
// This function has a nasty side effect where a failure to increment a
|
||||
// redis counter used for statistics will cause an exception. This needs
|
||||
// to be fixed in a later iteration.
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
var isSessionValid = (session.expires < Date.now());
|
||||
if (isSessionValid) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
// Execute a regex
|
||||
var matches = item.match(/ID_([^\n]+)=([^\n]+)/));
|
||||
|
||||
// Usage: loadUser(5, function() { ... })
|
||||
function loadUser(id, cb) {
|
||||
// ...
|
||||
}
|
||||
|
||||
// Check if the session is valid
|
||||
var isSessionValid = (session.expires < Date.now());
|
||||
// If the session is valid
|
||||
if (isSessionValid) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
## Do not comment out code
|
||||
|
||||
We use a version management system. If a line of code is no longer needed, remove it, don't simply comment it out.
|
||||
|
||||
## Classes/Constructors and Inheritance
|
||||
|
||||
While JavaScript it is not always considered an object-oriented language, it does have the building blocks for writing object oriented code. Of course, as with all things JavaScript, there are many ways this can be accomplished. Generally, we try to err on the side of readability.
|
||||
|
||||
### Capitalized function definition as Constructors
|
||||
|
||||
When Defining a Class/Constructor, use the function definition syntax.
|
||||
|
||||
*Right:*
|
||||
```js
|
||||
function ClassName() {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
```js
|
||||
var ClassName = function () {};
|
||||
```
|
||||
|
||||
### Inheritance should be done with a utility
|
||||
|
||||
While you can do it with pure JS, a utility will remove a lot of boilerplate, and be more readable and functional.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
// uses a lodash inherits mixin
|
||||
// inheritance is defined first - it's easier to read and the function will be hoisted
|
||||
_.class(Square).inherits(Shape);
|
||||
|
||||
function Square(width, height) {
|
||||
Square.Super.call(this);
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
function Square(width, height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
Square.prototype = Object.create(Shape);
|
||||
```
|
||||
|
||||
### Keep Constructors Small
|
||||
|
||||
It is often the case that there are properties that can't be defined on the prototype, or work that needs to be done to completely create an object (like call its Super class). This is all that should be done within constructors.
|
||||
|
||||
Try to follow the [Write small functions](#write-small-functions) rule here too.
|
||||
|
||||
### Use the prototype
|
||||
|
||||
If a method/property *can* go on the prototype, it probably should.
|
||||
|
||||
```js
|
||||
function Square() {
|
||||
...
|
||||
}
|
||||
|
||||
/**
|
||||
* method does stuff
|
||||
* @return {undefined}
|
||||
*/
|
||||
Square.prototype.method = function () {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Handling scope and aliasing `this`
|
||||
|
||||
When creating a prototyped class, each method should almost always start with:
|
||||
|
||||
`var self = this;`
|
||||
|
||||
With the exception of very short methods (roughly 3 lines or less), `self` should always be used in place of `this`.
|
||||
|
||||
Avoid the use of `bind`
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
Square.prototype.doFancyThings = function () {
|
||||
var self = this;
|
||||
|
||||
somePromiseUtil()
|
||||
.then(function (result) {
|
||||
self.prop = result.prop;
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
Square.prototype.doFancyThings = function () {
|
||||
somePromiseUtil()
|
||||
.then(function (result) {
|
||||
this.prop = result.prop;
|
||||
}).bind(this);
|
||||
}
|
||||
```
|
||||
|
||||
*Allowed:*
|
||||
|
||||
```js
|
||||
Square.prototype.area = function () {
|
||||
return this.width * this.height;
|
||||
}
|
||||
```
|
||||
|
||||
## Object.freeze, Object.preventExtensions, Object.seal, with, eval
|
||||
|
||||
Crazy shit that you will probably never need. Stay away from it.
|
||||
|
||||
## Getters and Setters
|
||||
|
||||
Feel free to use getters that are free from [side effects][sideeffect], like
|
||||
providing a length property for a collection class.
|
||||
|
||||
Do not use setters, they cause more problems for people who try to use your
|
||||
software than they can solve.
|
||||
|
||||
[sideeffect]: http://en.wikipedia.org/wiki/Side_effect_(computer_science)
|
||||
- [JavaScript](style_guides/js_style_guide.md)
|
||||
- [CSS](style_guides/css_style_guide.md)
|
||||
- [HTML](style_guides/html_style_guide.md)
|
||||
- [API](style_guides/api_style_guide.md)
|
||||
|
||||
# Kibana Style Guide
|
||||
|
||||
|
@ -866,59 +108,3 @@ require('ui/routes')
|
|||
// angular route code goes here
|
||||
});
|
||||
```
|
||||
|
||||
# Html Style Guide
|
||||
|
||||
## Multiple attribute values
|
||||
|
||||
When a node has multiple attributes that would cause it to exceed the line character limit, each attribute including the first should be on its own line with a single indent. Also, when a node that is styled in this way has child nodes, there should be a blank line between the opening parent tag and the first child tag.
|
||||
|
||||
```
|
||||
<ul
|
||||
attribute1="value1"
|
||||
attribute2="value2"
|
||||
attribute3="value3">
|
||||
|
||||
<li></li>
|
||||
<li></li>
|
||||
...
|
||||
</ul>
|
||||
```
|
||||
|
||||
# Api Style Guide
|
||||
|
||||
## Paths
|
||||
|
||||
API routes must start with the `/api/` path segment, and should be followed by the plugin id if applicable:
|
||||
|
||||
*Right:* `/api/marvel/v1/nodes`
|
||||
*Wrong:* `/marvel/api/v1/nodes`
|
||||
|
||||
## Versions
|
||||
|
||||
Kibana won't be supporting multiple API versions, so API's should not define a version.
|
||||
|
||||
*Right:* `/api/kibana/index_patterns`
|
||||
*Wrong:* `/api/kibana/v1/index_patterns`
|
||||
|
||||
## snake_case
|
||||
|
||||
Kibana uses `snake_case` for the entire API, just like Elasticsearch. All urls, paths, query string parameters, values, and bodies should be `snake_case` formatted.
|
||||
|
||||
*Right:*
|
||||
```
|
||||
POST /api/kibana/index_patterns
|
||||
{
|
||||
"id": "...",
|
||||
"time_field_name": "...",
|
||||
"fields": [
|
||||
...
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
# Attribution
|
||||
|
||||
This JavaScript guide forked from the [node style guide](https://github.com/felixge/node-style-guide) created by [Felix Geisendörfer](http://felixge.de/) and is
|
||||
licensed under the [CC BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/)
|
||||
license.
|
||||
|
|
|
@ -68,6 +68,9 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
|
|||
if (dash.timeRestore && dash.timeTo && dash.timeFrom && !getAppState.previouslyStored()) {
|
||||
timefilter.time.to = dash.timeTo;
|
||||
timefilter.time.from = dash.timeFrom;
|
||||
if (dash.refreshInterval) {
|
||||
timefilter.refreshInterval = dash.refreshInterval;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$on('$destroy', dash.destroy);
|
||||
|
@ -204,10 +207,12 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
|
|||
$state.title = dash.id = dash.title;
|
||||
$state.save();
|
||||
|
||||
const timeRestoreObj = _.pick(timefilter.refreshInterval, ['display', 'pause', 'section', 'value']);
|
||||
dash.panelsJSON = angular.toJson($state.panels);
|
||||
dash.uiStateJSON = angular.toJson($uiState.getChanges());
|
||||
dash.timeFrom = dash.timeRestore ? timefilter.time.from : undefined;
|
||||
dash.timeTo = dash.timeRestore ? timefilter.time.to : undefined;
|
||||
dash.refreshInterval = dash.timeRestore ? timeRestoreObj : undefined;
|
||||
dash.optionsJSON = angular.toJson($state.options);
|
||||
|
||||
dash.save()
|
||||
|
|
|
@ -33,6 +33,7 @@ module.factory('SavedDashboard', function (courier, config) {
|
|||
timeRestore: false,
|
||||
timeTo: undefined,
|
||||
timeFrom: undefined,
|
||||
refreshInterval: undefined
|
||||
},
|
||||
|
||||
// if an indexPattern was saved with the searchsource of a SavedDashboard
|
||||
|
@ -56,6 +57,15 @@ module.factory('SavedDashboard', function (courier, config) {
|
|||
timeRestore: 'boolean',
|
||||
timeTo: 'string',
|
||||
timeFrom: 'string',
|
||||
refreshInterval: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
display: {type: 'string'},
|
||||
pause: { type: 'boolean'},
|
||||
section: { type: 'integer'},
|
||||
value: { type: 'integer'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SavedDashboard.searchsource = true;
|
||||
|
|
|
@ -24,8 +24,11 @@ export default function setupSettings(kbnServer, server, config) {
|
|||
}
|
||||
|
||||
function userSettingsNotFound(kibanaVersion) {
|
||||
const message = 'Could not find user-provided settings for this version of Kibana (' + kibanaVersion + ')';
|
||||
server.plugins.kibana.status.red(message);
|
||||
if (server.plugins.elasticsearch.status.state === 'green') {
|
||||
server.plugins.kibana.status.red(`Could not find user-provided settings for this version of Kibana (${kibanaVersion})`);
|
||||
} else {
|
||||
server.log(['warning', 'settings'], 'User-provided settings were requested before the Kibana index was ready');
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
32
style_guides/api_style_guide.md
Normal file
32
style_guides/api_style_guide.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
# API Style Guide
|
||||
|
||||
## Paths
|
||||
|
||||
API routes must start with the `/api/` path segment, and should be followed by the plugin id if applicable:
|
||||
|
||||
*Right:* `/api/marvel/nodes`
|
||||
*Wrong:* `/marvel/api/nodes`
|
||||
|
||||
## Versions
|
||||
|
||||
Kibana won't be supporting multiple API versions, so API's should not define a version.
|
||||
|
||||
*Right:* `/api/kibana/index_patterns`
|
||||
*Wrong:* `/api/kibana/v1/index_patterns`
|
||||
|
||||
## snake_case
|
||||
|
||||
Kibana uses `snake_case` for the entire API, just like Elasticsearch. All urls, paths, query string parameters, values, and bodies should be `snake_case` formatted.
|
||||
|
||||
*Right:*
|
||||
```
|
||||
POST /api/kibana/index_patterns
|
||||
{
|
||||
"id": "...",
|
||||
"time_field_name": "...",
|
||||
"fields": [
|
||||
...
|
||||
]
|
||||
}
|
||||
```
|
360
style_guides/css_style_guide.md
Normal file
360
style_guides/css_style_guide.md
Normal file
|
@ -0,0 +1,360 @@
|
|||
|
||||
# CSS Style Guide
|
||||
|
||||
## Concepts
|
||||
|
||||
### Think in terms of components
|
||||
|
||||
Think in terms of everything as a component: a button, a footer with buttons in
|
||||
it, a list, a list item, the container around the list, the list title, etc.
|
||||
|
||||
Keep components as granular as possible.
|
||||
|
||||
Compose large, complex components out of smaller, simpler components.
|
||||
|
||||
### Introduce as little specificity as possible
|
||||
|
||||
Rules will need to overwrite other rules, and we can only do that via
|
||||
specificity. For that reason, it's important to avoid introducing specificity
|
||||
unless absolutely needed and that when we do so, we introduce as little as
|
||||
possible.
|
||||
|
||||
## Quick reference
|
||||
|
||||
Here are some examples of how to structure your styles. The
|
||||
rules that underly these examples are below.
|
||||
|
||||
```less
|
||||
.kbButton {
|
||||
padding: 5px;
|
||||
border: 1px solid black;
|
||||
|
||||
/**
|
||||
* 1. This button can appear in a "pressed" aka "pinned" state.
|
||||
*/
|
||||
&.is-button-pressed {
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2); /* 1 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Center icon and text vertically.
|
||||
*/
|
||||
.kbButton__icon,
|
||||
.kbButton__text {
|
||||
display: inline-block; /* 1 */
|
||||
vertical-align: middle; /* 1 */
|
||||
}
|
||||
|
||||
.kbButton__icon {
|
||||
color: gray;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.kbButton__text {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.kbButton--primary {
|
||||
border-color: blue;
|
||||
|
||||
// Introduce specificity to color the descendant component.
|
||||
.kbButton__icon,
|
||||
.kbButton__text {
|
||||
color: blue;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<button class="kbButton kbButton--primary">
|
||||
<div class="kbButton__icon">Submit</div>
|
||||
<div class="kbButton__text">Submit</div>
|
||||
</button>
|
||||
```
|
||||
|
||||
## Rules
|
||||
|
||||
### Use uniquely-named "base classes" to represent components
|
||||
|
||||
This component will be represented in the styles as a **base class**:
|
||||
|
||||
```less
|
||||
// We can use a namespace like "kb" to make sure we don't affect
|
||||
// other styles accidentally, especially when we're using a generic
|
||||
// name like "button".
|
||||
.kbButton {
|
||||
background-color: gray;
|
||||
color: black;
|
||||
border-radius: 4px;
|
||||
padding: 4px;
|
||||
}
|
||||
```
|
||||
|
||||
### Create "descendant classes" to represent child components which can't stand on their own
|
||||
|
||||
In this example, the text and the icon are very tightly coupled to the button
|
||||
component. They aren't supposed to be used outside of this component. So we
|
||||
can indicate this parent-child relationship with a double-underscore and by
|
||||
indenting the **descendant classes**.
|
||||
|
||||
```less
|
||||
.kbButton {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
.kbButton__icon {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.kbButton__text {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
font-weight: 300;
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<button class="kbButton">
|
||||
<div class="kbButton__icon fa fa-trophy"></div>
|
||||
<div class="kbButton__text">Winner</div>
|
||||
</button>
|
||||
```
|
||||
|
||||
### Think of deeply-nested child components as "subcomponents" instead of descendants
|
||||
|
||||
Some components can have subcomponents that have their own subcomponents, and so on.
|
||||
In this kind of situation, using the descendant class rule above, would get
|
||||
pretty hairy. Consider a table component:
|
||||
|
||||
```less
|
||||
// ======================== Bad! ========================
|
||||
// These styles are complex and the multiple double-underscores increases noise
|
||||
// without providing much useful information.
|
||||
.kbTable {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
.kbTable__body {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
.kbTable__body__row {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
.kbTable__body__row__cell {
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
In this situation, it's better to create separate subcomponent base classes
|
||||
in their own files. It's important to still name the classes in a way that
|
||||
indicates their relationship, by incorporating the name of the root base class.
|
||||
|
||||
```less
|
||||
// kbTable.less
|
||||
.kbTable {
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
```less
|
||||
// kbTableBody.less
|
||||
.kbTableBody {
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
```less
|
||||
// kbTableRow.less
|
||||
.kbTableRow {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
.kbTableRow__cell {
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
This is an example of how we can use files and class names to scale a component
|
||||
as it grows in complexity.
|
||||
|
||||
### Represent states with "state classes"
|
||||
|
||||
If a user interacts with a component, or a change in application state needs to
|
||||
be surfaced in the UI, then create **state classes**. These classes will be applied
|
||||
to components in response to these changes.
|
||||
|
||||
Notice that all states begin with a boolean keyword, typically "is-".
|
||||
|
||||
```less
|
||||
.kbButton {
|
||||
/* ... */
|
||||
|
||||
/**
|
||||
* 1. This button can appear in a "pressed" aka "pinned" state.
|
||||
*/
|
||||
&.is-button-pressed {
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2); /* 1 */
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Variations on a component are represented with "modifier classes"
|
||||
|
||||
If the UI calls for a component to change along a single axis of semantic
|
||||
meaning, create modifier classes. **Modifier classes** are different than states,
|
||||
in that they will not be applied to a component as a result of user interaction
|
||||
or a change in application state.
|
||||
|
||||
```less
|
||||
.kbButton {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
.kbButton--primary {
|
||||
color: white;
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
.kbButton--danger {
|
||||
color: white;
|
||||
background-color: red;
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<button class="kbButton kbButton--danger">
|
||||
Delete everything
|
||||
<button>
|
||||
```
|
||||
|
||||
### Don't use multiple modifier classes together
|
||||
|
||||
If the design calls for buttons that look like this:
|
||||
|
||||
```
|
||||
+------------+
|
||||
| |
|
||||
| Button |
|
||||
| |
|
||||
+------------+
|
||||
+------------+
|
||||
| |
|
||||
| BUTTON |
|
||||
| |
|
||||
+------------+
|
||||
```
|
||||
|
||||
It might be tempting to create modifiers that can be combined, like this:
|
||||
|
||||
```less
|
||||
// ======================== Bad! ========================
|
||||
.kbButton--large {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.kbButton--loud {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<button class="kbButton kbButton--large">
|
||||
Button
|
||||
</button>
|
||||
<button class="kbButton kbButton--large kbButton--loud">
|
||||
Button
|
||||
</button>
|
||||
```
|
||||
|
||||
Down this path lies trouble. Each class loses its semantic meaning and essentially
|
||||
becomes an inline style. So usually trying to use multiple modifier classes
|
||||
together is a _code smell_.
|
||||
|
||||
Instead of this, it's important to **talk with the designer** and assign a semantic
|
||||
name to each of these types of buttons, which can then be reflected with
|
||||
unique base or modifier classes. Discussing use cases and defining the role of
|
||||
the component is a good way to approach this conversation.
|
||||
|
||||
```
|
||||
+---------------------+
|
||||
| |
|
||||
| Call-out button |
|
||||
| |
|
||||
+---------------------+
|
||||
+-----------------------------+
|
||||
| |
|
||||
| PRIMARY CALL-OUT BUTTON |
|
||||
| |
|
||||
+-----------------------------+
|
||||
```
|
||||
|
||||
```less
|
||||
// This button is used for calls-to-action, e.g. "Sign up for our newsletter".
|
||||
// Generally, no more than one will ever appear on a given page.
|
||||
.kbCallOutButton {
|
||||
background-color: gray;
|
||||
color: black;
|
||||
border-radius: 4px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.kbCallOutButton--primary {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<button class="kbCallOutButton">
|
||||
Call-out button
|
||||
</button>
|
||||
<button class="kbCallOutButton kbCallOutButton--primary">
|
||||
Primary call-out button
|
||||
</button>
|
||||
```
|
||||
|
||||
### How to apply DRY
|
||||
|
||||
The above example might look counter-DRY to you, since the kbButton and
|
||||
kbCallOutButton have so many common properties.
|
||||
|
||||
In general, it's more important to keep styles tightly-scoped to clearly-defined
|
||||
components (which increases readability and maintainabilty) than it is to keep
|
||||
them DRY.
|
||||
|
||||
But if you really think there is a compelling reason to deduplicate code, then
|
||||
try using a mixin.
|
||||
|
||||
```less
|
||||
// Use the suffix "mixin" to avoid confusing this with a base class.
|
||||
.kbButtonMixin {
|
||||
background-color: gray;
|
||||
color: black;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.kbButton {
|
||||
&:extend(.kbButtonMixin all);
|
||||
}
|
||||
|
||||
.kbCallOutButton {
|
||||
&:extend(.kbButtonMixin all);
|
||||
}
|
||||
```
|
||||
|
||||
#### Compelling reasons for using mixins
|
||||
|
||||
A super-compelling reason to use mixins is if you see that a set of different
|
||||
components have a set of the same rules applied to all of them, and that it's
|
||||
likely that any change made to one of them will have to made to the rest, too
|
||||
(it might be a good idea to double-check this with the designer).
|
||||
|
||||
In this case, a mixin can be very useful because then you only need to make the
|
||||
change in one place. Consider the above `kbButtonMixin` example. Now if the
|
||||
border-radius changes for all buttons, you only need to change it there. Or if
|
||||
the designers anticipate that all new types of buttons should have the same
|
||||
border-radius, then you can just extend this mixin when you create a new button
|
||||
base class.
|
18
style_guides/html_style_guide.md
Normal file
18
style_guides/html_style_guide.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
# HTML Style Guide
|
||||
|
||||
## Multiple attribute values
|
||||
|
||||
When a node has multiple attributes that would cause it to exceed the 80-character line limit, each attribute including the first should be on its own line with a single indent. Also, when a node that is styled in this way has child nodes, there should be a blank line between the opening parent tag and the first child tag.
|
||||
|
||||
```
|
||||
<ul
|
||||
attribute1="value1"
|
||||
attribute2="value2"
|
||||
attribute3="value3">
|
||||
|
||||
<li></li>
|
||||
<li></li>
|
||||
...
|
||||
</ul>
|
||||
```
|
765
style_guides/js_style_guide.md
Normal file
765
style_guides/js_style_guide.md
Normal file
|
@ -0,0 +1,765 @@
|
|||
|
||||
# JavaScript Style Guide
|
||||
|
||||
## Attribution
|
||||
|
||||
This JavaScript guide forked from the [node style guide](https://github.com/felixge/node-style-guide) created by [Felix Geisendörfer](http://felixge.de/) and is
|
||||
licensed under the [CC BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/)
|
||||
license.
|
||||
|
||||
## 2 Spaces for indention
|
||||
|
||||
Use 2 spaces for indenting your code and swear an oath to never mix tabs and
|
||||
spaces - a special kind of hell is awaiting you otherwise.
|
||||
|
||||
## Newlines
|
||||
|
||||
Use UNIX-style newlines (`\n`), and a newline character as the last character
|
||||
of a file. Windows-style newlines (`\r\n`) are forbidden inside any repository.
|
||||
|
||||
## No trailing whitespace
|
||||
|
||||
Just like you brush your teeth after every meal, you clean up any trailing
|
||||
whitespace in your JS files before committing. Otherwise the rotten smell of
|
||||
careless neglect will eventually drive away contributors and/or co-workers.
|
||||
|
||||
## Use Semicolons
|
||||
|
||||
According to [scientific research][hnsemicolons], the usage of semicolons is
|
||||
a core value of our community. Consider the points of [the opposition][], but
|
||||
be a traditionalist when it comes to abusing error correction mechanisms for
|
||||
cheap syntactic pleasures.
|
||||
|
||||
[the opposition]: http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding
|
||||
[hnsemicolons]: http://news.ycombinator.com/item?id=1547647
|
||||
|
||||
## 120 characters per line
|
||||
|
||||
Try to limit your lines to 80 characters. If it feels right, you can go up to 120 characters.
|
||||
|
||||
## Use single quotes
|
||||
|
||||
Use single quotes, unless you are writing JSON.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var foo = 'bar';
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var foo = "bar";
|
||||
```
|
||||
|
||||
## Opening braces go on the same line
|
||||
|
||||
Your opening braces go on the same line as the statement.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
if (true) {
|
||||
console.log('winning');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (true)
|
||||
{
|
||||
console.log('losing');
|
||||
}
|
||||
```
|
||||
|
||||
Also, notice the use of whitespace before and after the condition statement.
|
||||
|
||||
## Always use braces for multi-line code
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (err)
|
||||
return cb(err);
|
||||
```
|
||||
|
||||
## Prefer multi-line conditionals
|
||||
|
||||
But single-line conditionals are allowed for short lines
|
||||
|
||||
*Preferred:*
|
||||
|
||||
```js
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
```
|
||||
|
||||
*Allowed:*
|
||||
|
||||
```js
|
||||
if (err) return cb(err);
|
||||
```
|
||||
|
||||
## Declare one variable per var statement
|
||||
|
||||
Declare one variable per var statement, it makes it easier to re-order the
|
||||
lines. However, ignore [Crockford][crockfordconvention] when it comes to
|
||||
declaring variables deeper inside a function, just put the declarations wherever
|
||||
they make sense.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var keys = ['foo', 'bar'];
|
||||
var values = [23, 42];
|
||||
|
||||
var object = {};
|
||||
while (keys.length) {
|
||||
var key = keys.pop();
|
||||
object[key] = values.pop();
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var keys = ['foo', 'bar'],
|
||||
values = [23, 42],
|
||||
object = {},
|
||||
key;
|
||||
|
||||
while (keys.length) {
|
||||
key = keys.pop();
|
||||
object[key] = values.pop();
|
||||
}
|
||||
```
|
||||
|
||||
[crockfordconvention]: http://javascript.crockford.com/code.html
|
||||
|
||||
## Use lowerCamelCase for variables, properties and function names
|
||||
|
||||
Variables, properties and function names should use `lowerCamelCase`. They
|
||||
should also be descriptive. Single character variables and uncommon
|
||||
abbreviations should generally be avoided.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var adminUser = db.query('SELECT * FROM users ...');
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var admin_user = db.query('SELECT * FROM users ...');
|
||||
```
|
||||
|
||||
## Use UpperCamelCase for class names
|
||||
|
||||
Class names should be capitalized using `UpperCamelCase`.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
function BankAccount() {
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
function bank_Account() {
|
||||
}
|
||||
```
|
||||
|
||||
## Use UPPERCASE for Constants
|
||||
|
||||
Constants should be declared as regular variables or static class properties,
|
||||
using all uppercase letters.
|
||||
|
||||
Node.js / V8 actually supports mozilla's [const][const] extension, but
|
||||
unfortunately that cannot be applied to class members, nor is it part of any
|
||||
ECMA standard.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var SECOND = 1 * 1000;
|
||||
|
||||
function File() {
|
||||
}
|
||||
File.FULL_PERMISSIONS = 0777;
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
const SECOND = 1 * 1000;
|
||||
|
||||
function File() {
|
||||
}
|
||||
File.fullPermissions = 0777;
|
||||
```
|
||||
|
||||
[const]: https://developer.mozilla.org/en/JavaScript/Reference/Statements/const
|
||||
|
||||
## Magic numbers
|
||||
|
||||
These are numbers (or other values) simply used in line in your code. **Do not use these**, give them a variable name so they can be understood and changed easily.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var minWidth = 300;
|
||||
|
||||
if (width < minWidth) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (width < 300) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Global definitions
|
||||
|
||||
Don't do this. Everything should be wrapped in a module that can be depended on by other modules. Even things as simple as a single value should be a module.
|
||||
|
||||
## Function definitions
|
||||
|
||||
Prefer the use of function declarations over function expressions. Function expressions are allowed, but should usually be avoided.
|
||||
|
||||
Also, keep function definitions above other code instead of relying on function hoisting.
|
||||
|
||||
*Preferred:*
|
||||
|
||||
```js
|
||||
function myFunc() {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
*Allowed:*
|
||||
|
||||
```js
|
||||
var myFunc = function () {
|
||||
...
|
||||
};
|
||||
```
|
||||
|
||||
## Object / Array creation
|
||||
|
||||
Use trailing commas and put *short* declarations on a single line. Only quote
|
||||
keys when your interpreter complains:
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var a = ['hello', 'world'];
|
||||
var b = {
|
||||
good: 'code',
|
||||
'is generally': 'pretty'
|
||||
};
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var a = [
|
||||
'hello', 'world'
|
||||
];
|
||||
var b = {"good": 'code'
|
||||
, is generally: 'pretty'
|
||||
};
|
||||
```
|
||||
|
||||
## Object / Array iterations, transformations and operations
|
||||
|
||||
Use native ES5 methods to iterate and transform arrays and objects where possible. Do not use `for` and `while` loops.
|
||||
|
||||
Use descriptive variable names in the closures.
|
||||
|
||||
Use a utility library as needed and where it will make code more comprehensible.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var userNames = users.map(function (user) {
|
||||
return user.name;
|
||||
});
|
||||
|
||||
// examples where lodash makes the code more readable
|
||||
var userNames = _.pluck(users, 'name');
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var userNames = [];
|
||||
for (var i = 0; i < users.length; i++) {
|
||||
userNames.push(users[i].name);
|
||||
}
|
||||
```
|
||||
|
||||
## Use the === operator
|
||||
|
||||
Programming is not about remembering [stupid rules][comparisonoperators]. Use
|
||||
the triple equality operator as it will work just as expected.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var a = 0;
|
||||
if (a !== '') {
|
||||
console.log('winning');
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var a = 0;
|
||||
if (a == '') {
|
||||
console.log('losing');
|
||||
}
|
||||
```
|
||||
|
||||
[comparisonoperators]: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Comparison_Operators
|
||||
|
||||
## Only use ternary operators for small, simple code
|
||||
|
||||
And **never** use multiple ternaries together
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var foo = (a === b) ? 1 : 2;
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
var foo = (a === b) ? 1 : (a === c) ? 2 : 3;
|
||||
```
|
||||
|
||||
## Do not extend built-in prototypes
|
||||
|
||||
Do not extend the prototype of native JavaScript objects. Your future self will
|
||||
be forever grateful.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var a = [];
|
||||
if (!a.length) {
|
||||
console.log('winning');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
Array.prototype.empty = function() {
|
||||
return !this.length;
|
||||
}
|
||||
|
||||
var a = [];
|
||||
if (a.empty()) {
|
||||
console.log('losing');
|
||||
}
|
||||
```
|
||||
|
||||
## Use descriptive conditions
|
||||
|
||||
Any non-trivial conditions should be assigned to a descriptively named variables, broken into
|
||||
several names variables, or converted to be a function:
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var thing = ...;
|
||||
var isShape = thing instanceof Shape;
|
||||
var notSquare = !(thing instanceof Square);
|
||||
var largerThan10 = isShape && thing.size > 10;
|
||||
|
||||
if (isShape && notSquare && largerThan10) {
|
||||
console.log('some big polygon');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (
|
||||
thing instanceof Shape
|
||||
&& !(thing instanceof Square)
|
||||
&& thing.size > 10
|
||||
) {
|
||||
console.log('bigger than ten?? Woah!');
|
||||
}
|
||||
```
|
||||
|
||||
## Name regular expressions
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
var validPasswordRE = /^(?=.*\d).{4,}$/;
|
||||
|
||||
if (password.length >= 4 && validPasswordRE.test(password)) {
|
||||
console.log('password is valid');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
if (password.length >= 4 && /^(?=.*\d).{4,}$/.test(password)) {
|
||||
console.log('losing');
|
||||
}
|
||||
```
|
||||
|
||||
## Write small functions
|
||||
|
||||
Keep your functions short. A good function fits on a slide that the people in
|
||||
the last row of a big room can comfortably read. So don't count on them having
|
||||
perfect vision and limit yourself to ~15 lines of code per function.
|
||||
|
||||
## Return early from functions
|
||||
|
||||
To avoid deep nesting of if-statements, always return a function's value as early
|
||||
as possible.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
function isPercentage(val) {
|
||||
if (val < 0) return false;
|
||||
if (val > 100) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
function isPercentage(val) {
|
||||
if (val >= 0) {
|
||||
if (val < 100) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or for this particular example it may also be fine to shorten things even
|
||||
further:
|
||||
|
||||
```js
|
||||
function isPercentage(val) {
|
||||
var isInRange = (val >= 0 && val <= 100);
|
||||
return isInRange;
|
||||
}
|
||||
```
|
||||
|
||||
## Chaining operations
|
||||
|
||||
When using a chaining syntax (jquery or promises, for example), do not indent the subsequent chained operations, unless there is a logical grouping in them.
|
||||
|
||||
Also, if the chain is long, each method should be on a new line.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
$('.someClass')
|
||||
.addClass('another-class')
|
||||
.append(someElement)
|
||||
```
|
||||
|
||||
```js
|
||||
d3.selectAll('g.bar')
|
||||
.enter()
|
||||
.append('thing')
|
||||
.data(anything)
|
||||
.exit()
|
||||
.each(function() ... )
|
||||
```
|
||||
|
||||
```js
|
||||
$http.get('/info')
|
||||
.then(({ data }) => this.transfromInfo(data))
|
||||
.then((transformed) => $http.post('/new-info', transformed))
|
||||
.then(({ data }) => console.log(data));
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
$('.someClass')
|
||||
.addClass('another-class')
|
||||
.append(someElement)
|
||||
```
|
||||
|
||||
```js
|
||||
d3.selectAll('g.bar')
|
||||
.enter().append('thing').data(anything).exit()
|
||||
.each(function() ... )
|
||||
```
|
||||
|
||||
```js
|
||||
$http.get('/info')
|
||||
.then(({ data }) => this.transfromInfo(data))
|
||||
.then((transformed) => $http.post('/new-info', transformed))
|
||||
.then(({ data }) => console.log(data));
|
||||
```
|
||||
|
||||
## Name your closures
|
||||
|
||||
Feel free to give your closures a descriptive name. It shows that you care about them, and
|
||||
will produce better stack traces, heap and cpu profiles.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
req.on('end', function onEnd() {
|
||||
console.log('winning');
|
||||
});
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
req.on('end', function() {
|
||||
console.log('losing');
|
||||
});
|
||||
```
|
||||
|
||||
## No nested closures
|
||||
|
||||
Use closures, but don't nest them. Otherwise your code will become a mess.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
setTimeout(function() {
|
||||
client.connect(afterConnect);
|
||||
}, 1000);
|
||||
|
||||
function afterConnect() {
|
||||
console.log('winning');
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
setTimeout(function() {
|
||||
client.connect(function() {
|
||||
console.log('losing');
|
||||
});
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
## Use slashes for comments
|
||||
|
||||
Use slashes for both single line and multi line comments. Try to write
|
||||
comments that explain higher level mechanisms or clarify difficult
|
||||
segments of your code. **Don't use comments to restate trivial things**.
|
||||
|
||||
***Exception:*** Comment blocks describing a function and its arguments (docblock) should start with `/**`, contain a single `*` at the beginning of each line, and end with `*/`.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
// 'ID_SOMETHING=VALUE' -> ['ID_SOMETHING=VALUE', 'SOMETHING', 'VALUE']
|
||||
var matches = item.match(/ID_([^\n]+)=([^\n]+)/));
|
||||
|
||||
/**
|
||||
* Fetches a user from...
|
||||
* @param {string} id - id of the user
|
||||
* @return {Promise}
|
||||
*/
|
||||
function loadUser(id) {
|
||||
// This function has a nasty side effect where a failure to increment a
|
||||
// redis counter used for statistics will cause an exception. This needs
|
||||
// to be fixed in a later iteration.
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
var isSessionValid = (session.expires < Date.now());
|
||||
if (isSessionValid) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
// Execute a regex
|
||||
var matches = item.match(/ID_([^\n]+)=([^\n]+)/));
|
||||
|
||||
// Usage: loadUser(5, function() { ... })
|
||||
function loadUser(id, cb) {
|
||||
// ...
|
||||
}
|
||||
|
||||
// Check if the session is valid
|
||||
var isSessionValid = (session.expires < Date.now());
|
||||
// If the session is valid
|
||||
if (isSessionValid) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
## Do not comment out code
|
||||
|
||||
We use a version management system. If a line of code is no longer needed, remove it, don't simply comment it out.
|
||||
|
||||
## Classes/Constructors and Inheritance
|
||||
|
||||
While JavaScript it is not always considered an object-oriented language, it does have the building blocks for writing object oriented code. Of course, as with all things JavaScript, there are many ways this can be accomplished. Generally, we try to err on the side of readability.
|
||||
|
||||
### Capitalized function definition as Constructors
|
||||
|
||||
When Defining a Class/Constructor, use the function definition syntax.
|
||||
|
||||
*Right:*
|
||||
```js
|
||||
function ClassName() {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
```js
|
||||
var ClassName = function () {};
|
||||
```
|
||||
|
||||
### Inheritance should be done with a utility
|
||||
|
||||
While you can do it with pure JS, a utility will remove a lot of boilerplate, and be more readable and functional.
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
// uses a lodash inherits mixin
|
||||
// inheritance is defined first - it's easier to read and the function will be hoisted
|
||||
_.class(Square).inherits(Shape);
|
||||
|
||||
function Square(width, height) {
|
||||
Square.Super.call(this);
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
function Square(width, height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
Square.prototype = Object.create(Shape);
|
||||
```
|
||||
|
||||
### Keep Constructors Small
|
||||
|
||||
It is often the case that there are properties that can't be defined on the prototype, or work that needs to be done to completely create an object (like call its Super class). This is all that should be done within constructors.
|
||||
|
||||
Try to follow the [Write small functions](#write-small-functions) rule here too.
|
||||
|
||||
### Use the prototype
|
||||
|
||||
If a method/property *can* go on the prototype, it probably should.
|
||||
|
||||
```js
|
||||
function Square() {
|
||||
...
|
||||
}
|
||||
|
||||
/**
|
||||
* method does stuff
|
||||
* @return {undefined}
|
||||
*/
|
||||
Square.prototype.method = function () {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Handling scope and aliasing `this`
|
||||
|
||||
When creating a prototyped class, each method should almost always start with:
|
||||
|
||||
`var self = this;`
|
||||
|
||||
With the exception of very short methods (roughly 3 lines or less), `self` should always be used in place of `this`.
|
||||
|
||||
Avoid the use of `bind`
|
||||
|
||||
*Right:*
|
||||
|
||||
```js
|
||||
Square.prototype.doFancyThings = function () {
|
||||
var self = this;
|
||||
|
||||
somePromiseUtil()
|
||||
.then(function (result) {
|
||||
self.prop = result.prop;
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
*Wrong:*
|
||||
|
||||
```js
|
||||
Square.prototype.doFancyThings = function () {
|
||||
somePromiseUtil()
|
||||
.then(function (result) {
|
||||
this.prop = result.prop;
|
||||
}).bind(this);
|
||||
}
|
||||
```
|
||||
|
||||
*Allowed:*
|
||||
|
||||
```js
|
||||
Square.prototype.area = function () {
|
||||
return this.width * this.height;
|
||||
}
|
||||
```
|
||||
|
||||
## Object.freeze, Object.preventExtensions, Object.seal, with, eval
|
||||
|
||||
Crazy shit that you will probably never need. Stay away from it.
|
||||
|
||||
## Getters and Setters
|
||||
|
||||
Feel free to use getters that are free from [side effects][sideeffect], like
|
||||
providing a length property for a collection class.
|
||||
|
||||
Do not use setters, they cause more problems for people who try to use your
|
||||
software than they can solve.
|
||||
|
||||
[sideeffect]: http://en.wikipedia.org/wiki/Side_effect_(computer_science)
|
|
@ -5,57 +5,51 @@ import {
|
|||
consolePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('console app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
common.debug('navigateTo console');
|
||||
return common.navigateToApp('console', false)
|
||||
.catch(common.handleError(this));
|
||||
bdd.describe('console app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
common.debug('navigateTo console');
|
||||
return common.navigateToApp('console', false)
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show the default request', function () {
|
||||
var expectedRequest = [
|
||||
'GET _search',
|
||||
'{',
|
||||
' "query": {',
|
||||
' "match_all": {}',
|
||||
' }',
|
||||
'}',
|
||||
''
|
||||
];
|
||||
// collapse the help pane because we only get the VISIBLE TEXT, not the part that is scrolled
|
||||
return consolePage.collapseHelp()
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
return consolePage.getRequest()
|
||||
.then(function (actualRequest) {
|
||||
expect(actualRequest).to.eql(expectedRequest);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show the default request', function () {
|
||||
var expectedRequest = [
|
||||
'GET _search',
|
||||
'{',
|
||||
' "query": {',
|
||||
' "match_all": {}',
|
||||
' }',
|
||||
'}',
|
||||
''
|
||||
];
|
||||
// collapse the help pane because we only get the VISIBLE TEXT, not the part that is scrolled
|
||||
return consolePage.collapseHelp()
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
return consolePage.getRequest()
|
||||
.then(function (actualRequest) {
|
||||
expect(actualRequest).to.eql(expectedRequest);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
bdd.it('default request response should contain .kibana' , function () {
|
||||
var expectedResponseContains = '"_index": ".kibana",';
|
||||
return consolePage.clickPlay()
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
return consolePage.getResponse()
|
||||
.then(function (actualResponse) {
|
||||
common.debug(actualResponse);
|
||||
expect(actualResponse).to.contain(expectedResponseContains);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('default request response should contain .kibana' , function () {
|
||||
var expectedResponseContains = '"_index": ".kibana",';
|
||||
return consolePage.clickPlay()
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
return consolePage.getResponse()
|
||||
.then(function (actualResponse) {
|
||||
common.debug(actualResponse);
|
||||
expect(actualResponse).to.contain(expectedResponseContains);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}());
|
||||
}());
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support';
|
||||
|
||||
(function () {
|
||||
bdd.describe('console app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
bdd.describe('console app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
|
||||
bdd.before(function () {
|
||||
return remote.setWindowSize(1200,800);
|
||||
});
|
||||
|
||||
require('./_console');
|
||||
bdd.before(function () {
|
||||
return remote.setWindowSize(1200,800);
|
||||
});
|
||||
}());
|
||||
|
||||
require('./_console');
|
||||
});
|
||||
|
|
|
@ -8,128 +8,116 @@ import {
|
|||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('dashboard tab', function describeIndexTests() {
|
||||
bdd.describe('dashboard tab', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
common.debug('Starting dashboard before method');
|
||||
var logstash = scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadkibanaVisualizations() {
|
||||
common.debug('load kibana index with visualizations');
|
||||
return elasticDump.elasticLoad('dashboard','.kibana');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('navigateToApp dashboard');
|
||||
return common.navigateToApp('dashboard');
|
||||
})
|
||||
// wait for the logstash data load to finish if it hasn't already
|
||||
.then(function () {
|
||||
return logstash;
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.before(function () {
|
||||
bdd.describe('add visualizations to dashboard', function dashboardTest() {
|
||||
var visualizations = ['Visualization漢字 AreaChart',
|
||||
'Visualization☺漢字 DataTable',
|
||||
'Visualization漢字 LineChart',
|
||||
'Visualization PieChart',
|
||||
'Visualization TileMap',
|
||||
'Visualization☺ VerticalBarChart',
|
||||
'Visualization MetricChart'
|
||||
];
|
||||
|
||||
common.debug('Starting dashboard before method');
|
||||
var logstash = scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadkibanaVisualizations() {
|
||||
common.debug('load kibana index with visualizations');
|
||||
return elasticDump.elasticLoad('dashboard','.kibana');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('navigateToApp dashboard');
|
||||
return common.navigateToApp('dashboard');
|
||||
})
|
||||
// wait for the logstash data load to finish if it hasn't already
|
||||
.then(function () {
|
||||
return logstash;
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('add visualizations to dashboard', function dashboardTest() {
|
||||
var visualizations = ['Visualization漢字 AreaChart',
|
||||
'Visualization☺漢字 DataTable',
|
||||
'Visualization漢字 LineChart',
|
||||
'Visualization PieChart',
|
||||
'Visualization TileMap',
|
||||
'Visualization☺ VerticalBarChart',
|
||||
'Visualization MetricChart'
|
||||
];
|
||||
|
||||
|
||||
bdd.it('should be able to add visualizations to dashboard', function addVisualizations() {
|
||||
|
||||
function addVisualizations(arr) {
|
||||
return arr.reduce(function (promise, vizName) {
|
||||
return promise
|
||||
.then(function () {
|
||||
return dashboardPage.addVisualization(vizName);
|
||||
});
|
||||
}, Promise.resolve());
|
||||
}
|
||||
|
||||
return addVisualizations(visualizations)
|
||||
bdd.it('should be able to add visualizations to dashboard', function addVisualizations() {
|
||||
function addVisualizations(arr) {
|
||||
return arr.reduce(function (promise, vizName) {
|
||||
return promise
|
||||
.then(function () {
|
||||
common.debug('done adding visualizations');
|
||||
return dashboardPage.addVisualization(vizName);
|
||||
});
|
||||
}, Promise.resolve());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
bdd.it('set the timepicker time to that which contains our test data', function setTimepicker() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
var testSubName = 'Dashboard Test 1';
|
||||
|
||||
// .then(function () {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime)
|
||||
.then(function sleep() {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should save and load dashboard', function saveAndLoadDashboard() {
|
||||
var testSubName = 'Dashboard Test 1';
|
||||
// TODO: save time on the dashboard and test it
|
||||
return dashboardPage.saveDashboard(testSubName)
|
||||
// click New Dashboard just to clear the one we just created
|
||||
.then(function () {
|
||||
return dashboardPage.clickNewDashboard();
|
||||
})
|
||||
.then(function () {
|
||||
return dashboardPage.loadSavedDashboard(testSubName);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should have all the expected visualizations', function checkVisualizations() {
|
||||
return common.tryForTime(10000, function () {
|
||||
return dashboardPage.getPanelTitles()
|
||||
.then(function (panelTitles) {
|
||||
common.log('visualization titles = ' + panelTitles);
|
||||
expect(panelTitles).to.eql(visualizations);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should have all the expected initial sizes', function checkVisualizationSizes() {
|
||||
var visObjects = [ { dataCol: '1', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 AreaChart' },
|
||||
{ dataCol: '4', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺漢字 DataTable' },
|
||||
{ dataCol: '7', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 LineChart' },
|
||||
{ dataCol: '10', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization PieChart' },
|
||||
{ dataCol: '1', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization TileMap' },
|
||||
{ dataCol: '4', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺ VerticalBarChart' },
|
||||
{ dataCol: '7', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization MetricChart' }
|
||||
];
|
||||
return common.tryForTime(10000, function () {
|
||||
return dashboardPage.getPanelData()
|
||||
.then(function (panelTitles) {
|
||||
common.log('visualization titles = ' + panelTitles);
|
||||
expect(panelTitles).to.eql(visObjects);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
return addVisualizations(visualizations)
|
||||
.then(function () {
|
||||
common.debug('done adding visualizations');
|
||||
});
|
||||
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
bdd.it('set the timepicker time to that which contains our test data', function setTimepicker() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
var testSubName = 'Dashboard Test 1';
|
||||
|
||||
// .then(function () {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime)
|
||||
.then(function sleep() {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should save and load dashboard', function saveAndLoadDashboard() {
|
||||
var testSubName = 'Dashboard Test 1';
|
||||
// TODO: save time on the dashboard and test it
|
||||
return dashboardPage.saveDashboard(testSubName)
|
||||
// click New Dashboard just to clear the one we just created
|
||||
.then(function () {
|
||||
return dashboardPage.clickNewDashboard();
|
||||
})
|
||||
.then(function () {
|
||||
return dashboardPage.loadSavedDashboard(testSubName);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should have all the expected visualizations', function checkVisualizations() {
|
||||
return common.tryForTime(10000, function () {
|
||||
return dashboardPage.getPanelTitles()
|
||||
.then(function (panelTitles) {
|
||||
common.log('visualization titles = ' + panelTitles);
|
||||
expect(panelTitles).to.eql(visualizations);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should have all the expected initial sizes', function checkVisualizationSizes() {
|
||||
var visObjects = [ { dataCol: '1', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 AreaChart' },
|
||||
{ dataCol: '4', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺漢字 DataTable' },
|
||||
{ dataCol: '7', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 LineChart' },
|
||||
{ dataCol: '10', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization PieChart' },
|
||||
{ dataCol: '1', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization TileMap' },
|
||||
{ dataCol: '4', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺ VerticalBarChart' },
|
||||
{ dataCol: '7', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization MetricChart' }
|
||||
];
|
||||
return common.tryForTime(10000, function () {
|
||||
return dashboardPage.getPanelData()
|
||||
.then(function (panelTitles) {
|
||||
common.log('visualization titles = ' + panelTitles);
|
||||
expect(panelTitles).to.eql(visObjects);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support';
|
||||
|
||||
(function () {
|
||||
bdd.describe('dashboard app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
bdd.describe('dashboard app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
|
||||
bdd.before(function () {
|
||||
return remote.setWindowSize(1200,800);
|
||||
});
|
||||
|
||||
require('./_dashboard');
|
||||
bdd.before(function () {
|
||||
return remote.setWindowSize(1200,800);
|
||||
});
|
||||
}());
|
||||
|
||||
require('./_dashboard');
|
||||
});
|
||||
|
|
|
@ -9,77 +9,68 @@ import {
|
|||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('discover tab', function describeIndexTests() {
|
||||
bdd.describe('discover tab', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
bdd.describe('field data', function () {
|
||||
bdd.it('should initially be expanded', function () {
|
||||
return discoverPage.getSidebarWidth()
|
||||
.then(function (width) {
|
||||
common.debug('expanded sidebar width = ' + width);
|
||||
expect(width > 180).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.describe('field data', function () {
|
||||
|
||||
bdd.it('should initially be expanded', function () {
|
||||
return discoverPage.getSidebarWidth()
|
||||
.then(function (width) {
|
||||
common.debug('expanded sidebar width = ' + width);
|
||||
expect(width > 180).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should collapse when clicked', function () {
|
||||
return discoverPage.toggleSidebarCollapse()
|
||||
.then(function () {
|
||||
common.debug('discoverPage.getSidebarWidth()');
|
||||
return discoverPage.getSidebarWidth();
|
||||
})
|
||||
.then(function (width) {
|
||||
common.debug('collapsed sidebar width = ' + width);
|
||||
expect(width < 20).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should expand when clicked', function () {
|
||||
return discoverPage.toggleSidebarCollapse()
|
||||
.then(function () {
|
||||
common.debug('discoverPage.getSidebarWidth()');
|
||||
return discoverPage.getSidebarWidth();
|
||||
})
|
||||
.then(function (width) {
|
||||
common.debug('expanded sidebar width = ' + width);
|
||||
expect(width > 180).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
bdd.it('should collapse when clicked', function () {
|
||||
return discoverPage.toggleSidebarCollapse()
|
||||
.then(function () {
|
||||
common.debug('discoverPage.getSidebarWidth()');
|
||||
return discoverPage.getSidebarWidth();
|
||||
})
|
||||
.then(function (width) {
|
||||
common.debug('collapsed sidebar width = ' + width);
|
||||
expect(width < 20).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should expand when clicked', function () {
|
||||
return discoverPage.toggleSidebarCollapse()
|
||||
.then(function () {
|
||||
common.debug('discoverPage.getSidebarWidth()');
|
||||
return discoverPage.getSidebarWidth();
|
||||
})
|
||||
.then(function (width) {
|
||||
common.debug('expanded sidebar width = ' + width);
|
||||
expect(width > 180).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,354 +9,349 @@ import {
|
|||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('discover app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
bdd.describe('discover app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('query', function () {
|
||||
var queryName1 = 'Query # 1';
|
||||
var fromTimeString = 'September 19th 2015, 06:31:44.000';
|
||||
var toTimeString = 'September 23rd 2015, 18:31:44.000';
|
||||
|
||||
bdd.it('should show correct time range string by timepicker', function () {
|
||||
var expectedTimeRangeString = fromTimeString + ' to ' + toTimeString;
|
||||
return discoverPage.getTimespanText()
|
||||
.then(function (actualTimeString) {
|
||||
expect(actualTimeString).to.be(expectedTimeRangeString);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('save query should show toast message and display query name', function () {
|
||||
var expectedSavedQueryMessage = 'Discover: Saved Data Source "' + queryName1 + '"';
|
||||
return discoverPage.saveSearch(queryName1)
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
expect(toastMessage).to.be(expectedSavedQueryMessage);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return discoverPage.getCurrentQueryName();
|
||||
})
|
||||
.then(function (actualQueryNameString) {
|
||||
expect(actualQueryNameString).to.be(queryName1);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('load query should show query name', function () {
|
||||
return discoverPage.loadSavedSearch(queryName1)
|
||||
.then(function () {
|
||||
return common.sleep(3000);
|
||||
})
|
||||
.then(function () {
|
||||
return discoverPage.getCurrentQueryName();
|
||||
})
|
||||
.then(function (actualQueryNameString) {
|
||||
expect(actualQueryNameString).to.be(queryName1);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show the correct hit count', function () {
|
||||
var expectedHitCount = '14,004';
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getHitCount()
|
||||
.then(function compareData(hitCount) {
|
||||
expect(hitCount).to.be(expectedHitCount);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show the correct bar chart', function () {
|
||||
var expectedBarChartData = [ '3.237',
|
||||
'17.674', '64.75', '125.737', '119.962', '65.712', '16.449',
|
||||
'2.712', '3.675', '17.674', '59.762', '119.087', '123.812',
|
||||
'61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2',
|
||||
'118.562', '63.524', '17.587', '2.537'
|
||||
];
|
||||
return common.sleep(4000)
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct time range string in chart', function () {
|
||||
var expectedTimeRangeString = fromTimeString + ' - ' + toTimeString;
|
||||
return discoverPage.getChartTimespan()
|
||||
.then(function (actualTimeString) {
|
||||
expect(actualTimeString).to.be(expectedTimeRangeString);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct initial chart interval of 3 hours', function () {
|
||||
var expectedChartInterval = 'by 3 hours';
|
||||
return discoverPage.getChartInterval()
|
||||
.then(function (actualInterval) {
|
||||
expect(actualInterval).to.be(expectedChartInterval);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Hourly', function () {
|
||||
var chartInterval = 'Hourly';
|
||||
var expectedBarChartData = [ '1.527', '2.290',
|
||||
'5.599', '7.890', '13.236', '30.290', '46.072', '55.490', '86.8',
|
||||
'112', '122.181', '131.6', '132.872', '113.527', '102.581',
|
||||
'81.709', '65.672', '43.781', '24.181', '14', '9.672', '6.109',
|
||||
'0.763', '1.018', '2.800', '3.563', '4.327', '9.672', '12.472',
|
||||
'29.272', '38.690', '54.981', '80.181', '102.327', '113.527',
|
||||
'130.581', '132.363', '120.654', '107.163', '78.145', '58.545',
|
||||
'43.272', '25.199', '12.218', '7.636', '3.818', '2.545', '0.509',
|
||||
'2.036', '1.781', '4.327', '8.654', '9.418', '26.472', '38.945',
|
||||
'61.345', '79.672', '102.836', '125.236', '130.327', '128.036',
|
||||
'120.4', '96.472', '74.581', '70.509', '39.709', '25.199', '13.490',
|
||||
'12.472', '4.072', '2.290', '1.018'
|
||||
];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Daily', function () {
|
||||
var chartInterval = 'Daily';
|
||||
var expectedBarChartData = [
|
||||
'133.196', '129.192', '129.724'
|
||||
];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Weekly', function () {
|
||||
var chartInterval = 'Weekly';
|
||||
var expectedBarChartData = [ '66.598', '129.458'];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('browser back button should show previous interval Daily', function () {
|
||||
var expectedChartInterval = 'Daily';
|
||||
var expectedBarChartData = [
|
||||
'133.196', '129.192', '129.724'
|
||||
];
|
||||
return this.remote.goBack()
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getChartInterval()
|
||||
.then(function (actualInterval) {
|
||||
expect(actualInterval).to.be(expectedChartInterval);
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Monthly', function () {
|
||||
var chartInterval = 'Monthly';
|
||||
var expectedBarChartData = [ '122.535'];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Yearly', function () {
|
||||
var chartInterval = 'Yearly';
|
||||
var expectedBarChartData = [ '122.535'];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Auto', function () {
|
||||
var chartInterval = 'Auto';
|
||||
var expectedBarChartData = [ '3.237',
|
||||
'17.674', '64.75', '125.737', '119.962', '65.712', '16.449',
|
||||
'2.712', '3.675', '17.674', '59.762', '119.087', '123.812',
|
||||
'61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2',
|
||||
'118.562', '63.524', '17.587', '2.537'
|
||||
];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Auto chart interval of 3 hours', function () {
|
||||
var expectedChartInterval = 'by 3 hours';
|
||||
return discoverPage.getChartInterval()
|
||||
.then(function (actualInterval) {
|
||||
expect(actualInterval).to.be(expectedChartInterval);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should not show "no results"', () => {
|
||||
return discoverPage.hasNoResults().then(visible => {
|
||||
expect(visible).to.be(false);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
function verifyChartData(expectedBarChartData) {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getBarChartData()
|
||||
.then(function compareData(paths) {
|
||||
// the largest bars are over 100 pixels high so this is less than 1% tolerance
|
||||
var barHeightTolerance = 1;
|
||||
var stringResults = '';
|
||||
var hasFailure = false;
|
||||
for (var y = 0; y < expectedBarChartData.length; y++) {
|
||||
stringResults += y + ': expected = ' + expectedBarChartData[y] + ', actual = ' + paths[y] +
|
||||
', Pass = ' + (Math.abs(expectedBarChartData[y] - paths[y]) < barHeightTolerance) + '\n';
|
||||
if ((Math.abs(expectedBarChartData[y] - paths[y]) > barHeightTolerance)) {
|
||||
hasFailure = true;
|
||||
};
|
||||
};
|
||||
if (hasFailure) {
|
||||
common.log(stringResults);
|
||||
common.log(paths);
|
||||
}
|
||||
for (var x = 0; x < expectedBarChartData.length; x++) {
|
||||
expect(Math.abs(expectedBarChartData[x] - paths[x]) < barHeightTolerance).to.be.ok();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('query #2, which has an empty time range', function () {
|
||||
var fromTime = '1999-06-11 09:22:11.000';
|
||||
var toTime = '1999-06-12 11:21:04.000';
|
||||
|
||||
bdd.before(() => {
|
||||
common.debug('setAbsoluteRangeForAnotherQuery');
|
||||
return headerPage
|
||||
.setAbsoluteRange(fromTime, toTime)
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show "no results"', () => {
|
||||
return discoverPage.hasNoResults().then(visible => {
|
||||
expect(visible).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should suggest a new time range is picked', () => {
|
||||
return discoverPage.hasNoResultsTimepicker().then(visible => {
|
||||
expect(visible).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should open and close the time picker', () => {
|
||||
let i = 0;
|
||||
|
||||
return closeTimepicker() // close
|
||||
.then(() => isTimepickerOpen(false)
|
||||
.then(el => el.click()) // open
|
||||
.then(() => isTimepickerOpen(true))
|
||||
.then(el => el.click()) // close
|
||||
.then(() => isTimepickerOpen(false))
|
||||
.catch(common.handleError(this))
|
||||
);
|
||||
|
||||
function closeTimepicker() {
|
||||
return headerPage.isTimepickerOpen().then(shown => {
|
||||
if (!shown) {
|
||||
return;
|
||||
}
|
||||
return discoverPage
|
||||
.getNoResultsTimepicker()
|
||||
.click(); // close
|
||||
});
|
||||
}
|
||||
|
||||
function isTimepickerOpen(expected) {
|
||||
return headerPage.isTimepickerOpen().then(shown => {
|
||||
common.debug(`expect (#${++i}) timepicker to be ${peek(expected)} (is ${peek(shown)}).`);
|
||||
expect(shown).to.be(expected);
|
||||
return discoverPage.getNoResultsTimepicker();
|
||||
function peek(state) {
|
||||
return state ? 'open' : 'closed';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
bdd.describe('query', function () {
|
||||
var queryName1 = 'Query # 1';
|
||||
var fromTimeString = 'September 19th 2015, 06:31:44.000';
|
||||
var toTimeString = 'September 23rd 2015, 18:31:44.000';
|
||||
|
||||
bdd.it('should show correct time range string by timepicker', function () {
|
||||
var expectedTimeRangeString = fromTimeString + ' to ' + toTimeString;
|
||||
return discoverPage.getTimespanText()
|
||||
.then(function (actualTimeString) {
|
||||
expect(actualTimeString).to.be(expectedTimeRangeString);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
|
||||
bdd.it('save query should show toast message and display query name', function () {
|
||||
var expectedSavedQueryMessage = 'Discover: Saved Data Source "' + queryName1 + '"';
|
||||
return discoverPage.saveSearch(queryName1)
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
expect(toastMessage).to.be(expectedSavedQueryMessage);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return discoverPage.getCurrentQueryName();
|
||||
})
|
||||
.then(function (actualQueryNameString) {
|
||||
expect(actualQueryNameString).to.be(queryName1);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('load query should show query name', function () {
|
||||
return discoverPage.loadSavedSearch(queryName1)
|
||||
.then(function () {
|
||||
return common.sleep(3000);
|
||||
})
|
||||
.then(function () {
|
||||
return discoverPage.getCurrentQueryName();
|
||||
})
|
||||
.then(function (actualQueryNameString) {
|
||||
expect(actualQueryNameString).to.be(queryName1);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show the correct hit count', function () {
|
||||
var expectedHitCount = '14,004';
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getHitCount()
|
||||
.then(function compareData(hitCount) {
|
||||
expect(hitCount).to.be(expectedHitCount);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show the correct bar chart', function () {
|
||||
var expectedBarChartData = [ '3.237',
|
||||
'17.674', '64.75', '125.737', '119.962', '65.712', '16.449',
|
||||
'2.712', '3.675', '17.674', '59.762', '119.087', '123.812',
|
||||
'61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2',
|
||||
'118.562', '63.524', '17.587', '2.537'
|
||||
];
|
||||
return common.sleep(4000)
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct time range string in chart', function () {
|
||||
var expectedTimeRangeString = fromTimeString + ' - ' + toTimeString;
|
||||
return discoverPage.getChartTimespan()
|
||||
.then(function (actualTimeString) {
|
||||
expect(actualTimeString).to.be(expectedTimeRangeString);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct initial chart interval of 3 hours', function () {
|
||||
var expectedChartInterval = 'by 3 hours';
|
||||
return discoverPage.getChartInterval()
|
||||
.then(function (actualInterval) {
|
||||
expect(actualInterval).to.be(expectedChartInterval);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Hourly', function () {
|
||||
var chartInterval = 'Hourly';
|
||||
var expectedBarChartData = [ '1.527', '2.290',
|
||||
'5.599', '7.890', '13.236', '30.290', '46.072', '55.490', '86.8',
|
||||
'112', '122.181', '131.6', '132.872', '113.527', '102.581',
|
||||
'81.709', '65.672', '43.781', '24.181', '14', '9.672', '6.109',
|
||||
'0.763', '1.018', '2.800', '3.563', '4.327', '9.672', '12.472',
|
||||
'29.272', '38.690', '54.981', '80.181', '102.327', '113.527',
|
||||
'130.581', '132.363', '120.654', '107.163', '78.145', '58.545',
|
||||
'43.272', '25.199', '12.218', '7.636', '3.818', '2.545', '0.509',
|
||||
'2.036', '1.781', '4.327', '8.654', '9.418', '26.472', '38.945',
|
||||
'61.345', '79.672', '102.836', '125.236', '130.327', '128.036',
|
||||
'120.4', '96.472', '74.581', '70.509', '39.709', '25.199', '13.490',
|
||||
'12.472', '4.072', '2.290', '1.018'
|
||||
];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Daily', function () {
|
||||
var chartInterval = 'Daily';
|
||||
var expectedBarChartData = [
|
||||
'133.196', '129.192', '129.724'
|
||||
];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Weekly', function () {
|
||||
var chartInterval = 'Weekly';
|
||||
var expectedBarChartData = [ '66.598', '129.458'];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('browser back button should show previous interval Daily', function () {
|
||||
var expectedChartInterval = 'Daily';
|
||||
var expectedBarChartData = [
|
||||
'133.196', '129.192', '129.724'
|
||||
];
|
||||
return this.remote.goBack()
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getChartInterval()
|
||||
.then(function (actualInterval) {
|
||||
expect(actualInterval).to.be(expectedChartInterval);
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Monthly', function () {
|
||||
var chartInterval = 'Monthly';
|
||||
var expectedBarChartData = [ '122.535'];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Yearly', function () {
|
||||
var chartInterval = 'Yearly';
|
||||
var expectedBarChartData = [ '122.535'];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data for chart interval Auto', function () {
|
||||
var chartInterval = 'Auto';
|
||||
var expectedBarChartData = [ '3.237',
|
||||
'17.674', '64.75', '125.737', '119.962', '65.712', '16.449',
|
||||
'2.712', '3.675', '17.674', '59.762', '119.087', '123.812',
|
||||
'61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2',
|
||||
'118.562', '63.524', '17.587', '2.537'
|
||||
];
|
||||
return discoverPage.setChartInterval(chartInterval)
|
||||
.then(function () {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function () {
|
||||
return verifyChartData(expectedBarChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Auto chart interval of 3 hours', function () {
|
||||
var expectedChartInterval = 'by 3 hours';
|
||||
return discoverPage.getChartInterval()
|
||||
.then(function (actualInterval) {
|
||||
expect(actualInterval).to.be(expectedChartInterval);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should not show "no results"', () => {
|
||||
return discoverPage.hasNoResults().then(visible => {
|
||||
expect(visible).to.be(false);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
function verifyChartData(expectedBarChartData) {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getBarChartData()
|
||||
.then(function compareData(paths) {
|
||||
// the largest bars are over 100 pixels high so this is less than 1% tolerance
|
||||
var barHeightTolerance = 1;
|
||||
var stringResults = '';
|
||||
var hasFailure = false;
|
||||
for (var y = 0; y < expectedBarChartData.length; y++) {
|
||||
stringResults += y + ': expected = ' + expectedBarChartData[y] + ', actual = ' + paths[y] +
|
||||
', Pass = ' + (Math.abs(expectedBarChartData[y] - paths[y]) < barHeightTolerance) + '\n';
|
||||
if ((Math.abs(expectedBarChartData[y] - paths[y]) > barHeightTolerance)) {
|
||||
hasFailure = true;
|
||||
};
|
||||
};
|
||||
if (hasFailure) {
|
||||
common.log(stringResults);
|
||||
common.log(paths);
|
||||
}
|
||||
for (var x = 0; x < expectedBarChartData.length; x++) {
|
||||
expect(Math.abs(expectedBarChartData[x] - paths[x]) < barHeightTolerance).to.be.ok();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('query #2, which has an empty time range', function () {
|
||||
var fromTime = '1999-06-11 09:22:11.000';
|
||||
var toTime = '1999-06-12 11:21:04.000';
|
||||
|
||||
bdd.before(() => {
|
||||
common.debug('setAbsoluteRangeForAnotherQuery');
|
||||
return headerPage
|
||||
.setAbsoluteRange(fromTime, toTime)
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show "no results"', () => {
|
||||
return discoverPage.hasNoResults().then(visible => {
|
||||
expect(visible).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should suggest a new time range is picked', () => {
|
||||
return discoverPage.hasNoResultsTimepicker().then(visible => {
|
||||
expect(visible).to.be(true);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should open and close the time picker', () => {
|
||||
let i = 0;
|
||||
|
||||
return closeTimepicker() // close
|
||||
.then(() => isTimepickerOpen(false)
|
||||
.then(el => el.click()) // open
|
||||
.then(() => isTimepickerOpen(true))
|
||||
.then(el => el.click()) // close
|
||||
.then(() => isTimepickerOpen(false))
|
||||
.catch(common.handleError(this))
|
||||
);
|
||||
|
||||
function closeTimepicker() {
|
||||
return headerPage.isTimepickerOpen().then(shown => {
|
||||
if (!shown) {
|
||||
return;
|
||||
}
|
||||
return discoverPage
|
||||
.getNoResultsTimepicker()
|
||||
.click(); // close
|
||||
});
|
||||
}
|
||||
|
||||
function isTimepickerOpen(expected) {
|
||||
return headerPage.isTimepickerOpen().then(shown => {
|
||||
common.debug(`expect (#${++i}) timepicker to be ${peek(expected)} (is ${peek(shown)}).`);
|
||||
expect(shown).to.be(expected);
|
||||
return discoverPage.getNoResultsTimepicker();
|
||||
function peek(state) {
|
||||
return state ? 'open' : 'closed';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,253 +9,247 @@ import {
|
|||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('discover app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
bdd.describe('discover app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('field data', function () {
|
||||
var queryName1 = 'Query # 1';
|
||||
var fromTimeString = 'September 19th 2015, 06:31:44.000';
|
||||
var toTimeString = 'September 23rd 2015, 18:31:44.000';
|
||||
bdd.describe('field data', function () {
|
||||
var queryName1 = 'Query # 1';
|
||||
var fromTimeString = 'September 19th 2015, 06:31:44.000';
|
||||
var toTimeString = 'September 23rd 2015, 18:31:44.000';
|
||||
|
||||
bdd.it('search php should show the correct hit count', function () {
|
||||
var expectedHitCount = '445';
|
||||
return discoverPage.query('php')
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getHitCount()
|
||||
.then(function compareData(hitCount) {
|
||||
expect(hitCount).to.be(expectedHitCount);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
bdd.it('search php should show the correct hit count', function () {
|
||||
var expectedHitCount = '445';
|
||||
return discoverPage.query('php')
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getHitCount()
|
||||
.then(function compareData(hitCount) {
|
||||
expect(hitCount).to.be(expectedHitCount);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('the search term should be highlighted in the field data', function () {
|
||||
// marks is the style that highlights the text in yellow
|
||||
return discoverPage.getMarks()
|
||||
.then(function (marks) {
|
||||
expect(marks.length).to.be(50);
|
||||
expect(marks.indexOf('php')).to.be(0);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
bdd.it('the search term should be highlighted in the field data', function () {
|
||||
// marks is the style that highlights the text in yellow
|
||||
return discoverPage.getMarks()
|
||||
.then(function (marks) {
|
||||
expect(marks.length).to.be(50);
|
||||
expect(marks.indexOf('php')).to.be(0);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('search _type:apache should show the correct hit count', function () {
|
||||
var expectedHitCount = '11,156';
|
||||
return discoverPage.query('_type:apache')
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getHitCount()
|
||||
.then(function compareData(hitCount) {
|
||||
expect(hitCount).to.be(expectedHitCount);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('doc view should show Time and _source columns', function () {
|
||||
var expectedHeader = 'Time _source';
|
||||
return discoverPage.getDocHeader()
|
||||
.then(function (header) {
|
||||
expect(header).to.be(expectedHeader);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('search _type:apache should show the correct hit count', function () {
|
||||
var expectedHitCount = '11,156';
|
||||
return discoverPage.query('_type:apache')
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getHitCount()
|
||||
.then(function compareData(hitCount) {
|
||||
expect(hitCount).to.be(expectedHitCount);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
bdd.it('doc view should show oldest time first', function () {
|
||||
// Note: Could just check the timestamp, but might as well check that the whole doc is as expected.
|
||||
var ExpectedDoc =
|
||||
'September 22nd 2015, 23:50:13.253 index:logstash-2015.09.22 @timestamp:September 22nd 2015, 23:50:13.253'
|
||||
+ ' ip:238.171.34.42 extension:jpg response:200 geo.coordinates:{ "lat": 38.66494528, "lon": -88.45299556'
|
||||
+ ' } geo.src:FR geo.dest:KH geo.srcdest:FR:KH @tags:success, info utc_time:September 22nd 2015,'
|
||||
+ ' 23:50:13.253 referer:http://twitter.com/success/nancy-currie agent:Mozilla/4.0 (compatible; MSIE 6.0;'
|
||||
+ ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:238.171.34.42 bytes:7,124'
|
||||
+ ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/karl-henize.jpg'
|
||||
+ ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/karl-henize.jpg'
|
||||
+ ' @message:238.171.34.42 - - [2015-09-22T23:50:13.253Z] "GET /uploads/karl-henize.jpg HTTP/1.1" 200 7124'
|
||||
+ ' "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a'
|
||||
+ ' thing with lots of spaces wwwwoooooo xss:<script>console.log("xss")</script>'
|
||||
+ ' headings:<h3>alexander-viktorenko</h5>, http://nytimes.com/warning/michael-massimino'
|
||||
+ ' links:@www.slate.com, http://www.slate.com/security/frederick-w-leslie, www.www.slate.com'
|
||||
+ ' relatedContent:{ "url": "http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191",'
|
||||
+ ' "og:type": "article", "og:title": "Bjork at the Nokia Theatre, 12/12", "og:description": "Bjork at the'
|
||||
+ ' Nokia Theater, December 12 By Randall Roberts Last night’s Bjork show at the Dystopia –'
|
||||
+ ' er, I mean Nokia -- Theatre downtown di...", "og:url": "'
|
||||
+ 'http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191", "article:published_time":'
|
||||
+ ' "2007-12-13T12:19:35-08:00", "article:modified_time": "2014-11-27T08:28:42-08:00", "article:section":'
|
||||
+ ' "Music", "og:image": "'
|
||||
+ 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",'
|
||||
+ ' "og:image:height": "334", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title":'
|
||||
+ ' "Bjork at the Nokia Theatre, 12/12", "twitter:description": "Bjork at the Nokia Theater, December 12'
|
||||
+ ' By Randall Roberts Last night’s Bjork show at the Dystopia – er, I mean Nokia -- Theatre'
|
||||
+ ' downtown di...", "twitter:card": "summary", "twitter:image": "'
|
||||
+ 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",'
|
||||
+ ' "twitter:site": "@laweekly" }, { "url": "'
|
||||
+ 'http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011", "og:type": "article", "og:title":'
|
||||
+ ' "The Rapture at the Mayan, 7/25", "og:description": "If you haven’t yet experienced the'
|
||||
+ ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.'
|
||||
+ ' Here’s...", "og:url": "http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011",'
|
||||
+ ' "article:published_time": "2007-07-26T12:42:30-07:00", "article:modified_time":'
|
||||
+ ' "2014-11-27T08:00:51-08:00", "article:section": "Music", "og:image": "'
|
||||
+ 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",'
|
||||
+ ' "og:image:height": "321", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": "The'
|
||||
+ ' Rapture at the Mayan, 7/25", "twitter:description": "If you haven’t yet experienced the'
|
||||
+ ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.'
|
||||
+ ' Here’s...", "twitter:card": "summary", "twitter:image": "'
|
||||
+ 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",'
|
||||
+ ' "twitter:site": "@laweekly" } machine.os:win 7 machine.ram:7,516,192,768 _id:AU_x3_g4GFA8no6QjkYX'
|
||||
+ ' _type:apache _index:logstash-2015.09.22 _score: - relatedContent.article:modified_time:November 27th'
|
||||
+ ' 2014, 16:00:51.000, November 27th 2014, 16:28:42.000 relatedContent.article:published_time:July 26th'
|
||||
+ ' 2007, 19:42:30.000, December 13th 2007, 20:19:35.000';
|
||||
return discoverPage.getDocTableIndex(1)
|
||||
.then(function (rowData) {
|
||||
expect(rowData).to.be(ExpectedDoc);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('doc view should show Time and _source columns', function () {
|
||||
var expectedHeader = 'Time _source';
|
||||
return discoverPage.getDocHeader()
|
||||
.then(function (header) {
|
||||
expect(header).to.be(expectedHeader);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('doc view should show oldest time first', function () {
|
||||
// Note: Could just check the timestamp, but might as well check that the whole doc is as expected.
|
||||
var ExpectedDoc =
|
||||
'September 22nd 2015, 23:50:13.253 index:logstash-2015.09.22 @timestamp:September 22nd 2015, 23:50:13.253'
|
||||
+ ' ip:238.171.34.42 extension:jpg response:200 geo.coordinates:{ "lat": 38.66494528, "lon": -88.45299556'
|
||||
+ ' } geo.src:FR geo.dest:KH geo.srcdest:FR:KH @tags:success, info utc_time:September 22nd 2015,'
|
||||
+ ' 23:50:13.253 referer:http://twitter.com/success/nancy-currie agent:Mozilla/4.0 (compatible; MSIE 6.0;'
|
||||
+ ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:238.171.34.42 bytes:7,124'
|
||||
+ ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/karl-henize.jpg'
|
||||
+ ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/karl-henize.jpg'
|
||||
+ ' @message:238.171.34.42 - - [2015-09-22T23:50:13.253Z] "GET /uploads/karl-henize.jpg HTTP/1.1" 200 7124'
|
||||
+ ' "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a'
|
||||
+ ' thing with lots of spaces wwwwoooooo xss:<script>console.log("xss")</script>'
|
||||
+ ' headings:<h3>alexander-viktorenko</h5>, http://nytimes.com/warning/michael-massimino'
|
||||
+ ' links:@www.slate.com, http://www.slate.com/security/frederick-w-leslie, www.www.slate.com'
|
||||
+ ' relatedContent:{ "url": "http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191",'
|
||||
+ ' "og:type": "article", "og:title": "Bjork at the Nokia Theatre, 12/12", "og:description": "Bjork at the'
|
||||
+ ' Nokia Theater, December 12 By Randall Roberts Last night’s Bjork show at the Dystopia –'
|
||||
+ ' er, I mean Nokia -- Theatre downtown di...", "og:url": "'
|
||||
+ 'http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191", "article:published_time":'
|
||||
+ ' "2007-12-13T12:19:35-08:00", "article:modified_time": "2014-11-27T08:28:42-08:00", "article:section":'
|
||||
+ ' "Music", "og:image": "'
|
||||
+ 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",'
|
||||
+ ' "og:image:height": "334", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title":'
|
||||
+ ' "Bjork at the Nokia Theatre, 12/12", "twitter:description": "Bjork at the Nokia Theater, December 12'
|
||||
+ ' By Randall Roberts Last night’s Bjork show at the Dystopia – er, I mean Nokia -- Theatre'
|
||||
+ ' downtown di...", "twitter:card": "summary", "twitter:image": "'
|
||||
+ 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",'
|
||||
+ ' "twitter:site": "@laweekly" }, { "url": "'
|
||||
+ 'http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011", "og:type": "article", "og:title":'
|
||||
+ ' "The Rapture at the Mayan, 7/25", "og:description": "If you haven’t yet experienced the'
|
||||
+ ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.'
|
||||
+ ' Here’s...", "og:url": "http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011",'
|
||||
+ ' "article:published_time": "2007-07-26T12:42:30-07:00", "article:modified_time":'
|
||||
+ ' "2014-11-27T08:00:51-08:00", "article:section": "Music", "og:image": "'
|
||||
+ 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",'
|
||||
+ ' "og:image:height": "321", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": "The'
|
||||
+ ' Rapture at the Mayan, 7/25", "twitter:description": "If you haven’t yet experienced the'
|
||||
+ ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.'
|
||||
+ ' Here’s...", "twitter:card": "summary", "twitter:image": "'
|
||||
+ 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",'
|
||||
+ ' "twitter:site": "@laweekly" } machine.os:win 7 machine.ram:7,516,192,768 _id:AU_x3_g4GFA8no6QjkYX'
|
||||
+ ' _type:apache _index:logstash-2015.09.22 _score: - relatedContent.article:modified_time:November 27th'
|
||||
+ ' 2014, 16:00:51.000, November 27th 2014, 16:28:42.000 relatedContent.article:published_time:July 26th'
|
||||
+ ' 2007, 19:42:30.000, December 13th 2007, 20:19:35.000';
|
||||
bdd.it('doc view should sort ascending', function () {
|
||||
// Note: Could just check the timestamp, but might as well check that the whole doc is as expected.
|
||||
var ExpectedDoc =
|
||||
'September 20th 2015, 00:00:00.000 index:logstash-2015.09.20 @timestamp:September 20th 2015, 00:00:00.000'
|
||||
+ ' ip:143.84.142.7 extension:jpg response:200 geo.coordinates:{ "lat": 38.68407028, "lon": -120.9871642 }'
|
||||
+ ' geo.src:ES geo.dest:US geo.srcdest:ES:US @tags:error, info utc_time:September 20th 2015, 00:00:00.000'
|
||||
+ ' referer:http://www.slate.com/success/vladimir-kovalyonok agent:Mozilla/4.0 (compatible; MSIE 6.0;'
|
||||
+ ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:143.84.142.7 bytes:1,623'
|
||||
+ ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/steven-hawley.jpg'
|
||||
+ ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/steven-hawley.jpg'
|
||||
+ ' @message:143.84.142.7 - - [2015-09-20T00:00:00.000Z] "GET /uploads/steven-hawley.jpg HTTP/1.1" 200'
|
||||
+ ' 1623 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a'
|
||||
+ ' thing with lots of spaces wwwwoooooo xss:<script>console.log("xss")</script>'
|
||||
+ ' headings:<h3>kimiya-yui</h5>, http://www.slate.com/success/koichi-wakata'
|
||||
+ ' links:thomas-marshburn@twitter.com, http://www.slate.com/info/michael-p-anderson, www.twitter.com'
|
||||
+ ' relatedContent:{ "url":'
|
||||
+ ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",'
|
||||
+ ' "og:type": "article", "og:title": "Jay Electronica: Much Better Than His Name Would Suggest",'
|
||||
+ ' "og:description": "You may not know who Jay Electronica is yet, but I'm willing to bet that you'
|
||||
+ ' would had he chosen a better name. Jay Electronica does not sound like the ...", "og:url":'
|
||||
+ ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",'
|
||||
+ ' "article:published_time": "2008-04-04T16:00:00-07:00", "article:modified_time":'
|
||||
+ ' "2014-11-27T08:01:03-08:00", "article:section": "Music", "og:site_name": "LA Weekly", "twitter:title":'
|
||||
+ ' "Jay Electronica: Much Better Than His Name Would Suggest", "twitter:description": "You may not know'
|
||||
+ ' who Jay Electronica is yet, but I'm willing to bet that you would had he chosen a better name.'
|
||||
+ ' Jay Electronica does not sound like the ...", "twitter:card": "summary", "twitter:site": "@laweekly"'
|
||||
+ ' }, { "url": "http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "og:type":'
|
||||
+ ' "article", "og:title": "MANDOE On Gower Near Fountain", "og:description": "MANDOE has a stunner on a'
|
||||
+ ' wall north of an east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE'
|
||||
+ ' and FUKM are listed on t...", "og:url": "'
|
||||
+ 'http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "article:published_time":'
|
||||
+ ' "2008-04-25T07:26:41-07:00", "article:modified_time": "2014-10-28T15:00:08-07:00", "article:section":'
|
||||
+ ' "News", "og:image": "'
|
||||
+ 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg",'
|
||||
+ ' "og:image:height": "640", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": '
|
||||
+ '"MANDOE On Gower Near Fountain", "twitter:description": "MANDOE has a stunner on a wall north of an'
|
||||
+ ' east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE and FUKM are'
|
||||
+ ' listed on t...", "twitter:card": "summary", "twitter:image": "'
|
||||
+ 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg", '
|
||||
+ '"twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",'
|
||||
+ ' "og:type": "article", "og:title": "Meghan Finds The Love", "og:description": "LA Weekly is the'
|
||||
+ ' definitive source of information for news, music, movies, restaurants, reviews, and events in Los'
|
||||
+ ' Angeles.", "og:url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",'
|
||||
+ ' "article:published_time": "2005-10-20T18:10:25-07:00", "article:modified_time":'
|
||||
+ ' "2014-11-25T19:52:35-08:00", "article:section": "Arts", "og:site_name": "LA Weekly", "twitter:title":'
|
||||
+ ' "Meghan Finds The Love", "twitter:description": "LA Weekly is the definitive source of information for'
|
||||
+ ' news, music, movies, restaurants, reviews, and events in Los Angeles.", "twitter:card": "summary",'
|
||||
+ ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/these-clowns-are-with-me-2371051'
|
||||
+ '", "og:type": "article", "og:title": "These Clowns Are With Me", "og:description": " I'
|
||||
+ ' didn't mean to blow off all my responsibilities yesterday, but when a schmoozy Hollywood luncheon'
|
||||
+ ' turns into a full-on party by 3pm, and...", "og:url": "'
|
||||
+ 'http://www.laweekly.com/arts/these-clowns-are-with-me-2371051", "article:published_time": '
|
||||
+ '"2006-03-04T17:03:42-08:00", "article:modified_time": "2014-11-25T17:05:47-08:00", "article:section":'
|
||||
+ ' "Arts", "og:image": "'
|
||||
+ 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",'
|
||||
+ ' "og:image:height": "375", "og:image:width": "500", "og:site_name": "LA Weekly", "twitter:title":'
|
||||
+ ' "These Clowns Are With Me", "twitter:description": " I didn't mean to blow off all'
|
||||
+ ' my responsibilities yesterday, but when a schmoozy Hollywood luncheon turns into a full-on party by'
|
||||
+ ' 3pm, and...", "twitter:card": "summary", "twitter:image": "'
|
||||
+ 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",'
|
||||
+ ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/shopping-daze-2373807",'
|
||||
+ ' "og:type": "article", "og:title": "Shopping Daze", "og:description": "LA Weekly is the definitive '
|
||||
+ 'source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",'
|
||||
+ ' "og:url": "http://www.laweekly.com/arts/shopping-daze-2373807", "article:published_time":'
|
||||
+ ' "2006-12-13T12:12:04-08:00", "article:modified_time": "2014-11-25T20:15:21-08:00", "article:section":'
|
||||
+ ' "Arts", "og:site_name": "LA Weekly", "twitter:title": "Shopping Daze", "twitter:description": "LA'
|
||||
+ ' Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and'
|
||||
+ ' events in Los Angeles.", "twitter:card": "summary", "twitter:site": "@laweekly" } machine.os:osx'
|
||||
+ ' machine.ram:15,032,385,536 _id:AU_x3_g3GFA8no6QjkFm _type:apache _index:logstash-2015.09.20 _score: -'
|
||||
+ ' relatedContent.article:modified_time:October 28th 2014, 22:00:08.000, November 26th 2014,'
|
||||
+ ' 01:05:47.000, November 26th 2014, 03:52:35.000, November 26th 2014, 04:15:21.000, November 27th 2014,'
|
||||
+ ' 16:01:03.000 relatedContent.article:published_time:October 21st 2005, 01:10:25.000, March 5th 2006,'
|
||||
+ ' 01:03:42.000, December 13th 2006, 20:12:04.000, April 4th 2008, 23:00:00.000, April 25th 2008,'
|
||||
+ ' 14:26:41.000';
|
||||
return discoverPage.clickDocSortDown()
|
||||
.then(function () {
|
||||
// we don't technically need this sleep here because the tryForTime will retry and the
|
||||
// results will match on the 2nd or 3rd attempt, but that debug output is huge in this
|
||||
// case and it can be avoided with just a few seconds sleep.
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getDocTableIndex(1)
|
||||
.then(function (rowData) {
|
||||
expect(rowData).to.be(ExpectedDoc);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('doc view should sort ascending', function () {
|
||||
// Note: Could just check the timestamp, but might as well check that the whole doc is as expected.
|
||||
var ExpectedDoc =
|
||||
'September 20th 2015, 00:00:00.000 index:logstash-2015.09.20 @timestamp:September 20th 2015, 00:00:00.000'
|
||||
+ ' ip:143.84.142.7 extension:jpg response:200 geo.coordinates:{ "lat": 38.68407028, "lon": -120.9871642 }'
|
||||
+ ' geo.src:ES geo.dest:US geo.srcdest:ES:US @tags:error, info utc_time:September 20th 2015, 00:00:00.000'
|
||||
+ ' referer:http://www.slate.com/success/vladimir-kovalyonok agent:Mozilla/4.0 (compatible; MSIE 6.0;'
|
||||
+ ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:143.84.142.7 bytes:1,623'
|
||||
+ ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/steven-hawley.jpg'
|
||||
+ ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/steven-hawley.jpg'
|
||||
+ ' @message:143.84.142.7 - - [2015-09-20T00:00:00.000Z] "GET /uploads/steven-hawley.jpg HTTP/1.1" 200'
|
||||
+ ' 1623 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a'
|
||||
+ ' thing with lots of spaces wwwwoooooo xss:<script>console.log("xss")</script>'
|
||||
+ ' headings:<h3>kimiya-yui</h5>, http://www.slate.com/success/koichi-wakata'
|
||||
+ ' links:thomas-marshburn@twitter.com, http://www.slate.com/info/michael-p-anderson, www.twitter.com'
|
||||
+ ' relatedContent:{ "url":'
|
||||
+ ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",'
|
||||
+ ' "og:type": "article", "og:title": "Jay Electronica: Much Better Than His Name Would Suggest",'
|
||||
+ ' "og:description": "You may not know who Jay Electronica is yet, but I'm willing to bet that you'
|
||||
+ ' would had he chosen a better name. Jay Electronica does not sound like the ...", "og:url":'
|
||||
+ ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",'
|
||||
+ ' "article:published_time": "2008-04-04T16:00:00-07:00", "article:modified_time":'
|
||||
+ ' "2014-11-27T08:01:03-08:00", "article:section": "Music", "og:site_name": "LA Weekly", "twitter:title":'
|
||||
+ ' "Jay Electronica: Much Better Than His Name Would Suggest", "twitter:description": "You may not know'
|
||||
+ ' who Jay Electronica is yet, but I'm willing to bet that you would had he chosen a better name.'
|
||||
+ ' Jay Electronica does not sound like the ...", "twitter:card": "summary", "twitter:site": "@laweekly"'
|
||||
+ ' }, { "url": "http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "og:type":'
|
||||
+ ' "article", "og:title": "MANDOE On Gower Near Fountain", "og:description": "MANDOE has a stunner on a'
|
||||
+ ' wall north of an east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE'
|
||||
+ ' and FUKM are listed on t...", "og:url": "'
|
||||
+ 'http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "article:published_time":'
|
||||
+ ' "2008-04-25T07:26:41-07:00", "article:modified_time": "2014-10-28T15:00:08-07:00", "article:section":'
|
||||
+ ' "News", "og:image": "'
|
||||
+ 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg",'
|
||||
+ ' "og:image:height": "640", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": '
|
||||
+ '"MANDOE On Gower Near Fountain", "twitter:description": "MANDOE has a stunner on a wall north of an'
|
||||
+ ' east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE and FUKM are'
|
||||
+ ' listed on t...", "twitter:card": "summary", "twitter:image": "'
|
||||
+ 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg", '
|
||||
+ '"twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",'
|
||||
+ ' "og:type": "article", "og:title": "Meghan Finds The Love", "og:description": "LA Weekly is the'
|
||||
+ ' definitive source of information for news, music, movies, restaurants, reviews, and events in Los'
|
||||
+ ' Angeles.", "og:url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",'
|
||||
+ ' "article:published_time": "2005-10-20T18:10:25-07:00", "article:modified_time":'
|
||||
+ ' "2014-11-25T19:52:35-08:00", "article:section": "Arts", "og:site_name": "LA Weekly", "twitter:title":'
|
||||
+ ' "Meghan Finds The Love", "twitter:description": "LA Weekly is the definitive source of information for'
|
||||
+ ' news, music, movies, restaurants, reviews, and events in Los Angeles.", "twitter:card": "summary",'
|
||||
+ ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/these-clowns-are-with-me-2371051'
|
||||
+ '", "og:type": "article", "og:title": "These Clowns Are With Me", "og:description": " I'
|
||||
+ ' didn't mean to blow off all my responsibilities yesterday, but when a schmoozy Hollywood luncheon'
|
||||
+ ' turns into a full-on party by 3pm, and...", "og:url": "'
|
||||
+ 'http://www.laweekly.com/arts/these-clowns-are-with-me-2371051", "article:published_time": '
|
||||
+ '"2006-03-04T17:03:42-08:00", "article:modified_time": "2014-11-25T17:05:47-08:00", "article:section":'
|
||||
+ ' "Arts", "og:image": "'
|
||||
+ 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",'
|
||||
+ ' "og:image:height": "375", "og:image:width": "500", "og:site_name": "LA Weekly", "twitter:title":'
|
||||
+ ' "These Clowns Are With Me", "twitter:description": " I didn't mean to blow off all'
|
||||
+ ' my responsibilities yesterday, but when a schmoozy Hollywood luncheon turns into a full-on party by'
|
||||
+ ' 3pm, and...", "twitter:card": "summary", "twitter:image": "'
|
||||
+ 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",'
|
||||
+ ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/shopping-daze-2373807",'
|
||||
+ ' "og:type": "article", "og:title": "Shopping Daze", "og:description": "LA Weekly is the definitive '
|
||||
+ 'source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",'
|
||||
+ ' "og:url": "http://www.laweekly.com/arts/shopping-daze-2373807", "article:published_time":'
|
||||
+ ' "2006-12-13T12:12:04-08:00", "article:modified_time": "2014-11-25T20:15:21-08:00", "article:section":'
|
||||
+ ' "Arts", "og:site_name": "LA Weekly", "twitter:title": "Shopping Daze", "twitter:description": "LA'
|
||||
+ ' Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and'
|
||||
+ ' events in Los Angeles.", "twitter:card": "summary", "twitter:site": "@laweekly" } machine.os:osx'
|
||||
+ ' machine.ram:15,032,385,536 _id:AU_x3_g3GFA8no6QjkFm _type:apache _index:logstash-2015.09.20 _score: -'
|
||||
+ ' relatedContent.article:modified_time:October 28th 2014, 22:00:08.000, November 26th 2014,'
|
||||
+ ' 01:05:47.000, November 26th 2014, 03:52:35.000, November 26th 2014, 04:15:21.000, November 27th 2014,'
|
||||
+ ' 16:01:03.000 relatedContent.article:published_time:October 21st 2005, 01:10:25.000, March 5th 2006,'
|
||||
+ ' 01:03:42.000, December 13th 2006, 20:12:04.000, April 4th 2008, 23:00:00.000, April 25th 2008,'
|
||||
+ ' 14:26:41.000';
|
||||
return discoverPage.clickDocSortDown()
|
||||
.then(function () {
|
||||
// we don't technically need this sleep here because the tryForTime will retry and the
|
||||
// results will match on the 2nd or 3rd attempt, but that debug output is huge in this
|
||||
// case and it can be avoided with just a few seconds sleep.
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getDocTableIndex(1)
|
||||
.then(function (rowData) {
|
||||
expect(rowData).to.be(ExpectedDoc);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('a bad syntax query should show an error message', function () {
|
||||
var expectedHitCount = '1011,156';
|
||||
var expectedError = 'Discover: Failed to parse query [xxx(yyy]';
|
||||
return discoverPage.query('xxx(yyy')
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
expect(toastMessage).to.be(expectedError);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.clickToastOK();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
|
||||
bdd.it('a bad syntax query should show an error message', function () {
|
||||
var expectedHitCount = '1011,156';
|
||||
var expectedError = 'Discover: Failed to parse query [xxx(yyy]';
|
||||
return discoverPage.query('xxx(yyy')
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
expect(toastMessage).to.be(expectedError);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.clickToastOK();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,54 +9,50 @@ import {
|
|||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('field filters', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
bdd.describe('field filters', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize_field-filters','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function () {
|
||||
//After hiding the time picker, we need to wait for
|
||||
//the refresh button to hide before clicking the share button
|
||||
return common.sleep(1000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize_field-filters','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function () {
|
||||
//After hiding the time picker, we need to wait for
|
||||
//the refresh button to hide before clicking the share button
|
||||
return common.sleep(1000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('field filters', function () {
|
||||
bdd.describe('field filters', function () {
|
||||
|
||||
bdd.it('should not get the field referer', function () {
|
||||
return discoverPage.getAllFieldNames()
|
||||
.then(function (fieldNames) {
|
||||
expect(fieldNames).to.not.contain('referer');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
});
|
||||
bdd.it('should not get the field referer', function () {
|
||||
return discoverPage.getAllFieldNames()
|
||||
.then(function (fieldNames) {
|
||||
expect(fieldNames).to.not.contain('referer');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,131 +9,121 @@ import {
|
|||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('shared links', function describeIndexTests() {
|
||||
var baseUrl;
|
||||
// The message changes for Firefox < 41 and Firefox >= 41
|
||||
// var expectedToastMessage = 'Share search: URL selected. Press Ctrl+C to copy.';
|
||||
// var expectedToastMessage = 'Share search: URL copied to clipboard.';
|
||||
// Pass either one.
|
||||
var expectedToastMessage = /Share search: URL (selected\. Press Ctrl\+C to copy\.|copied to clipboard\.)/;
|
||||
bdd.describe('shared links', function describeIndexTests() {
|
||||
var baseUrl;
|
||||
// The message changes for Firefox < 41 and Firefox >= 41
|
||||
// var expectedToastMessage = 'Share search: URL selected. Press Ctrl+C to copy.';
|
||||
// var expectedToastMessage = 'Share search: URL copied to clipboard.';
|
||||
// Pass either one.
|
||||
var expectedToastMessage = /Share search: URL (selected\. Press Ctrl\+C to copy\.|copied to clipboard\.)/;
|
||||
|
||||
bdd.before(function () {
|
||||
baseUrl = common.getHostPort();
|
||||
bdd.before(function () {
|
||||
baseUrl = common.getHostPort();
|
||||
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function () {
|
||||
//After hiding the time picker, we need to wait for
|
||||
//the refresh button to hide before clicking the share button
|
||||
return common.sleep(1000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function () {
|
||||
//After hiding the time picker, we need to wait for
|
||||
//the refresh button to hide before clicking the share button
|
||||
return common.sleep(1000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('shared link', function () {
|
||||
|
||||
bdd.it('should show "Share a link" caption', function () {
|
||||
var expectedCaption = 'Share a link';
|
||||
return discoverPage.clickShare()
|
||||
.then(function () {
|
||||
return discoverPage.getShareCaption();
|
||||
})
|
||||
.then(function (actualCaption) {
|
||||
expect(actualCaption).to.be(expectedCaption);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show the correct formatted URL', function () {
|
||||
var expectedUrl = baseUrl
|
||||
+ '/app/kibana?_t=1453775307251#'
|
||||
+ '/discover?_g=(refreshInterval:(display:Off,pause:!f,value:0),time'
|
||||
+ ':(from:\'2015-09-19T06:31:44.000Z\',mode:absolute,to:\'2015-09'
|
||||
+ '-23T18:31:44.000Z\'))&_a=(columns:!(_source),index:\'logstash-'
|
||||
+ '*\',interval:auto,query:(query_string:(analyze_wildcard:!t,query'
|
||||
+ ':\'*\')),sort:!(\'@timestamp\',desc))';
|
||||
return discoverPage.getSharedUrl()
|
||||
.then(function (actualUrl) {
|
||||
// strip the timestamp out of each URL
|
||||
expect(actualUrl.replace(/_t=\d{13}/,'_t=TIMESTAMP'))
|
||||
|
||||
.to.be(expectedUrl.replace(/_t=\d{13}/,'_t=TIMESTAMP'));
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show toast message for copy to clipboard', function () {
|
||||
return discoverPage.clickCopyToClipboard()
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
expect(toastMessage).to.match(expectedToastMessage);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.waitForToastMessageGone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
// TODO: verify clipboard contents
|
||||
|
||||
bdd.it('shorten URL button should produce a short URL', function () {
|
||||
var re = new RegExp(baseUrl + '/goto/[0-9a-f]{32}$');
|
||||
return discoverPage.clickShortenUrl()
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getShortenedUrl()
|
||||
.then(function (actualUrl) {
|
||||
expect(actualUrl).to.match(re);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
// NOTE: This test has to run immediately after the test above
|
||||
bdd.it('should show toast message for copy to clipboard', function () {
|
||||
return discoverPage.clickCopyToClipboard()
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
expect(toastMessage).to.match(expectedToastMessage);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.waitForToastMessageGone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
bdd.describe('shared link', function () {
|
||||
bdd.it('should show "Share a link" caption', function () {
|
||||
var expectedCaption = 'Share a link';
|
||||
return discoverPage.clickShare()
|
||||
.then(function () {
|
||||
return discoverPage.getShareCaption();
|
||||
})
|
||||
.then(function (actualCaption) {
|
||||
expect(actualCaption).to.be(expectedCaption);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
bdd.it('should show the correct formatted URL', function () {
|
||||
var expectedUrl = baseUrl
|
||||
+ '/app/kibana?_t=1453775307251#'
|
||||
+ '/discover?_g=(refreshInterval:(display:Off,pause:!f,value:0),time'
|
||||
+ ':(from:\'2015-09-19T06:31:44.000Z\',mode:absolute,to:\'2015-09'
|
||||
+ '-23T18:31:44.000Z\'))&_a=(columns:!(_source),index:\'logstash-'
|
||||
+ '*\',interval:auto,query:(query_string:(analyze_wildcard:!t,query'
|
||||
+ ':\'*\')),sort:!(\'@timestamp\',desc))';
|
||||
return discoverPage.getSharedUrl()
|
||||
.then(function (actualUrl) {
|
||||
// strip the timestamp out of each URL
|
||||
expect(actualUrl.replace(/_t=\d{13}/,'_t=TIMESTAMP'))
|
||||
.to.be(expectedUrl.replace(/_t=\d{13}/,'_t=TIMESTAMP'));
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show toast message for copy to clipboard', function () {
|
||||
return discoverPage.clickCopyToClipboard()
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
expect(toastMessage).to.match(expectedToastMessage);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.waitForToastMessageGone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
// TODO: verify clipboard contents
|
||||
bdd.it('shorten URL button should produce a short URL', function () {
|
||||
var re = new RegExp(baseUrl + '/goto/[0-9a-f]{32}$');
|
||||
return discoverPage.clickShortenUrl()
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getShortenedUrl()
|
||||
.then(function (actualUrl) {
|
||||
expect(actualUrl).to.match(re);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
// NOTE: This test has to run immediately after the test above
|
||||
bdd.it('should show toast message for copy to clipboard', function () {
|
||||
return discoverPage.clickCopyToClipboard()
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
expect(toastMessage).to.match(expectedToastMessage);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.waitForToastMessageGone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support';
|
||||
|
||||
(function () {
|
||||
bdd.describe('discover app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
bdd.describe('discover app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
|
||||
bdd.before(function () {
|
||||
return remote.setWindowSize(1200,800);
|
||||
});
|
||||
|
||||
bdd.after(function unloadMakelogs() {
|
||||
return scenarioManager.unload('logstashFunctional');
|
||||
});
|
||||
|
||||
require('./_discover');
|
||||
require('./_field_data');
|
||||
require('./_shared_links');
|
||||
require('./_collapse_expand');
|
||||
require('./_field_filters');
|
||||
bdd.before(function () {
|
||||
return remote.setWindowSize(1200,800);
|
||||
});
|
||||
}());
|
||||
|
||||
bdd.after(function unloadMakelogs() {
|
||||
return scenarioManager.unload('logstashFunctional');
|
||||
});
|
||||
|
||||
require('./_discover');
|
||||
require('./_field_data');
|
||||
require('./_shared_links');
|
||||
require('./_collapse_expand');
|
||||
require('./_field_filters');
|
||||
});
|
||||
|
|
|
@ -6,40 +6,36 @@ import {
|
|||
esClient
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('creating and deleting default index', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.describe('index pattern creation', function indexPatternCreation() {
|
||||
bdd.before(function () {
|
||||
return settingsPage.createIndexPattern();
|
||||
});
|
||||
|
||||
bdd.it('should allow setting advanced settings', function () {
|
||||
return settingsPage.clickAdvancedTab()
|
||||
.then(function TestCallSetAdvancedSettingsForTimezone() {
|
||||
common.debug('calling setAdvancedSetting');
|
||||
return settingsPage.setAdvancedSettings('dateFormat:tz', 'America/Phoenix');
|
||||
})
|
||||
.then(function GetAdvancedSetting() {
|
||||
return settingsPage.getAdvancedSettings('dateFormat:tz');
|
||||
})
|
||||
.then(function (advancedSetting) {
|
||||
expect(advancedSetting).to.be('America/Phoenix');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
});
|
||||
bdd.describe('creating and deleting default index', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
}());
|
||||
}());
|
||||
});
|
||||
|
||||
bdd.describe('index pattern creation', function indexPatternCreation() {
|
||||
bdd.before(function () {
|
||||
return settingsPage.createIndexPattern();
|
||||
});
|
||||
|
||||
bdd.it('should allow setting advanced settings', function () {
|
||||
return settingsPage.clickAdvancedTab()
|
||||
.then(function TestCallSetAdvancedSettingsForTimezone() {
|
||||
common.debug('calling setAdvancedSetting');
|
||||
return settingsPage.setAdvancedSettings('dateFormat:tz', 'America/Phoenix');
|
||||
})
|
||||
.then(function GetAdvancedSetting() {
|
||||
return settingsPage.getAdvancedSettings('dateFormat:tz');
|
||||
})
|
||||
.then(function (advancedSetting) {
|
||||
expect(advancedSetting).to.be('America/Phoenix');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,54 +6,50 @@ import {
|
|||
esClient
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('user input reactions', function () {
|
||||
bdd.beforeEach(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should hide time-based index pattern when time-based option is unchecked', function () {
|
||||
var self = this;
|
||||
return settingsPage.getTimeBasedEventsCheckbox()
|
||||
.then(function (selected) {
|
||||
// uncheck the 'time-based events' checkbox
|
||||
return selected.click();
|
||||
})
|
||||
// try to find the checkbox (this shouldn fail)
|
||||
.then(function () {
|
||||
var waitTime = 10000;
|
||||
return settingsPage.getTimeBasedIndexPatternCheckbox(waitTime);
|
||||
})
|
||||
.then(function () {
|
||||
// we expect the promise above to fail
|
||||
var handler = common.handleError(self);
|
||||
var msg = 'Found time based index pattern checkbox';
|
||||
handler(msg);
|
||||
})
|
||||
.catch(function () {
|
||||
// we expect this failure since checkbox should be hidden
|
||||
return;
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should enable creation after selecting time field', function () {
|
||||
// select a time field and check that Create button is enabled
|
||||
return settingsPage.selectTimeFieldOption('@timestamp')
|
||||
.then(function () {
|
||||
return settingsPage.getCreateButton().isEnabled()
|
||||
.then(function (enabled) {
|
||||
expect(enabled).to.be.ok();
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
bdd.describe('user input reactions', function () {
|
||||
bdd.beforeEach(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
}());
|
||||
}());
|
||||
});
|
||||
|
||||
bdd.it('should hide time-based index pattern when time-based option is unchecked', function () {
|
||||
var self = this;
|
||||
return settingsPage.getTimeBasedEventsCheckbox()
|
||||
.then(function (selected) {
|
||||
// uncheck the 'time-based events' checkbox
|
||||
return selected.click();
|
||||
})
|
||||
// try to find the checkbox (this shouldn fail)
|
||||
.then(function () {
|
||||
var waitTime = 10000;
|
||||
return settingsPage.getTimeBasedIndexPatternCheckbox(waitTime);
|
||||
})
|
||||
.then(function () {
|
||||
// we expect the promise above to fail
|
||||
var handler = common.handleError(self);
|
||||
var msg = 'Found time based index pattern checkbox';
|
||||
handler(msg);
|
||||
})
|
||||
.catch(function () {
|
||||
// we expect this failure since checkbox should be hidden
|
||||
return;
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should enable creation after selecting time field', function () {
|
||||
// select a time field and check that Create button is enabled
|
||||
return settingsPage.selectTimeFieldOption('@timestamp')
|
||||
.then(function () {
|
||||
return settingsPage.getCreateButton().isEnabled()
|
||||
.then(function (enabled) {
|
||||
expect(enabled).to.be.ok();
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,100 +7,96 @@ import {
|
|||
esClient
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('creating and deleting default index', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
bdd.describe('creating and deleting default index', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.describe('index pattern creation', function indexPatternCreation() {
|
||||
bdd.before(function () {
|
||||
return settingsPage.createIndexPattern();
|
||||
});
|
||||
|
||||
bdd.it('should have index pattern in page header', function pageHeader() {
|
||||
return settingsPage.getIndexPageHeading().getVisibleText()
|
||||
.then(function (patternName) {
|
||||
expect(patternName).to.be('logstash-*');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should have index pattern in url', function url() {
|
||||
return common.try(function tryingForTime() {
|
||||
return remote.getCurrentUrl()
|
||||
.then(function (currentUrl) {
|
||||
expect(currentUrl).to.contain('logstash-*');
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.describe('index pattern creation', function indexPatternCreation() {
|
||||
bdd.before(function () {
|
||||
return settingsPage.createIndexPattern();
|
||||
});
|
||||
bdd.it('should have expected table headers', function checkingHeader() {
|
||||
return settingsPage.getTableHeader()
|
||||
.then(function (headers) {
|
||||
common.debug('header.length = ' + headers.length);
|
||||
var expectedHeaders = [
|
||||
'name',
|
||||
'type',
|
||||
'format',
|
||||
'analyzed',
|
||||
'indexed',
|
||||
'exclude',
|
||||
'controls'
|
||||
];
|
||||
|
||||
bdd.it('should have index pattern in page header', function pageHeader() {
|
||||
return settingsPage.getIndexPageHeading().getVisibleText()
|
||||
.then(function (patternName) {
|
||||
expect(patternName).to.be('logstash-*');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
// 7 name type format analyzed indexed exclude controls
|
||||
expect(headers.length).to.be(expectedHeaders.length);
|
||||
|
||||
bdd.it('should have index pattern in url', function url() {
|
||||
return common.try(function tryingForTime() {
|
||||
return remote.getCurrentUrl()
|
||||
.then(function (currentUrl) {
|
||||
expect(currentUrl).to.contain('logstash-*');
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should have expected table headers', function checkingHeader() {
|
||||
return settingsPage.getTableHeader()
|
||||
.then(function (headers) {
|
||||
common.debug('header.length = ' + headers.length);
|
||||
var expectedHeaders = [
|
||||
'name',
|
||||
'type',
|
||||
'format',
|
||||
'analyzed',
|
||||
'indexed',
|
||||
'exclude',
|
||||
'controls'
|
||||
];
|
||||
|
||||
// 6 name type format analyzed indexed controls
|
||||
expect(headers.length).to.be(expectedHeaders.length);
|
||||
|
||||
var comparedHeaders = headers.map(function compareHead(header, i) {
|
||||
return header.getVisibleText()
|
||||
.then(function (text) {
|
||||
expect(text).to.be(expectedHeaders[i]);
|
||||
});
|
||||
});
|
||||
|
||||
return Promise.all(comparedHeaders);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
|
||||
bdd.describe('index pattern deletion', function indexDelete() {
|
||||
bdd.before(function () {
|
||||
var expectedAlertText = 'Are you sure you want to remove this index pattern?';
|
||||
return settingsPage.removeIndexPattern()
|
||||
.then(function (alertText) {
|
||||
expect(alertText).to.be(expectedAlertText);
|
||||
var comparedHeaders = headers.map(function compareHead(header, i) {
|
||||
return header.getVisibleText()
|
||||
.then(function (text) {
|
||||
expect(text).to.be(expectedHeaders[i]);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should return to index pattern creation page', function returnToPage() {
|
||||
return common.try(function tryingForTime() {
|
||||
return settingsPage.getCreateButton();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
return Promise.all(comparedHeaders);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should remove index pattern from url', function indexNotInUrl() {
|
||||
// give the url time to settle
|
||||
return common.try(function tryingForTime() {
|
||||
return remote.getCurrentUrl()
|
||||
.then(function (currentUrl) {
|
||||
common.debug('currentUrl = ' + currentUrl);
|
||||
expect(currentUrl).to.not.contain('logstash-*');
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
bdd.describe('index pattern deletion', function indexDelete() {
|
||||
bdd.before(function () {
|
||||
var expectedAlertText = 'Are you sure you want to remove this index pattern?';
|
||||
return settingsPage.removeIndexPattern()
|
||||
.then(function (alertText) {
|
||||
expect(alertText).to.be(expectedAlertText);
|
||||
});
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
bdd.it('should return to index pattern creation page', function returnToPage() {
|
||||
return common.try(function tryingForTime() {
|
||||
return settingsPage.getCreateButton();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should remove index pattern from url', function indexNotInUrl() {
|
||||
// give the url time to settle
|
||||
return common.try(function tryingForTime() {
|
||||
return remote.getCurrentUrl()
|
||||
.then(function (currentUrl) {
|
||||
common.debug('currentUrl = ' + currentUrl);
|
||||
expect(currentUrl).to.not.contain('logstash-*');
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,109 +6,105 @@ import {
|
|||
esClient
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('index result popularity', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
bdd.describe('index result popularity', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.beforeEach(function be() {
|
||||
return settingsPage.createIndexPattern();
|
||||
});
|
||||
|
||||
bdd.afterEach(function ae() {
|
||||
return settingsPage.removeIndexPattern();
|
||||
});
|
||||
|
||||
bdd.describe('change popularity', function indexPatternCreation() {
|
||||
var fieldName = 'geo.coordinates';
|
||||
|
||||
// set the page size to All again, https://github.com/elastic/kibana/issues/5030
|
||||
// TODO: remove this after issue #5030 is closed
|
||||
function fix5030() {
|
||||
return settingsPage.setPageSize('All')
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
});
|
||||
}
|
||||
|
||||
bdd.beforeEach(function be() {
|
||||
return settingsPage.createIndexPattern();
|
||||
bdd.beforeEach(function () {
|
||||
// increase Popularity of geo.coordinates
|
||||
return settingsPage.setPageSize('All')
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
})
|
||||
.then(function openControlsByName() {
|
||||
common.debug('Starting openControlsByName (' + fieldName + ')');
|
||||
return settingsPage.openControlsByName(fieldName);
|
||||
})
|
||||
.then(function increasePopularity() {
|
||||
common.debug('increasePopularity');
|
||||
return settingsPage.increasePopularity();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.afterEach(function ae() {
|
||||
return settingsPage.removeIndexPattern();
|
||||
});
|
||||
bdd.afterEach(function () {
|
||||
// Cancel saving the popularity change (we didn't make a change in this case, just checking the value)
|
||||
return settingsPage.controlChangeCancel();
|
||||
});
|
||||
|
||||
bdd.describe('change popularity', function indexPatternCreation() {
|
||||
var fieldName = 'geo.coordinates';
|
||||
bdd.it('should update the popularity input', function () {
|
||||
return settingsPage.getPopularity()
|
||||
.then(function (popularity) {
|
||||
common.debug('popularity = ' + popularity);
|
||||
expect(popularity).to.be('1');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
// set the page size to All again, https://github.com/elastic/kibana/issues/5030
|
||||
// TODO: remove this after issue #5030 is closed
|
||||
function fix5030() {
|
||||
return settingsPage.setPageSize('All')
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
});
|
||||
}
|
||||
bdd.it('should be reset on cancel', function pageHeader() {
|
||||
// Cancel saving the popularity change
|
||||
return settingsPage.controlChangeCancel()
|
||||
.then(function () {
|
||||
return fix5030();
|
||||
})
|
||||
.then(function openControlsByName() {
|
||||
return settingsPage.openControlsByName(fieldName);
|
||||
})
|
||||
// check that its 0 (previous increase was cancelled)
|
||||
.then(function getPopularity() {
|
||||
return settingsPage.getPopularity();
|
||||
})
|
||||
.then(function (popularity) {
|
||||
common.debug('popularity = ' + popularity);
|
||||
expect(popularity).to.be('0');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.beforeEach(function () {
|
||||
// increase Popularity of geo.coordinates
|
||||
return settingsPage.setPageSize('All')
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
})
|
||||
.then(function openControlsByName() {
|
||||
common.debug('Starting openControlsByName (' + fieldName + ')');
|
||||
return settingsPage.openControlsByName(fieldName);
|
||||
})
|
||||
.then(function increasePopularity() {
|
||||
common.debug('increasePopularity');
|
||||
return settingsPage.increasePopularity();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.afterEach(function () {
|
||||
// Cancel saving the popularity change (we didn't make a change in this case, just checking the value)
|
||||
return settingsPage.controlChangeCancel();
|
||||
});
|
||||
|
||||
bdd.it('should update the popularity input', function () {
|
||||
return settingsPage.getPopularity()
|
||||
.then(function (popularity) {
|
||||
common.debug('popularity = ' + popularity);
|
||||
expect(popularity).to.be('1');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should be reset on cancel', function pageHeader() {
|
||||
// Cancel saving the popularity change
|
||||
return settingsPage.controlChangeCancel()
|
||||
.then(function () {
|
||||
return fix5030();
|
||||
})
|
||||
.then(function openControlsByName() {
|
||||
return settingsPage.openControlsByName(fieldName);
|
||||
})
|
||||
// check that its 0 (previous increase was cancelled)
|
||||
.then(function getPopularity() {
|
||||
return settingsPage.getPopularity();
|
||||
})
|
||||
.then(function (popularity) {
|
||||
common.debug('popularity = ' + popularity);
|
||||
expect(popularity).to.be('0');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('can be saved', function pageHeader() {
|
||||
// Saving the popularity change
|
||||
return settingsPage.controlChangeSave()
|
||||
.then(function () {
|
||||
return fix5030();
|
||||
})
|
||||
.then(function openControlsByName() {
|
||||
return settingsPage.openControlsByName(fieldName);
|
||||
})
|
||||
// check that its 0 (previous increase was cancelled)
|
||||
.then(function getPopularity() {
|
||||
return settingsPage.getPopularity();
|
||||
})
|
||||
.then(function (popularity) {
|
||||
common.debug('popularity = ' + popularity);
|
||||
expect(popularity).to.be('1');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}); // end 'change popularity'
|
||||
}); // end index result popularity
|
||||
}());
|
||||
}());
|
||||
bdd.it('can be saved', function pageHeader() {
|
||||
// Saving the popularity change
|
||||
return settingsPage.controlChangeSave()
|
||||
.then(function () {
|
||||
return fix5030();
|
||||
})
|
||||
.then(function openControlsByName() {
|
||||
return settingsPage.openControlsByName(fieldName);
|
||||
})
|
||||
// check that its 0 (previous increase was cancelled)
|
||||
.then(function getPopularity() {
|
||||
return settingsPage.getPopularity();
|
||||
})
|
||||
.then(function (popularity) {
|
||||
common.debug('popularity = ' + popularity);
|
||||
expect(popularity).to.be('1');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}); // end 'change popularity'
|
||||
}); // end index result popularity
|
||||
|
|
|
@ -7,129 +7,125 @@ import {
|
|||
esClient
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('index result field sort', function describeIndexTests() {
|
||||
bdd.describe('index result field sort', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc();
|
||||
});
|
||||
|
||||
var columns = [{
|
||||
heading: 'name',
|
||||
first: '@message',
|
||||
last: 'xss.raw',
|
||||
selector: function () {
|
||||
return settingsPage.getTableRow(0, 0).getVisibleText();
|
||||
}
|
||||
}, {
|
||||
heading: 'type',
|
||||
first: '_source',
|
||||
last: 'string',
|
||||
selector: function () {
|
||||
return settingsPage.getTableRow(0, 1).getVisibleText();
|
||||
}
|
||||
}];
|
||||
|
||||
columns.forEach(function (col) {
|
||||
bdd.describe('sort by heading - ' + col.heading, function indexPatternCreation() {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc();
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
|
||||
var columns = [{
|
||||
heading: 'name',
|
||||
first: '@message',
|
||||
last: 'xss.raw',
|
||||
selector: function () {
|
||||
return settingsPage.getTableRow(0, 0).getVisibleText();
|
||||
}
|
||||
}, {
|
||||
heading: 'type',
|
||||
first: '_source',
|
||||
last: 'string',
|
||||
selector: function () {
|
||||
return settingsPage.getTableRow(0, 1).getVisibleText();
|
||||
}
|
||||
}];
|
||||
bdd.beforeEach(function () {
|
||||
return settingsPage.createIndexPattern();
|
||||
});
|
||||
|
||||
columns.forEach(function (col) {
|
||||
bdd.describe('sort by heading - ' + col.heading, function indexPatternCreation() {
|
||||
bdd.before(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
bdd.afterEach(function () {
|
||||
return settingsPage.removeIndexPattern();
|
||||
});
|
||||
|
||||
bdd.beforeEach(function () {
|
||||
return settingsPage.createIndexPattern();
|
||||
});
|
||||
bdd.it('should sort ascending', function pageHeader() {
|
||||
return settingsPage.sortBy(col.heading)
|
||||
.then(function getText() {
|
||||
return col.selector();
|
||||
})
|
||||
.then(function (rowText) {
|
||||
expect(rowText).to.be(col.first);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.afterEach(function () {
|
||||
return settingsPage.removeIndexPattern();
|
||||
});
|
||||
bdd.it('should sort descending', function pageHeader() {
|
||||
return settingsPage.sortBy(col.heading)
|
||||
.then(function sortAgain() {
|
||||
return settingsPage.sortBy(col.heading);
|
||||
})
|
||||
.then(function getText() {
|
||||
return col.selector();
|
||||
})
|
||||
.then(function (rowText) {
|
||||
expect(rowText).to.be(col.last);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should sort ascending', function pageHeader() {
|
||||
return settingsPage.sortBy(col.heading)
|
||||
.then(function getText() {
|
||||
return col.selector();
|
||||
})
|
||||
.then(function (rowText) {
|
||||
expect(rowText).to.be(col.first);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
bdd.describe('field list pagination', function () {
|
||||
var expectedDefaultPageSize = 25;
|
||||
var expectedFieldCount = 85;
|
||||
var expectedLastPageCount = 10;
|
||||
var pages = [1, 2, 3, 4];
|
||||
|
||||
bdd.it('should sort descending', function pageHeader() {
|
||||
return settingsPage.sortBy(col.heading)
|
||||
.then(function sortAgain() {
|
||||
return settingsPage.sortBy(col.heading);
|
||||
})
|
||||
.then(function getText() {
|
||||
return col.selector();
|
||||
})
|
||||
.then(function (rowText) {
|
||||
expect(rowText).to.be(col.last);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
bdd.before(function () {
|
||||
return settingsPage.navigateTo()
|
||||
.then(function () {
|
||||
return settingsPage.createIndexPattern();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.after(function () {
|
||||
return settingsPage.removeIndexPattern();
|
||||
});
|
||||
|
||||
bdd.it('makelogs data should have expected number of fields', function () {
|
||||
return common.try(function () {
|
||||
return settingsPage.getFieldsTabCount()
|
||||
.then(function (tabCount) {
|
||||
expect(tabCount).to.be('' + expectedFieldCount);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.describe('field list pagination', function () {
|
||||
var expectedDefaultPageSize = 25;
|
||||
var expectedFieldCount = 85;
|
||||
var expectedLastPageCount = 10;
|
||||
var pages = [1, 2, 3, 4];
|
||||
bdd.it('should have correct default page size selected', function () {
|
||||
return settingsPage.getPageSize()
|
||||
.then(function (pageSize) {
|
||||
expect(pageSize).to.be('' + expectedDefaultPageSize);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.before(function () {
|
||||
return settingsPage.navigateTo()
|
||||
bdd.it('should have the correct number of rows per page', function () {
|
||||
var pageCount = Math.ceil(expectedFieldCount / expectedDefaultPageSize);
|
||||
var chain = pages.reduce(function (chain, val) {
|
||||
return chain.then(function () {
|
||||
return settingsPage.goToPage(val)
|
||||
.then(function () {
|
||||
return settingsPage.createIndexPattern();
|
||||
return common.sleep(1000);
|
||||
})
|
||||
.then(function () {
|
||||
return settingsPage.getPageFieldCount();
|
||||
})
|
||||
.then(function (pageCount) {
|
||||
var expectedSize = (val < 4) ? expectedDefaultPageSize : expectedLastPageCount;
|
||||
expect(pageCount.length).to.be(expectedSize);
|
||||
});
|
||||
});
|
||||
}, Promise.resolve());
|
||||
|
||||
bdd.after(function () {
|
||||
return settingsPage.removeIndexPattern();
|
||||
});
|
||||
|
||||
bdd.it('makelogs data should have expected number of fields', function () {
|
||||
return common.try(function () {
|
||||
return settingsPage.getFieldsTabCount()
|
||||
.then(function (tabCount) {
|
||||
expect(tabCount).to.be('' + expectedFieldCount);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should have correct default page size selected', function () {
|
||||
return settingsPage.getPageSize()
|
||||
.then(function (pageSize) {
|
||||
expect(pageSize).to.be('' + expectedDefaultPageSize);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should have the correct number of rows per page', function () {
|
||||
var pageCount = Math.ceil(expectedFieldCount / expectedDefaultPageSize);
|
||||
var chain = pages.reduce(function (chain, val) {
|
||||
return chain.then(function () {
|
||||
return settingsPage.goToPage(val)
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
})
|
||||
.then(function () {
|
||||
return settingsPage.getPageFieldCount();
|
||||
})
|
||||
.then(function (pageCount) {
|
||||
var expectedSize = (val < 4) ? expectedDefaultPageSize : expectedLastPageCount;
|
||||
expect(pageCount.length).to.be(expectedSize);
|
||||
});
|
||||
});
|
||||
}, Promise.resolve());
|
||||
|
||||
return chain.catch(common.handleError(this));
|
||||
});
|
||||
}); // end describe pagination
|
||||
}); // end index result field sort
|
||||
}());
|
||||
}());
|
||||
return chain.catch(common.handleError(this));
|
||||
});
|
||||
}); // end describe pagination
|
||||
}); // end index result field sort
|
||||
|
|
|
@ -6,61 +6,57 @@ import {
|
|||
esClient
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('initial state', function () {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should load with time pattern checked', function () {
|
||||
return settingsPage.getTimeBasedEventsCheckbox().isSelected()
|
||||
.then(function (selected) {
|
||||
expect(selected).to.be.ok();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should load with name pattern unchecked', function () {
|
||||
return settingsPage.getTimeBasedIndexPatternCheckbox().isSelected()
|
||||
.then(function (selected) {
|
||||
expect(selected).to.not.be.ok();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should contain default index pattern', function () {
|
||||
var defaultPattern = 'logstash-*';
|
||||
|
||||
return settingsPage.getIndexPatternField().getProperty('value')
|
||||
.then(function (pattern) {
|
||||
expect(pattern).to.be(defaultPattern);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should not select the time field', function () {
|
||||
return settingsPage.getTimeFieldNameField().isSelected()
|
||||
.then(function (timeFieldIsSelected) {
|
||||
common.debug('timeField isSelected = ' + timeFieldIsSelected);
|
||||
expect(timeFieldIsSelected).to.not.be.ok();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should not be enable creation', function () {
|
||||
return settingsPage.getCreateButton().isEnabled()
|
||||
.then(function (enabled) {
|
||||
expect(enabled).to.not.be.ok();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
bdd.describe('initial state', function () {
|
||||
bdd.before(function () {
|
||||
// delete .kibana index and then wait for Kibana to re-create it
|
||||
return esClient.deleteAndUpdateConfigDoc()
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
}());
|
||||
}());
|
||||
});
|
||||
|
||||
bdd.it('should load with time pattern checked', function () {
|
||||
return settingsPage.getTimeBasedEventsCheckbox().isSelected()
|
||||
.then(function (selected) {
|
||||
expect(selected).to.be.ok();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should load with name pattern unchecked', function () {
|
||||
return settingsPage.getTimeBasedIndexPatternCheckbox().isSelected()
|
||||
.then(function (selected) {
|
||||
expect(selected).to.not.be.ok();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should contain default index pattern', function () {
|
||||
var defaultPattern = 'logstash-*';
|
||||
|
||||
return settingsPage.getIndexPatternField().getProperty('value')
|
||||
.then(function (pattern) {
|
||||
expect(pattern).to.be(defaultPattern);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should not select the time field', function () {
|
||||
return settingsPage.getTimeFieldNameField().isSelected()
|
||||
.then(function (timeFieldIsSelected) {
|
||||
common.debug('timeField isSelected = ' + timeFieldIsSelected);
|
||||
expect(timeFieldIsSelected).to.not.be.ok();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should not be enable creation', function () {
|
||||
return settingsPage.getCreateButton().isEnabled()
|
||||
.then(function (enabled) {
|
||||
expect(enabled).to.not.be.ok();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
import { bdd, defaultTimeout, scenarioManager, esClient, common } from '../../../support';
|
||||
|
||||
(function () {
|
||||
bdd.describe('settings app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
bdd.describe('settings app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
|
||||
// on setup, we create an settingsPage instance
|
||||
// that we will use for all the tests
|
||||
bdd.before(function () {
|
||||
return scenarioManager.loadIfEmpty('makelogs');
|
||||
});
|
||||
|
||||
bdd.after(function () {
|
||||
return scenarioManager.unload('makelogs')
|
||||
.then(function () {
|
||||
return esClient.delete('.kibana');
|
||||
});
|
||||
});
|
||||
|
||||
require('./_initial_state');
|
||||
require('./_creation_form_changes');
|
||||
require('./_index_pattern_create_delete');
|
||||
require('./_index_pattern_results_sort');
|
||||
require('./_index_pattern_popularity');
|
||||
require('./_advanced_settings');
|
||||
// on setup, we create an settingsPage instance
|
||||
// that we will use for all the tests
|
||||
bdd.before(function () {
|
||||
return scenarioManager.loadIfEmpty('makelogs');
|
||||
});
|
||||
}());
|
||||
|
||||
bdd.after(function () {
|
||||
return scenarioManager.unload('makelogs')
|
||||
.then(function () {
|
||||
return esClient.delete('.kibana');
|
||||
});
|
||||
});
|
||||
|
||||
require('./_initial_state');
|
||||
require('./_creation_form_changes');
|
||||
require('./_index_pattern_create_delete');
|
||||
require('./_index_pattern_results_sort');
|
||||
require('./_index_pattern_popularity');
|
||||
require('./_advanced_settings');
|
||||
});
|
||||
|
|
|
@ -7,175 +7,171 @@ import {
|
|||
visualizePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickAreaChart');
|
||||
return visualizePage.clickAreaChart();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
common.debug('clickNewSearch');
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function clickBucket() {
|
||||
common.debug('Click X-Axis');
|
||||
return visualizePage.clickBucket('X-Axis');
|
||||
})
|
||||
.then(function selectAggregation() {
|
||||
common.debug('Click Date Histogram');
|
||||
return visualizePage.selectAggregation('Date Histogram');
|
||||
})
|
||||
.then(function getField() {
|
||||
common.debug('Check field value');
|
||||
return visualizePage.getField();
|
||||
})
|
||||
.then(function (fieldValue) {
|
||||
common.debug('fieldValue = ' + fieldValue);
|
||||
expect(fieldValue).to.be('@timestamp');
|
||||
})
|
||||
.then(function getInterval() {
|
||||
return visualizePage.getInterval();
|
||||
})
|
||||
.then(function (intervalValue) {
|
||||
common.debug('intervalValue = ' + intervalValue);
|
||||
expect(intervalValue).to.be('Auto');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function getSpinnerDone() {
|
||||
common.debug('Waiting...');
|
||||
return headerPage.getSpinnerDone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickAreaChart');
|
||||
return visualizePage.clickAreaChart();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
common.debug('clickNewSearch');
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function clickBucket() {
|
||||
common.debug('Click X-Axis');
|
||||
return visualizePage.clickBucket('X-Axis');
|
||||
})
|
||||
.then(function selectAggregation() {
|
||||
common.debug('Click Date Histogram');
|
||||
return visualizePage.selectAggregation('Date Histogram');
|
||||
})
|
||||
.then(function getField() {
|
||||
common.debug('Check field value');
|
||||
return visualizePage.getField();
|
||||
})
|
||||
.then(function (fieldValue) {
|
||||
common.debug('fieldValue = ' + fieldValue);
|
||||
expect(fieldValue).to.be('@timestamp');
|
||||
})
|
||||
.then(function getInterval() {
|
||||
return visualizePage.getInterval();
|
||||
})
|
||||
.then(function (intervalValue) {
|
||||
common.debug('intervalValue = ' + intervalValue);
|
||||
expect(intervalValue).to.be('Auto');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function getSpinnerDone() {
|
||||
common.debug('Waiting...');
|
||||
return headerPage.getSpinnerDone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.describe('area charts', function indexPatternCreation() {
|
||||
var testSubName = 'AreaChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
bdd.describe('area charts', function indexPatternCreation() {
|
||||
var testSubName = 'AreaChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
bdd.it('should save and load', function pageHeader() {
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function loadSavedVisualization() {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
// We have to sleep sometime between loading the saved visTitle
|
||||
// and trying to access the chart below with getXAxisLabels
|
||||
// otherwise it hangs.
|
||||
.then(function sleep() {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct chart, take screenshot', function pageHeader() {
|
||||
var chartHeight = 0;
|
||||
var xAxisLabels = [ '2015-09-20 00:00', '2015-09-21 00:00',
|
||||
'2015-09-22 00:00', '2015-09-23 00:00'
|
||||
];
|
||||
var yAxisLabels = ['0','200','400','600','800','1,000','1,200','1,400','1,600'];
|
||||
var expectedAreaChartData = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202,
|
||||
683, 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29
|
||||
];
|
||||
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getXAxisLabels()
|
||||
.then(function compareLabels(labels) {
|
||||
common.debug('X-Axis labels = ' + labels);
|
||||
expect(labels).to.eql(xAxisLabels);
|
||||
});
|
||||
})
|
||||
.then(function getYAxisLabels() {
|
||||
return visualizePage.getYAxisLabels();
|
||||
})
|
||||
.then(function (labels) {
|
||||
common.debug('Y-Axis labels = ' + labels);
|
||||
expect(labels).to.eql(yAxisLabels);
|
||||
})
|
||||
.then(function getAreaChartData() {
|
||||
return visualizePage.getAreaChartData('Count');
|
||||
})
|
||||
.then(function (paths) {
|
||||
common.debug('expectedAreaChartData = ' + expectedAreaChartData);
|
||||
common.debug('actual chart data = ' + paths);
|
||||
expect(paths).to.eql(expectedAreaChartData);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct data', function pageHeader() {
|
||||
var expectedTableData = [ 'September 20th 2015, 00:00:00.000 37',
|
||||
'September 20th 2015, 03:00:00.000 202',
|
||||
'September 20th 2015, 06:00:00.000 740',
|
||||
'September 20th 2015, 09:00:00.000 1,437',
|
||||
'September 20th 2015, 12:00:00.000 1,371',
|
||||
'September 20th 2015, 15:00:00.000 751',
|
||||
'September 20th 2015, 18:00:00.000 188',
|
||||
'September 20th 2015, 21:00:00.000 31',
|
||||
'September 21st 2015, 00:00:00.000 42',
|
||||
'September 21st 2015, 03:00:00.000 202',
|
||||
'September 21st 2015, 06:00:00.000 683',
|
||||
'September 21st 2015, 09:00:00.000 1,361',
|
||||
'September 21st 2015, 12:00:00.000 1,415',
|
||||
'September 21st 2015, 15:00:00.000 707',
|
||||
'September 21st 2015, 18:00:00.000 177',
|
||||
'September 21st 2015, 21:00:00.000 27',
|
||||
'September 22nd 2015, 00:00:00.000 32',
|
||||
'September 22nd 2015, 03:00:00.000 175',
|
||||
'September 22nd 2015, 06:00:00.000 707',
|
||||
'September 22nd 2015, 09:00:00.000 1,408',
|
||||
'September 22nd 2015, 12:00:00.000 1,355',
|
||||
'September 22nd 2015, 15:00:00.000 726',
|
||||
'September 22nd 2015, 18:00:00.000 201',
|
||||
'September 22nd 2015, 21:00:00.000 29'
|
||||
];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function setPageSize() {
|
||||
return settingsPage.setPageSize('All');
|
||||
})
|
||||
.then(function getDataTableData() {
|
||||
return visualizePage.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug('getDataTableData = ' + data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
bdd.it('should save and load', function pageHeader() {
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function loadSavedVisualization() {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
// We have to sleep sometime between loading the saved visTitle
|
||||
// and trying to access the chart below with getXAxisLabels
|
||||
// otherwise it hangs.
|
||||
.then(function sleep() {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
|
||||
bdd.it('should show correct chart, take screenshot', function pageHeader() {
|
||||
var chartHeight = 0;
|
||||
var xAxisLabels = [ '2015-09-20 00:00', '2015-09-21 00:00',
|
||||
'2015-09-22 00:00', '2015-09-23 00:00'
|
||||
];
|
||||
var yAxisLabels = ['0','200','400','600','800','1,000','1,200','1,400','1,600'];
|
||||
var expectedAreaChartData = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202,
|
||||
683, 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29
|
||||
];
|
||||
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getXAxisLabels()
|
||||
.then(function compareLabels(labels) {
|
||||
common.debug('X-Axis labels = ' + labels);
|
||||
expect(labels).to.eql(xAxisLabels);
|
||||
});
|
||||
})
|
||||
.then(function getYAxisLabels() {
|
||||
return visualizePage.getYAxisLabels();
|
||||
})
|
||||
.then(function (labels) {
|
||||
common.debug('Y-Axis labels = ' + labels);
|
||||
expect(labels).to.eql(yAxisLabels);
|
||||
})
|
||||
.then(function getAreaChartData() {
|
||||
return visualizePage.getAreaChartData('Count');
|
||||
})
|
||||
.then(function (paths) {
|
||||
common.debug('expectedAreaChartData = ' + expectedAreaChartData);
|
||||
common.debug('actual chart data = ' + paths);
|
||||
expect(paths).to.eql(expectedAreaChartData);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct data', function pageHeader() {
|
||||
var expectedTableData = [ 'September 20th 2015, 00:00:00.000 37',
|
||||
'September 20th 2015, 03:00:00.000 202',
|
||||
'September 20th 2015, 06:00:00.000 740',
|
||||
'September 20th 2015, 09:00:00.000 1,437',
|
||||
'September 20th 2015, 12:00:00.000 1,371',
|
||||
'September 20th 2015, 15:00:00.000 751',
|
||||
'September 20th 2015, 18:00:00.000 188',
|
||||
'September 20th 2015, 21:00:00.000 31',
|
||||
'September 21st 2015, 00:00:00.000 42',
|
||||
'September 21st 2015, 03:00:00.000 202',
|
||||
'September 21st 2015, 06:00:00.000 683',
|
||||
'September 21st 2015, 09:00:00.000 1,361',
|
||||
'September 21st 2015, 12:00:00.000 1,415',
|
||||
'September 21st 2015, 15:00:00.000 707',
|
||||
'September 21st 2015, 18:00:00.000 177',
|
||||
'September 21st 2015, 21:00:00.000 27',
|
||||
'September 22nd 2015, 00:00:00.000 32',
|
||||
'September 22nd 2015, 03:00:00.000 175',
|
||||
'September 22nd 2015, 06:00:00.000 707',
|
||||
'September 22nd 2015, 09:00:00.000 1,408',
|
||||
'September 22nd 2015, 12:00:00.000 1,355',
|
||||
'September 22nd 2015, 15:00:00.000 726',
|
||||
'September 22nd 2015, 18:00:00.000 201',
|
||||
'September 22nd 2015, 21:00:00.000 29'
|
||||
];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function setPageSize() {
|
||||
return settingsPage.setPageSize('All');
|
||||
})
|
||||
.then(function getDataTableData() {
|
||||
return visualizePage.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug('getDataTableData = ' + data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,35 +6,31 @@ import {
|
|||
visualizePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
|
||||
bdd.before(function () {
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize');
|
||||
});
|
||||
bdd.before(function () {
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize');
|
||||
});
|
||||
|
||||
bdd.describe('chart types', function indexPatternCreation() {
|
||||
bdd.describe('chart types', function indexPatternCreation() {
|
||||
|
||||
bdd.it('should show the correct chart types', function pageHeader() {
|
||||
bdd.it('should show the correct chart types', function pageHeader() {
|
||||
|
||||
var expectedChartTypes = [
|
||||
'Area chart', 'Data table', 'Line chart', 'Markdown widget',
|
||||
'Metric', 'Pie chart', 'Tile map', 'Vertical bar chart'
|
||||
];
|
||||
// find all the chart types and make sure there all there
|
||||
return visualizePage.getChartTypes()
|
||||
.then(function testChartTypes(chartTypes) {
|
||||
common.debug('returned chart types = ' + chartTypes);
|
||||
common.debug('expected chart types = ' + expectedChartTypes);
|
||||
expect(chartTypes).to.eql(expectedChartTypes);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
var expectedChartTypes = [
|
||||
'Area chart', 'Data table', 'Line chart', 'Markdown widget',
|
||||
'Metric', 'Pie chart', 'Tile map', 'Vertical bar chart'
|
||||
];
|
||||
// find all the chart types and make sure there all there
|
||||
return visualizePage.getChartTypes()
|
||||
.then(function testChartTypes(chartTypes) {
|
||||
common.debug('returned chart types = ' + chartTypes);
|
||||
common.debug('expected chart types = ' + expectedChartTypes);
|
||||
expect(chartTypes).to.eql(expectedChartTypes);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
}());
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,98 +7,94 @@ import {
|
|||
visualizePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
bdd.before(function () {
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickDataTable');
|
||||
return visualizePage.clickDataTable();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
common.debug('clickNewSearch');
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function clickBucket() {
|
||||
common.debug('Bucket = Split Rows');
|
||||
return visualizePage.clickBucket('Split Rows');
|
||||
})
|
||||
.then(function selectAggregation() {
|
||||
common.debug('Aggregation = Histogram');
|
||||
return visualizePage.selectAggregation('Histogram');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Field = bytes');
|
||||
return visualizePage.selectField('bytes');
|
||||
})
|
||||
.then(function setInterval() {
|
||||
common.debug('Interval = 2000');
|
||||
return visualizePage.setNumericInterval('2000');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
bdd.before(function () {
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickDataTable');
|
||||
return visualizePage.clickDataTable();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
common.debug('clickNewSearch');
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function clickBucket() {
|
||||
common.debug('Bucket = Split Rows');
|
||||
return visualizePage.clickBucket('Split Rows');
|
||||
})
|
||||
.then(function selectAggregation() {
|
||||
common.debug('Aggregation = Histogram');
|
||||
return visualizePage.selectAggregation('Histogram');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Field = bytes');
|
||||
return visualizePage.selectField('bytes');
|
||||
})
|
||||
.then(function setInterval() {
|
||||
common.debug('Interval = 2000');
|
||||
return visualizePage.setNumericInterval('2000');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('data table', function indexPatternCreation() {
|
||||
var testSubName = 'DataTable';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
bdd.describe('data table', function indexPatternCreation() {
|
||||
var testSubName = 'DataTable';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
bdd.it('should be able to save and load', function pageHeader() {
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct data, take screenshot', function pageHeader() {
|
||||
var chartHeight = 0;
|
||||
var expectedChartData = [ '0 2,088', '2,000 2,748', '4,000 2,707', '6,000 2,876',
|
||||
'8,000 2,863', '10,000 147', '12,000 148', '14,000 129', '16,000 161', '18,000 137'
|
||||
];
|
||||
|
||||
return visualizePage.getDataTableData()
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.split('\n')).to.eql(expectedChartData);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
bdd.it('should be able to save and load', function pageHeader() {
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
|
||||
bdd.it('should show correct data, take screenshot', function pageHeader() {
|
||||
var chartHeight = 0;
|
||||
var expectedChartData = [ '0 2,088', '2,000 2,748', '4,000 2,707', '6,000 2,876',
|
||||
'8,000 2,863', '10,000 147', '12,000 148', '14,000 129', '16,000 161', '18,000 137'
|
||||
];
|
||||
|
||||
return visualizePage.getDataTableData()
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.split('\n')).to.eql(expectedChartData);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,129 +7,125 @@ import {
|
|||
visualizePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickLineChart');
|
||||
return visualizePage.clickLineChart();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function clickBucket() {
|
||||
common.debug('Bucket = Split Chart');
|
||||
return visualizePage.clickBucket('Split Chart');
|
||||
})
|
||||
.then(function selectAggregation() {
|
||||
common.debug('Aggregation = Terms');
|
||||
return visualizePage.selectAggregation('Terms');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Field = extension');
|
||||
return visualizePage.selectField('extension.raw');
|
||||
})
|
||||
.then(function setInterval() {
|
||||
common.debug('switch from Rows to Columns');
|
||||
return visualizePage.clickColumns();
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone(); // only matches the hidden spinner
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickLineChart');
|
||||
return visualizePage.clickLineChart();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function clickBucket() {
|
||||
common.debug('Bucket = Split Chart');
|
||||
return visualizePage.clickBucket('Split Chart');
|
||||
})
|
||||
.then(function selectAggregation() {
|
||||
common.debug('Aggregation = Terms');
|
||||
return visualizePage.selectAggregation('Terms');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Field = extension');
|
||||
return visualizePage.selectField('extension.raw');
|
||||
})
|
||||
.then(function setInterval() {
|
||||
common.debug('switch from Rows to Columns');
|
||||
return visualizePage.clickColumns();
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone(); // only matches the hidden spinner
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.describe('line charts', function indexPatternCreation() {
|
||||
var testSubName = 'LineChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
bdd.describe('line charts', function indexPatternCreation() {
|
||||
var testSubName = 'LineChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
bdd.it('should be able to save and load', function pageHeader() {
|
||||
bdd.it('should be able to save and load', function pageHeader() {
|
||||
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var remote = this.remote;
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var remote = this.remote;
|
||||
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct chart, take screenshot', function pageHeader() {
|
||||
|
||||
var remote = this.remote;
|
||||
|
||||
// this test only verifies the numerical part of this data
|
||||
// it could also check the legend to verify the extensions
|
||||
var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445'];
|
||||
|
||||
// sleep a bit before trying to get the chart data
|
||||
return common.sleep(3000)
|
||||
.then(function () {
|
||||
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++) {
|
||||
common.debug('x=' + x + ' expectedChartData[x].split(\' \')[1] = ' +
|
||||
(expectedChartData[x].split(' ')[1]).replace(',', '') + ' data[x]=' + data[x] +
|
||||
' diff=' + Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x]));
|
||||
expect(Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x]) < tolerance).to.be.ok();
|
||||
}
|
||||
common.debug('Done');
|
||||
});
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
// take a snapshot just as an example.
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data', function pageHeader() {
|
||||
|
||||
var remote = this.remote;
|
||||
var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445'];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function getDataTableData() {
|
||||
return visualizePage.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
|
||||
bdd.it('should show correct chart, take screenshot', function pageHeader() {
|
||||
|
||||
var remote = this.remote;
|
||||
|
||||
// this test only verifies the numerical part of this data
|
||||
// it could also check the legend to verify the extensions
|
||||
var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445'];
|
||||
|
||||
// sleep a bit before trying to get the chart data
|
||||
return common.sleep(3000)
|
||||
.then(function () {
|
||||
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++) {
|
||||
common.debug('x=' + x + ' expectedChartData[x].split(\' \')[1] = ' +
|
||||
(expectedChartData[x].split(' ')[1]).replace(',', '') + ' data[x]=' + data[x] +
|
||||
' diff=' + Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x]));
|
||||
expect(Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x]) < tolerance).to.be.ok();
|
||||
}
|
||||
common.debug('Done');
|
||||
});
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
// take a snapshot just as an example.
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data', function pageHeader() {
|
||||
|
||||
var remote = this.remote;
|
||||
var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445'];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function getDataTableData() {
|
||||
return visualizePage.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,279 +7,275 @@ import {
|
|||
visualizePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
bdd.before(function () {
|
||||
bdd.before(function () {
|
||||
|
||||
var testSubName = 'MetricChart';
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
var testSubName = 'MetricChart';
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickMetric');
|
||||
return visualizePage.clickMetric();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickMetric');
|
||||
return visualizePage.clickMetric();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('metric chart', function indexPatternCreation() {
|
||||
bdd.describe('metric chart', function indexPatternCreation() {
|
||||
|
||||
bdd.it('should show Count', function pageHeader() {
|
||||
var expectedCount = ['14,004', 'Count'];
|
||||
bdd.it('should show Count', function pageHeader() {
|
||||
var expectedCount = ['14,004', 'Count'];
|
||||
|
||||
// initial metric of "Count" is selected by default
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(expectedCount).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
// initial metric of "Count" is selected by default
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(expectedCount).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
|
||||
bdd.it('should show Average', function pageHeader() {
|
||||
var avgMachineRam = ['13,104,036,080.615', 'Average machine.ram'];
|
||||
return visualizePage.clickMetricEditor()
|
||||
.then(function () {
|
||||
common.debug('Aggregation = Average');
|
||||
return visualizePage.selectAggregation('Average');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Field = machine.ram');
|
||||
return visualizePage.selectField('machine.ram');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(avgMachineRam).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Sum', function pageHeader() {
|
||||
var sumPhpMemory = ['85,865,880', 'Sum of phpmemory'];
|
||||
common.debug('Aggregation = Sum');
|
||||
return visualizePage.selectAggregation('Sum')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = phpmemory');
|
||||
return visualizePage.selectField('phpmemory');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(sumPhpMemory).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Median', function pageHeader() {
|
||||
var medianBytes = ['5,565.263', '50th percentile of bytes'];
|
||||
// For now, only comparing the text label part of the metric
|
||||
common.debug('Aggregation = Median');
|
||||
return visualizePage.selectAggregation('Median')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = bytes');
|
||||
return visualizePage.selectField('bytes');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
// only comparing the text label!
|
||||
expect(medianBytes[1]).to.eql(metricValue.split('\n')[1]);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Min', function pageHeader() {
|
||||
var minTimestamp = ['September 20th 2015, 00:00:00.000', 'Min @timestamp'];
|
||||
common.debug('Aggregation = Min');
|
||||
return visualizePage.selectAggregation('Min')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = @timestamp');
|
||||
return visualizePage.selectField('@timestamp');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(minTimestamp).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Max', function pageHeader() {
|
||||
var maxRelatedContentArticleModifiedTime = ['April 4th 2015, 00:54:41.000', 'Max relatedContent.article:modified_time'];
|
||||
common.debug('Aggregation = Max');
|
||||
return visualizePage.selectAggregation('Max')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = relatedContent.article:modified_time');
|
||||
return visualizePage.selectField('relatedContent.article:modified_time');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(maxRelatedContentArticleModifiedTime).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Standard Deviation', function pageHeader() {
|
||||
var standardDeviationBytes = [
|
||||
'-1,435.138', 'Lower Standard Deviation of bytes',
|
||||
'5,727.314', 'Average of bytes',
|
||||
'12,889.766', 'Upper Standard Deviation of bytes'
|
||||
];
|
||||
common.debug('Aggregation = Standard Deviation');
|
||||
return visualizePage.selectAggregation('Standard Deviation')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = bytes');
|
||||
return visualizePage.selectField('bytes');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(standardDeviationBytes).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Unique Count', function pageHeader() {
|
||||
var uniqueCountClientip = ['1,000', 'Unique count of clientip'];
|
||||
common.debug('Aggregation = Unique Count');
|
||||
return visualizePage.selectAggregation('Unique Count')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = clientip');
|
||||
return visualizePage.selectField('clientip');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(uniqueCountClientip).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
common.debug('metricValue=' + metricValue.split('\n'));
|
||||
expect(uniqueCountClientip).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Percentiles', function pageHeader() {
|
||||
var percentileMachineRam = [
|
||||
'2,147,483,648', '1st percentile of machine.ram',
|
||||
'3,221,225,472', '5th percentile of machine.ram',
|
||||
'7,516,192,768', '25th percentile of machine.ram',
|
||||
'12,884,901,888', '50th percentile of machine.ram',
|
||||
'18,253,611,008', '75th percentile of machine.ram',
|
||||
'32,212,254,720', '95th percentile of machine.ram',
|
||||
'32,212,254,720', '99th percentile of machine.ram'
|
||||
];
|
||||
|
||||
common.debug('Aggregation = Percentiles');
|
||||
return visualizePage.selectAggregation('Percentiles')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = machine.ram');
|
||||
return visualizePage.selectField('machine.ram');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(percentileMachineRam).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Percentile Ranks', function pageHeader() {
|
||||
var percentileRankBytes = [ '2.036%', 'Percentile rank 99 of "memory"'];
|
||||
common.debug('Aggregation = Percentile Ranks');
|
||||
return visualizePage.selectAggregation('Percentile Ranks')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = bytes');
|
||||
return visualizePage.selectField('memory');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Values = 99');
|
||||
return visualizePage.setValue('99');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(percentileRankBytes).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
bdd.it('should show Average', function pageHeader() {
|
||||
var avgMachineRam = ['13,104,036,080.615', 'Average machine.ram'];
|
||||
return visualizePage.clickMetricEditor()
|
||||
.then(function () {
|
||||
common.debug('Aggregation = Average');
|
||||
return visualizePage.selectAggregation('Average');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Field = machine.ram');
|
||||
return visualizePage.selectField('machine.ram');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(avgMachineRam).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Sum', function pageHeader() {
|
||||
var sumPhpMemory = ['85,865,880', 'Sum of phpmemory'];
|
||||
common.debug('Aggregation = Sum');
|
||||
return visualizePage.selectAggregation('Sum')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = phpmemory');
|
||||
return visualizePage.selectField('phpmemory');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(sumPhpMemory).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Median', function pageHeader() {
|
||||
var medianBytes = ['5,565.263', '50th percentile of bytes'];
|
||||
// For now, only comparing the text label part of the metric
|
||||
common.debug('Aggregation = Median');
|
||||
return visualizePage.selectAggregation('Median')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = bytes');
|
||||
return visualizePage.selectField('bytes');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
// only comparing the text label!
|
||||
expect(medianBytes[1]).to.eql(metricValue.split('\n')[1]);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Min', function pageHeader() {
|
||||
var minTimestamp = ['September 20th 2015, 00:00:00.000', 'Min @timestamp'];
|
||||
common.debug('Aggregation = Min');
|
||||
return visualizePage.selectAggregation('Min')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = @timestamp');
|
||||
return visualizePage.selectField('@timestamp');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(minTimestamp).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Max', function pageHeader() {
|
||||
var maxRelatedContentArticleModifiedTime = ['April 4th 2015, 00:54:41.000', 'Max relatedContent.article:modified_time'];
|
||||
common.debug('Aggregation = Max');
|
||||
return visualizePage.selectAggregation('Max')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = relatedContent.article:modified_time');
|
||||
return visualizePage.selectField('relatedContent.article:modified_time');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(maxRelatedContentArticleModifiedTime).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Standard Deviation', function pageHeader() {
|
||||
var standardDeviationBytes = [
|
||||
'-1,435.138', 'Lower Standard Deviation of bytes',
|
||||
'5,727.314', 'Average of bytes',
|
||||
'12,889.766', 'Upper Standard Deviation of bytes'
|
||||
];
|
||||
common.debug('Aggregation = Standard Deviation');
|
||||
return visualizePage.selectAggregation('Standard Deviation')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = bytes');
|
||||
return visualizePage.selectField('bytes');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(standardDeviationBytes).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Unique Count', function pageHeader() {
|
||||
var uniqueCountClientip = ['1,000', 'Unique count of clientip'];
|
||||
common.debug('Aggregation = Unique Count');
|
||||
return visualizePage.selectAggregation('Unique Count')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = clientip');
|
||||
return visualizePage.selectField('clientip');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(uniqueCountClientip).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
common.debug('metricValue=' + metricValue.split('\n'));
|
||||
expect(uniqueCountClientip).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Percentiles', function pageHeader() {
|
||||
var percentileMachineRam = [
|
||||
'2,147,483,648', '1st percentile of machine.ram',
|
||||
'3,221,225,472', '5th percentile of machine.ram',
|
||||
'7,516,192,768', '25th percentile of machine.ram',
|
||||
'12,884,901,888', '50th percentile of machine.ram',
|
||||
'18,253,611,008', '75th percentile of machine.ram',
|
||||
'32,212,254,720', '95th percentile of machine.ram',
|
||||
'32,212,254,720', '99th percentile of machine.ram'
|
||||
];
|
||||
|
||||
common.debug('Aggregation = Percentiles');
|
||||
return visualizePage.selectAggregation('Percentiles')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = machine.ram');
|
||||
return visualizePage.selectField('machine.ram');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(percentileMachineRam).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show Percentile Ranks', function pageHeader() {
|
||||
var percentileRankBytes = [ '2.036%', 'Percentile rank 99 of "memory"'];
|
||||
common.debug('Aggregation = Percentile Ranks');
|
||||
return visualizePage.selectAggregation('Percentile Ranks')
|
||||
.then(function selectField() {
|
||||
common.debug('Field = bytes');
|
||||
return visualizePage.selectField('memory');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Values = 99');
|
||||
return visualizePage.setValue('99');
|
||||
})
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.getMetric()
|
||||
.then(function (metricValue) {
|
||||
expect(percentileRankBytes).to.eql(metricValue.split('\n'));
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,129 +7,125 @@ import {
|
|||
visualizePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickPieChart');
|
||||
return visualizePage.clickPieChart();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('select bucket Split Slices');
|
||||
return visualizePage.clickBucket('Split Slices');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Click aggregation Histogram');
|
||||
return visualizePage.selectAggregation('Histogram');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Click field memory');
|
||||
return visualizePage.selectField('memory');
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
})
|
||||
.then(function sleep() {
|
||||
return common.sleep(1003);
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setNumericInterval 4000');
|
||||
return visualizePage.setNumericInterval('40000');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('clickGo');
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('pie chart', function indexPatternCreation() {
|
||||
var testSubName = 'PieChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
|
||||
bdd.it('should save and load', function pageHeader() {
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var remote = this.remote;
|
||||
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
// sleep a bit before trying to get the pie chart data below
|
||||
.then(function sleep() {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show 10 slices in pie chart, take screenshot', function pageHeader() {
|
||||
var remote = this.remote;
|
||||
var expectedPieChartSliceCount = 10;
|
||||
|
||||
return visualizePage.getPieChartData()
|
||||
.then(function (pieData) {
|
||||
var barHeightTolerance = 1;
|
||||
common.debug('pieData.length = ' + pieData.length);
|
||||
expect(pieData.length).to.be(expectedPieChartSliceCount);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data', function pageHeader() {
|
||||
var remote = this.remote;
|
||||
var expectedTableData = [ '0 55', '40,000 50', '80,000 41', '120,000 43',
|
||||
'160,000 44', '200,000 40', '240,000 46', '280,000 39', '320,000 40', '360,000 47'
|
||||
];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function () {
|
||||
return settingsPage.setPageSize('All');
|
||||
})
|
||||
.then(function getDataTableData() {
|
||||
return visualizePage.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickPieChart');
|
||||
return visualizePage.clickPieChart();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('select bucket Split Slices');
|
||||
return visualizePage.clickBucket('Split Slices');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Click aggregation Histogram');
|
||||
return visualizePage.selectAggregation('Histogram');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Click field memory');
|
||||
return visualizePage.selectField('memory');
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
})
|
||||
.then(function sleep() {
|
||||
return common.sleep(1003);
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setNumericInterval 4000');
|
||||
return visualizePage.setNumericInterval('40000');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('clickGo');
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
});
|
||||
}());
|
||||
}());
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('pie chart', function indexPatternCreation() {
|
||||
var testSubName = 'PieChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
|
||||
bdd.it('should save and load', function pageHeader() {
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var remote = this.remote;
|
||||
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
// sleep a bit before trying to get the pie chart data below
|
||||
.then(function sleep() {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show 10 slices in pie chart, take screenshot', function pageHeader() {
|
||||
var remote = this.remote;
|
||||
var expectedPieChartSliceCount = 10;
|
||||
|
||||
return visualizePage.getPieChartData()
|
||||
.then(function (pieData) {
|
||||
var barHeightTolerance = 1;
|
||||
common.debug('pieData.length = ' + pieData.length);
|
||||
expect(pieData.length).to.be(expectedPieChartSliceCount);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct data', function pageHeader() {
|
||||
var remote = this.remote;
|
||||
var expectedTableData = [ '0 55', '40,000 50', '80,000 41', '120,000 43',
|
||||
'160,000 44', '200,000 40', '240,000 46', '280,000 39', '320,000 40', '360,000 47'
|
||||
];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function () {
|
||||
return settingsPage.setPageSize('All');
|
||||
})
|
||||
.then(function getDataTableData() {
|
||||
return visualizePage.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,114 +7,110 @@ import {
|
|||
visualizePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
bdd.before(function () {
|
||||
bdd.before(function () {
|
||||
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickTileMap');
|
||||
return visualizePage.clickTileMap();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('select bucket Geo Coordinates');
|
||||
return visualizePage.clickBucket('Geo Coordinates');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Click aggregation Geohash');
|
||||
return visualizePage.selectAggregation('Geohash');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Click field geo.coordinates');
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.selectField('geo.coordinates');
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickTileMap');
|
||||
return visualizePage.clickTileMap();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('select bucket Geo Coordinates');
|
||||
return visualizePage.clickBucket('Geo Coordinates');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Click aggregation Geohash');
|
||||
return visualizePage.selectAggregation('Geohash');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('Click field geo.coordinates');
|
||||
return common.try(function tryingForTime() {
|
||||
return visualizePage.selectField('geo.coordinates');
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.describe('tile map chart', function indexPatternCreation() {
|
||||
bdd.describe('tile map chart', function indexPatternCreation() {
|
||||
|
||||
bdd.it('should save and load, take screenshot', function pageHeader() {
|
||||
var testSubName = 'TileMap';
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
// var remote = this.remote;
|
||||
bdd.it('should save and load, take screenshot', function pageHeader() {
|
||||
var testSubName = 'TileMap';
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
// var remote = this.remote;
|
||||
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
// sleep a bit before taking the screenshot or it won't show data
|
||||
.then(function sleep() {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show correct tile map data', function pageHeader() {
|
||||
var testSubName = 'TileMap';
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
// var remote = this.remote;
|
||||
var expectedTableData = [ 'dn 1,429', 'dp 1,418', '9y 1,215', '9z 1,099', 'dr 1,076',
|
||||
'dj 982', '9v 938', '9q 722', '9w 475', 'cb 457', 'c2 453', '9x 420', 'dq 399',
|
||||
'9r 396', '9t 274', 'c8 271', 'dh 214', 'b6 207', 'bd 206', 'b7 167', 'f0 141',
|
||||
'be 128', '9m 126', 'bf 85', 'de 73', 'bg 71', '9p 71', 'c1 57', 'c4 50', '9u 48',
|
||||
'f2 46', '8e 45', 'b3 38', 'bs 36', 'c0 31', '87 28', 'bk 23', '8f 18', 'b5 14',
|
||||
'84 14', 'dx 9', 'bu 9', 'b1 9', 'b4 6', '9n 3', '8g 3'
|
||||
];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function () {
|
||||
return settingsPage.setPageSize('All');
|
||||
})
|
||||
.then(function getDataTableData() {
|
||||
return visualizePage.getDataTableData()
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
// sleep a bit before taking the screenshot or it won't show data
|
||||
.then(function sleep() {
|
||||
return common.sleep(4000);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
||||
bdd.it('should show correct tile map data', function pageHeader() {
|
||||
var testSubName = 'TileMap';
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
// var remote = this.remote;
|
||||
var expectedTableData = [ 'dn 1,429', 'dp 1,418', '9y 1,215', '9z 1,099', 'dr 1,076',
|
||||
'dj 982', '9v 938', '9q 722', '9w 475', 'cb 457', 'c2 453', '9x 420', 'dq 399',
|
||||
'9r 396', '9t 274', 'c8 271', 'dh 214', 'b6 207', 'bd 206', 'b7 167', 'f0 141',
|
||||
'be 128', '9m 126', 'bf 85', 'de 73', 'bg 71', '9p 71', 'c1 57', 'c4 50', '9u 48',
|
||||
'f2 46', '8e 45', 'b3 38', 'bs 36', 'c0 31', '87 28', 'bk 23', '8f 18', 'b5 14',
|
||||
'84 14', 'dx 9', 'bu 9', 'b1 9', 'b4 6', '9n 3', '8g 3'
|
||||
];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function () {
|
||||
return settingsPage.setPageSize('All');
|
||||
})
|
||||
.then(function getDataTableData() {
|
||||
return visualizePage.getDataTableData()
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,135 +7,125 @@ import {
|
|||
visualizePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
(function () {
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
bdd.describe('visualize app', function describeIndexTests() {
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
bdd.before(function () {
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickVerticalBarChart');
|
||||
return visualizePage.clickVerticalBarChart();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function clickBucket() {
|
||||
common.debug('Bucket = X-Axis');
|
||||
return visualizePage.clickBucket('X-Axis');
|
||||
})
|
||||
.then(function selectAggregation() {
|
||||
common.debug('Aggregation = Date Histogram');
|
||||
return visualizePage.selectAggregation('Date Histogram');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Field = @timestamp');
|
||||
return visualizePage.selectField('@timestamp');
|
||||
})
|
||||
// leaving Interval set to Auto
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone(); // only matches the hidden spinner
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.describe('vertical bar chart', function indexPatternCreation() {
|
||||
var testSubName = 'VerticalBarChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
|
||||
bdd.it('should save and load', function pageHeader() {
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone(); // only matches the hidden spinner
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct chart, take screenshot', function pageHeader() {
|
||||
|
||||
var expectedChartValues = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, 683,
|
||||
1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29
|
||||
];
|
||||
|
||||
// Most recent failure on Jenkins usually indicates the bar chart is still being drawn?
|
||||
// return arguments[0].getAttribute(arguments[1]);","args":[{"ELEMENT":"592"},"fill"]}] arguments[0].getAttribute is not a function
|
||||
// try sleeping a bit before getting that data
|
||||
return common.sleep(5000)
|
||||
.then(function () {
|
||||
return visualizePage.getBarChartData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug('data=' + data);
|
||||
common.debug('data.length=' + data.length);
|
||||
expect(data).to.eql(expectedChartValues);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct data', function pageHeader() {
|
||||
|
||||
var testSubName = 'VerticalBarChart';
|
||||
// this is only the first page of the tabular data.
|
||||
var expectedChartData = [ 'September 20th 2015, 00:00:00.000 37',
|
||||
'September 20th 2015, 03:00:00.000 202',
|
||||
'September 20th 2015, 06:00:00.000 740',
|
||||
'September 20th 2015, 09:00:00.000 1,437',
|
||||
'September 20th 2015, 12:00:00.000 1,371',
|
||||
'September 20th 2015, 15:00:00.000 751',
|
||||
'September 20th 2015, 18:00:00.000 188',
|
||||
'September 20th 2015, 21:00:00.000 31',
|
||||
'September 21st 2015, 00:00:00.000 42',
|
||||
'September 21st 2015, 03:00:00.000 202'
|
||||
];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function showData(data) {
|
||||
return visualizePage.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
bdd.before(function () {
|
||||
common.debug('navigateToApp visualize');
|
||||
return common.navigateToApp('visualize')
|
||||
.then(function () {
|
||||
common.debug('clickVerticalBarChart');
|
||||
return visualizePage.clickVerticalBarChart();
|
||||
})
|
||||
.then(function clickNewSearch() {
|
||||
return visualizePage.clickNewSearch();
|
||||
})
|
||||
.then(function setAbsoluteRange() {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function clickBucket() {
|
||||
common.debug('Bucket = X-Axis');
|
||||
return visualizePage.clickBucket('X-Axis');
|
||||
})
|
||||
.then(function selectAggregation() {
|
||||
common.debug('Aggregation = Date Histogram');
|
||||
return visualizePage.selectAggregation('Date Histogram');
|
||||
})
|
||||
.then(function selectField() {
|
||||
common.debug('Field = @timestamp');
|
||||
return visualizePage.selectField('@timestamp');
|
||||
})
|
||||
// leaving Interval set to Auto
|
||||
.then(function clickGo() {
|
||||
return visualizePage.clickGo();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone(); // only matches the hidden spinner
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
});
|
||||
}());
|
||||
}());
|
||||
});
|
||||
|
||||
bdd.describe('vertical bar chart', function indexPatternCreation() {
|
||||
var testSubName = 'VerticalBarChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
bdd.it('should save and load', function pageHeader() {
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone(); // only matches the hidden spinner
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct chart, take screenshot', function pageHeader() {
|
||||
var expectedChartValues = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, 683,
|
||||
1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29
|
||||
];
|
||||
|
||||
// Most recent failure on Jenkins usually indicates the bar chart is still being drawn?
|
||||
// return arguments[0].getAttribute(arguments[1]);","args":[{"ELEMENT":"592"},"fill"]}] arguments[0].getAttribute is not a function
|
||||
// try sleeping a bit before getting that data
|
||||
return common.sleep(5000)
|
||||
.then(function () {
|
||||
return visualizePage.getBarChartData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug('data=' + data);
|
||||
common.debug('data.length=' + data.length);
|
||||
expect(data).to.eql(expectedChartValues);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct data', function pageHeader() {
|
||||
var testSubName = 'VerticalBarChart';
|
||||
// this is only the first page of the tabular data.
|
||||
var expectedChartData = [ 'September 20th 2015, 00:00:00.000 37',
|
||||
'September 20th 2015, 03:00:00.000 202',
|
||||
'September 20th 2015, 06:00:00.000 740',
|
||||
'September 20th 2015, 09:00:00.000 1,437',
|
||||
'September 20th 2015, 12:00:00.000 1,371',
|
||||
'September 20th 2015, 15:00:00.000 751',
|
||||
'September 20th 2015, 18:00:00.000 188',
|
||||
'September 20th 2015, 21:00:00.000 31',
|
||||
'September 21st 2015, 00:00:00.000 42',
|
||||
'September 21st 2015, 03:00:00.000 202'
|
||||
];
|
||||
|
||||
return visualizePage.collapseChart()
|
||||
.then(function showData(data) {
|
||||
return visualizePage.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
common.debug(data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedChartData);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,36 +8,34 @@ import {
|
|||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
bdd.describe('visualize app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
bdd.describe('visualize app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
|
||||
bdd.before(function () {
|
||||
var self = this;
|
||||
remote.setWindowSize(1200,800);
|
||||
bdd.before(function () {
|
||||
var self = this;
|
||||
remote.setWindowSize(1200,800);
|
||||
|
||||
common.debug('Starting visualize before method');
|
||||
var logstash = scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// wait for the logstash data load to finish if it hasn't already
|
||||
.then(function () {
|
||||
return logstash;
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
require('./_chart_types');
|
||||
require('./_area_chart');
|
||||
require('./_line_chart');
|
||||
require('./_data_table');
|
||||
require('./_metric_chart');
|
||||
require('./_pie_chart');
|
||||
require('./_tile_map');
|
||||
require('./_vertical_bar_chart');
|
||||
common.debug('Starting visualize before method');
|
||||
var logstash = scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// wait for the logstash data load to finish if it hasn't already
|
||||
.then(function () {
|
||||
return logstash;
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
}());
|
||||
|
||||
require('./_chart_types');
|
||||
require('./_area_chart');
|
||||
require('./_line_chart');
|
||||
require('./_data_table');
|
||||
require('./_metric_chart');
|
||||
require('./_pie_chart');
|
||||
require('./_tile_map');
|
||||
require('./_vertical_bar_chart');
|
||||
});
|
||||
|
|
|
@ -1,25 +1,23 @@
|
|||
import { bdd, common } from '../../support';
|
||||
|
||||
(function () {
|
||||
var expect = require('expect.js');
|
||||
var expect = require('expect.js');
|
||||
|
||||
bdd.describe('status page', function () {
|
||||
bdd.before(function () {
|
||||
return common.navigateToApp('status_page', false);
|
||||
});
|
||||
|
||||
bdd.it('should show the kibana plugin as ready', function () {
|
||||
var self = this;
|
||||
|
||||
return common.tryForTime(6000, function () {
|
||||
return self.remote
|
||||
.findByCssSelector('.plugin_status_breakdown')
|
||||
.getVisibleText()
|
||||
.then(function (text) {
|
||||
expect(text.indexOf('kibana 1.0.0 Ready')).to.be.above(-1);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(self));
|
||||
});
|
||||
bdd.describe('status page', function () {
|
||||
bdd.before(function () {
|
||||
return common.navigateToApp('status_page', false);
|
||||
});
|
||||
}());
|
||||
|
||||
bdd.it('should show the kibana plugin as ready', function () {
|
||||
var self = this;
|
||||
|
||||
return common.tryForTime(6000, function () {
|
||||
return self.remote
|
||||
.findByCssSelector('.plugin_status_breakdown')
|
||||
.getVisibleText()
|
||||
.then(function (text) {
|
||||
expect(text.indexOf('kibana 1.0.0 Ready')).to.be.above(-1);
|
||||
});
|
||||
})
|
||||
.catch(common.handleError(self));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -256,7 +256,7 @@ export default (function () {
|
|||
const fileName = `failure_${now}_${testName}.png`;
|
||||
|
||||
return this.saveScreenshot(fileName, true)
|
||||
.finally(function () {
|
||||
.then(function () {
|
||||
throw reason;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue