Commit graph

217 commits

Author SHA1 Message Date
Rudolf Meijering da09a11858
Mocks for CoreStart, CoreSetup and PluginInitializerContext (#39351)
* Mocks for CoreStart, CoreSetup and PluginInitializerContext

* Public CoreStart, CoreSetup mocks

* Update api signature/docs

* Convert embaddable_api tests to new core mocks

* CR Feedback

* Introduce ui_new_platform.test.mocks and refactor embedabble tests

* Hack to get TS warnings for Core mocks

* Core mocks types cleanup & hack to get TS warnings for Server Core mocks

* Use __mocks__ new_platform

* Remove accidently commited auto-mock

* Introduce MockedKeys type for Core mocks

* Better typing/docs for UiSettings

* Revert "Use __mocks__ new_platform"

This reverts commit 2d666facc8.

* Add missing mock to test

* Cleanup UiSettings types
2019-06-28 13:34:41 +02:00
liza-mae 16b8f3bef7
Add rendering of canvas images and update percy agent package (#39456)
* Add rendering of canvas images and update percy agent package

* Spencer's fix for eslint issues

* restore canvas elements after taking snapshot

* copy over all styles from canvas to image stand-in

* percy snapshots only run in chrome, so they can use modern js features

* only run visual regression suites

* add stub maps test

* fix arg order

* use more modern syntax that totally works in chrome

* typo

* fix ftr test timeout when using --inspect-brk

* Revert "add stub maps test"

This reverts commit 32dc965adb.
2019-06-24 08:34:59 -06:00
Court Ewing 2d171c92f5 Fix path references into and out of x-pack/legacy 2019-06-20 13:34:48 -04:00
liza-mae 0003a32f56
[WIP] FTR Percy changes (#36897)
* [ftr/percy] integrate percy with functional test runner

* execute ftr within `percy exec`

* share PERCY_BIN and GRUNT_BIN vars in setup

* [license] whitelist `(Unlicense OR Apache-2.0)`

* [percy] include pr/parallel info in env

* echo the actual variable value

* destructure required modules

* [ci] calculate percy env in a script

* remove outdated eslint overrides

* oops, nonce should be the same for each build

* take snapshots in context tests

* add percy snapshots to some dashboard tests

* account for extra execution of PERCY_BIN

* remove usage of percy service

* rename service to `visualTesting`

* write a simple test

* switch left-over percy test to visualTesting

* set log level for percy agent

* trigger ci

* try using the system chrome install instead of downloading one

* fix export definition

* Don't skip chromium download

* Add Spencer's fix to point to chrome installation

* Attempting to split tests into own ci job and test files

* Renumber job

* Add tag to decorations file

* Try new files with existing CI job

* Try again to create a new CI job

* Fix eslint problem with space

* eslint updates

* fix console test

* make test names unique

* Update ci group names

* Try old name again

* save

* add separate visual_regression ci job

* add visual regression ci job

* add new job to jobs.yml

* update path to take_percy_snapshot script

* use fixed percy job total

* fix common services import

* move visual_create_and_add_embeddables to visual_regression project

* finish moving create_and_add_embeddables

* add x-pack visual regression job

* migrate dashboard_snapshots tests to visual_regression

* remove references to removed test files

* restore some unnecessary changes

* reimplement the login page tests

* yarn.lock update

* fix test

* remove old CI_GROUP 100 block

* update failed_tests trap

* reduce yarn.lock changes

* disable debug logging

* disable visual-regression tests for now, we can enable them in specific prs
2019-06-14 10:35:23 -06:00
Artyom Gospodarsky cac41c3eae
[TSVB] Turn Prettier on (#38106)
* Add the TSVB module to Prettier

* Pretty the TSVB by Prettier
2019-06-11 16:14:22 +03:00
Frank Hassanabad 131e3bf1a2
[SIEM] Change deprecated Buffer method for non-deprecated Buffer method (#38634)
## Summary
  * Added linter rule to prevent us from accidentally adding deprecated node methods
  * Added the new package linter plugin for NodeJS
  * Added unit test for the base 64 encoding for sanity check

Note:
Only the one line of code will be back-ported for the NodeJS fix for 7.2.0. The linter rule will not be back-ported. 

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~
~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~
~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
~~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
2019-06-10 22:15:11 -06:00
Frank Hassanabad 76bdae1073
[SIEM] Add missing i18n keys (#37400)
## Summary
  * Added missing i18n keys
  * Added linter rule to catch mistakes
  * Updated code and tests and other areas to work with new linter rule
  * Changed linter rule to be an error now
  * Fixed other i18n keys
  * Added spacer and removed the   that the linter did not like

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

- [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
~~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
2019-05-30 14:17:29 -06:00
renovate[bot] fa597135bc Pin dependencies (#37404)
* Pin dependencies

* [eslint] ignore large files that take a long time to parse

* [eslint-plugin-import] force `querystring` to be considered a core module

* [eslint-plugin-import] auto-fix import order issues
2019-05-29 20:34:52 -07:00
Frank Hassanabad a6847564c8
[SIEM] Fix state issues to avoid potential React update issues (#37261)
## Summary

Fixed prevState issues with React setState
  * This will avoid subtle bugs with the react update renderer
  * Enabled one lint rule from warn to error
  * Turned off the other linter issue as it has an open ticket against it.
  * https://github.com/elastic/ingest-dev/issues/468

Summarize your PR. If it involves visual changes include a screenshot or gif.

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~
~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~
~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~
~~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~~
~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
~~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
2019-05-28 13:10:53 -06:00
Frank Hassanabad 74a2b7f12e
[SIEM] Fixed unescaped HTML entity issue (#37257)
## Summary
  * Turned on linter rule to be an error
  * Removed the extra character
  * https://github.com/elastic/ingest-dev/issues/467

Removes the extra `}` character seen after line 84 below in the screen shot:

<img width="368" alt="Screen Shot 2019-05-28 at 9 39 28 AM" src="https://user-images.githubusercontent.com/1151048/58498271-f4672f00-813a-11e9-8b80-2326db363bb0.png">

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~
~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~
~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~
~~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~~
~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
~~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
2019-05-28 12:33:51 -06:00
Frank Hassanabad 1cfad73abd
[SIEM] Low impact linter rules to start with (#37137)
## Summary

Low impact linter rules to help catch bugs for back-porting as well as moving into the future. We will slowly turn the warns into errors and fix the errors as we go along. This helps us avoid a "big bang" switch over approach to avoid back-port issues as we are porting bugs aggressively at the beginning.

Added a custom pattern detection rule for determining if the UI is trying to import anything from the server backend since that would cause web-pack front to pull in backend code. Also forbid the use of NodeJS imports on the front end.  

Double checked that I was not duplicating rules from:
* https://github.com/elastic/kibana/blob/master/packages/eslint-config-kibana/typescript.js
* https://github.com/elastic/kibana/blob/master/packages/eslint-config-kibana/javascript.js

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~
~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~
~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~
~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~
~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~

### For maintainers

~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~
~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~
2019-05-28 11:14:17 -06:00
Artyom Gospodarsky 82fa749d20
[TSVB] Get rid of default export on TSVB (#36872)
The `import/no-default-export` has been turned on for TSVB.

* Get rid of default export on TSVB
* Change eslint rules lines
2019-05-24 16:16:54 +03:00
FrankHassanabad 6e579b47e4
Merge remote-tracking branch 'upstream/master' into feature-secops 2019-04-24 09:20:43 -06:00
Tiago Costa 83e97affa3
chore(NA): prettier end of line auto detection on linting. (#34799) 2019-04-23 02:12:40 +01:00
FrankHassanabad 37d9095819
Fixed the eslint types and added the SIEM rules to the base of the project 2019-04-18 18:37:46 -06:00
Mikhail Shustov c618751bb8
[New platform] Restrict import from core&plugin internals for ts files (#34688)
* eslint-plugin-import should resolve *.ts files

* no_restricted_paths adc support filename exclusion

* fix linter errors

* update autogenerateds docs

* export directly
2019-04-10 14:56:09 +02:00
Tiago Costa ed795d28ee
Migrate from tslint (#33826)
* chore(NA): remove tslint dependencies, configs and enable eslint typescript parser.

* fix(NA): apply recommend eslint typescript rule.s

* chore(NA): upgrade eslint package versions.

* chore(NA): split javascript eslint config in an override section.

* chore(NA): split all eslint configs with overrides.

* chore(NA): remove missing console.log.

* chore(NA): change eslint splits and overrides order.

* chore(NA): replace tslint disable comments with eslint ones.

* chore(NA): solve eslint typescript errors for elastic/kibana-custom/no-default-export

* chore(NA): fixed multiple eslint typescript rule failures.

* chore(NA): add tarfet folder to the eslint ignore.

* chore(NA): apply prettier rule to ts type file.

* chore(NA): remove last mentions to tslint

* chore(NA): add old defined rules

* chore(NA): missing port rules website

* chore(na): ordered rules

* chore(NA): solved eslint typescript problems.

* chore(NA): fix spaced comment problems.

* chore(NA): fix some more eslint typescript rules: import/order no-empty-interface

* chore(NA): fix last rules and comment out what are the ones still failing.

* chore(NA): comment out camelcase rule.

* chore(NA): regenerate kbn pm dist.

* chore(NA): updated snapshots.

* chore(NA): updated snapshots.

* chore(NA): disabled sort-keys rule.

* chore(NA): remove rule prefer-arrow/prefer-arrow-functions.

* chore(NA): fix for @typescript-eslint/no-var-requires rule.

* chore(NA): fixes for @typescript-eslint/camelcase rule.

* chore(NA): fix typo on eslint config kibana typescript.

Co-Authored-By: mistic <tiagoffcc@hotmail.com>

* chore(NA): remove legacy note after the intellij upgrade to 2019.1

* fix(NA): import order plugin.

* chore(NA): fix ts ignore positions after auto fix.

* fix(NA): performance issue with typescript eslint.

* refact(NA): eslint configs organization.

* chore(NA): apply resticted paths to ts files too.

* chore(NA): split comment from eslint ignore.
2019-04-05 17:45:23 +01:00
Mikhail Shustov 461289e05b
use eslint-import-plugin/no-export-default instead of custom rule (#34285) 2019-04-02 08:37:01 +02:00
Mikhail Shustov 2489180999
[New platform] Restrict import from core&plugin internals for js files (#33697)
* restrict import from core&plugin internals

* Fork import/no-restricted-paths and add allowSameFolder option

Our use case requires to restrict imports from plugin folders, which names are unknown for us yet. We cannot use 'import/no-restricted-paths' in the current state, because if we define 'from: plugins/*/server/' the rule will report all relative imports in the same folder as well. To fix this problem we added another option 'allowSameFolder' that makes the rule to ignore imports in the same folder.

* update notices

* add basePath option

* support glob pattern instead of reagexp

* remove @notice, make basePath required
2019-03-29 08:48:32 +01:00
Spencer 2e232c2e31
[@kbn/expect] "fork" expect.js into repo (#33761)
* [@kbn/expect] "fork" expect.js into repo

* [eslint] autofix references to expect.js

* [tslint] autofix all expect.js imports

* now that expect.js is in strict mode, avoid reassigning fn.length
2019-03-25 09:56:48 -07:00
Spencer 96206bd092
[eslint] merge custom rules into a single plugin (#33733)
I'd like to add another custom eslint rule, but there isn't a very good place to do that right now. We have the `eslint-plugin-kibana-custom` package, which is super simple but isn't in the `@kbn` namespace and isn't included in the root eslint config, and `@kbn/eslint-plugin-license-header` is too specific, so I've merged those two packages into `@kbn/eslint-plugin-eslint`, which is a little redundant but allows is to refer to the rules within it as `@kbn/eslint/{rule}`, which feels nice.

Thoughts?

_**NOTE:**_ merging the eslint rules from the two packages means enabling prettier for the code from `@kbn/eslint-plugin-license-header`, all those changes are made in 42c7da6fe2. [View the changes without the prettier updates](b647f2b...74e07a0)
2019-03-22 17:12:14 -07:00
Sébastien Loix effebd8c05
Move testbed utils to x-pack/test_utils (#32893) 2019-03-19 08:12:19 +01:00
Mike Côté 2fa3c01928
Enable prettier for saved objects (#33194) 2019-03-13 18:35:20 -04:00
Joe Fleming 228d69c708
Fix: set react version to string, not semver object (#33079)
## Summary

While working on a plugin that was just using the Kibana eslint config, I saw a stream of these messages:

> Warning: React version specified in eslint-plugin-react-settings must be a string; got “object”

Looking into our eslint config, I noticed we're using `semver.coerce` to get the version from the `package.json` file in Kibana. This looked right, except that method actually returns an object:

```js
const ver = semver.coerce('^16.8.0');
console.log(ver);
```

That produces:

```
SemVer {
  options: { loose: false, includePrerelease: false },
  loose: false,
  raw: '16.8.0',
  major: 16,
  minor: 8,
  patch: 0,
  prerelease: [],
  build: [],
  version: '16.8.0' }
```

The [semver package](https://www.npmjs.com/package/semver) includes some examples where they wrap that value in `semver.valid`, which produces a string and fixes the warning.

```js
const ver = semver.valid(semver.coerce('^16.8.0'));
console.log(ver); // outputs 16.8.0
```

### So why don't we see this warning in Kibana?

I'm not sure, but I suspect it's because it's a console warning and our tooling prevents that output from showing up. 

This change stops the warning output when you run eslint in my plugin though. 

UPDATE: After some more digging, it looks like it's related to the version override in Kibana's eslintrc. Removing the override stops the linter from running, without the changes in this PR.
2019-03-13 10:50:01 -07:00
Spencer a6afcc5b66
Restore webdriver-based functional test runner driver (#31446)
* Restore webdriver-based functional test runner driver

* run all function test suites 6 times per build, to help spot flakiness

* [tests/reporting] fix flaky click on report generation

* [#31446] stabilize x-pack-ciGroup6 (#31447)

* rerun x-pack-ciGroup6 40 times

* improve reporting tests stability (#31454)

* Revert "rerun x-pack-ciGroup6 40 times"

This reverts commit 63026b1a53.

* Fix Dashboard Save tests (#32112)

* [page_objects/dashboard_page] add waitDialogIsClosed to manage dashboard popup behaviour

* [page_objects/dashboard_page] add waitDialogIsClosed flag

* services: leadfoot -> webdriver

* [services/lib/web_element_wrapper] extend type with charByChar input (#32305)

* Revert "run all function test suites 6 times per build, to help spot flakiness"

This reverts commit 477099337a.
2019-03-01 17:53:05 -08:00
Tiago Costa 514673c46e
Improve dll plugin relation with webpackshims (#30129)
* chore(NA): remove specific watch for x-pack webpackShims folder.

* chore(NA): remove xpack security plugin angular-ui-select webpackShim.

* chore(NA): bump ui-select version on x-pack to match the one used on oss kibana

* chore(NA): remove manual searching for webpackShim imports into the dll plugin. chore(NA): explicit avoid max dll compilations in all environments for the dll plugin. chore(NA): explicit throw an error and list all the not allowed modules bundled into the dll bundle.

* refact(NA): move ui related actions inside webpackShims to proper ui related files

* chore(NA): move angular ui dependencies from webpackShims to kibana core module.

* test(NA): enable xpack jest tests to be able to resolve plugins/xpack_main/*. refact(NA): rewrite code for the old xpack jquery flot webpackShim.

* refact(NA): use the already declared ui module get to list the dependencies for the kibana legacy core plugin.

* chore(NA): move angular ui requires to a better centralized place.

* refact(NA): rename areMaxCompilationsPerformed to assertMaxCompilations.

* refact(NA): remove unnecessary promise resolve on async function.

* refact(NA): remove unnecessary promise resolve on async function.

* refact(NA): apply changes according pr review.

* refact(NA): change from requires to imports in xpack_main plugin jquery flots.

* refact(NA): jquery flots missing statements.

* fix(na): linting problems.

* chore(na): re add jquery flot requires instead of imports.

* refact(NA): moving jquery flots from require to import. test(NA): fix mock for jquery_flot.

* feat(na): allow dynamic dll plugin public modules on dll bundle.

* feat(NA): step verification to not allow modules from xpack source.

* chore(NA): fix linting problems.
2019-02-22 01:45:42 +00:00
Spencer a48a03cd3e
Revert "Replace Leadfoot with WebDriver API (#26477)" (#31382)
* Revert "Replace Leadfoot with WebDriver API (#26477)"

This reverts commit 0bd3b4fdfb.

* leadfoot expectes execute args to be an array

* disable flaky graphql tests
2019-02-17 18:59:03 -08:00
Spencer cb9bf9e3b8
[ftr/services/pipelineList] reduce calls to the browser to avoid flakiness (#31366)
A minor bit of functional test flakiness [seen on master](https://kibana-ci.elastic.co/job/elastic+kibana+master/57/JOB=x-pack-ciGroup2,node=immutable/testReport/junit/X-Pack%20Functional%20Tests/test_functional_apps_logstash_pipeline_create%C2%B7js/logstash_pipeline_create_new_save_button_creates_the_pipeline_and_redirects_to_the_list/), since the move to webdriver, was caused by the `pipelineList` service. This service does a lot of async calls to read the state of the DOM, including the `selected` state of check boxes, so I thought I'd try rewriting the state reading to use a single function that reads the entire pipeline list and all related state in a single `browser.execute()` call.
2019-02-17 04:47:36 -08:00
Dmitry Lemeshko 0bd3b4fdfb
Replace Leadfoot with WebDriver API (#26477)
* [services/browser] switch to webdriver API

* [services/find] switch to webdriver API

* [services/remote] update to use webdriver service

* rename WebDriver service

* [services/remote] remove browser_driver_api

* [services/find] update to use WebDriver element wrapper

* [services/web_element_wrapper] use wrapped elements

* [services/find] use element wrapped moveMouseTo function

* [services/find] fix webdriver service init, add missing functions

* add missing functions for Leadfoot Element API

* [services/web_element_wrapper] add search by tag name

* tune WebDriver API calls to match Leadfoot

* Fixed implementation of moveMouseTo that is causing el.getClientRect error.

* fix references to WebElementWrapper

* [services/find] fix findElement call on webElementWrapper object

* fix issues in find and test_subject services

* [web_element_wrapper] add search by partial link text

* [services/find] adjust wrapper functions with Leadfoot API to support tests

* fix dragAnDrop & filer on elements displayed

* [visualise_page] improve searching of bucket element

* [discover_page] wait for visualisation loaded + dragAndDrop

* [service/find] fix exists, add pressKey for element

* fixes for visualize tests

* [services/browser] update dragAnddrop

* Made change to test to use move() code path in drag and drop.

* tune page objects for chart tests

* fix discover & xpack tests

* [page_objects/upgrade_assistant] fix locator

* [page_objects/discover_page] retry on brushHistogram to fix staleElementException

* update dragAndDrop, retry on getHeaders

* retry on getTextTag

* [services/screenshots] fix webdriver image take

* skip histogram brushed test & remove --bail

* use legacyAction for dragAndDrop with offset

* add missing await

* page objects update

* increase mocha timeout to 5 min

* use data-rendering-count to track visualization loading completion

* adjust waitForVisualizationRenderingCompleted

* [page_objects/visualize_page] add waiting for visualization

* fixes for xpack functional tests

* improve logging in find & testSubjects

* [services/find] fix wrapped element usage

* [page_objects/visual_builder_page] use BACK_SPACE key, supported by WebDriver

* page objects fix

* [services/test_subjects] add async/await

* [visualize/_tile_map] add missing await in tests

* fix tile_map tests for webdriver

* replace bluebird.prop with async/await

* try to wait for rendering in openLegendOptionColors

* additional logs in find.allByCssSelector

* [services/find] fix implicit wait  handling

* fix mapping in getRowsFromTable

* add timeouts and waitForVisualisation in failed tests

* [services/test_subjects] set default timeout to FIND_TIME

* [services/test_subjects] replace bluebird.filter with for loop

* replace retry.try with waitForVisualisation

* add 'visualize' PO import

* [services/web_element_wrapper] add scrollIntoView support

* fixing kibana-intake

* fixes after merging master

* Switching browser temporarily to firefox to get a CI run on FF.

* set chrome back to default browser

* print logs for some WebElementWrapper functions

* fix _wrap function

* update NOTICE.txt

* Fixed some firefox config to get the browser working. Consolidated some of the calls to build out the driver.

* Cleaning driver instance creation

* Added network throttling option for chrome.

* fix implicit wait setting

* uncomment bail

* adjust waiting for timepicker popup

* [services/inspector] process table in sequence

* Added conditional for TEST_THROTTLE_NETWORK option along with updating the speed and comments.

* add cheerio checks

* [services/apps_menu] get links quicker via innerHtml

* install webdriver dependency via yarn

* [services/combo_box] wrap getComboBoxSelectedOptions with retry

* remove leadfoot

* [testSubjects] remove unnecessary method

* [ftr/browser] explicitly export specific keys, keep `BACKSPACE` name

* Revert "[ftr/browser] explicitly export specific keys, keep `BACKSPACE` name"

This reverts commit 779335f2d4.

* [ftr/filterBar] allow finding filters even if they're off the page

* [webdriver] write verbose logs

* [webdriver] shim executor to run all commands in series

Best we can tell WebDriver locks up sometimes when we send too many
commands at once, sometimes... It causes random lockups where we never
receive another response from WedDriver and we don't want to live with
that risk, so for now I've shimmed the Executor class in WebDiver to
queue all calls to Executor#send() if there is already a call in
progress.

* [webdriver] add comment about why we're shimming

* [webdriver] fix queue, actually put things there and take things off

* run all functional four times per build

* [webdriver] extract preventParallelCalls to test it

* Revert "run all functional four times per build"

This reverts commit f91996d977.
2019-02-16 08:29:29 +01:00
CJ Cenizal e4ba818ff5
Reintroduce linting rule that requires single-quotes in x-pack. (#30893)
* Reintroduce linting rule that requires single-quotes in x-pack.
* Remove redundant quotes rule for ML.
* Convert ES-UI code to single quotes.
  - Dev tools
  - CCR
  - ILM
  - Index management
  - License management
  - Remote clusters
  - Rollup
  - Watcher
* Convert Graph code to single quotes.
* Convert Maps to single quotes.
* Convert Monitoring code to single quotes.
* Convert Reporting code to single quotes.
* Convert Security code to single quotes.
* Convert Telemetry code to single quotes.
* Convert Upgrade Assistant code to single quotes.
* Convert Grok Debugger to single quotes.
2019-02-14 12:08:37 -08:00
Thomas Neirynck 52fed8a52d
[Maps] Remove usage of gis from user-facing api (#29800)
This also renames the gis-folders to maps for consistency.
2019-02-01 12:07:05 -05:00
Spencer e355ec47aa
[ftr/element] custom scrollIntoView to support fixed header (#28727)
With https://github.com/elastic/kibana/pull/28503 we will be enabling the k7design by default, which adds a fixed header to the top of the page. This causes issues with the default "scroll into view" logic, as elements which are in the top overflow will be scrolled into view but then covered by the header.

My first attempt to solve this was adjusting the layout to only scroll the content below the header. This allowed the [standard scroll into view algorithm](https://drafts.csswg.org/cssom-view/#element-scrolling-members) to function as intended, but had a slightly worse UX on OSes like macOS, and @elastic/kibana-design ultimately pushed back because not allowing the body to scroll has other implications.

Instead I have implemented a `LeadfootElementWrapper#scrollIntoViewIfNecessary()` method which is automatically called before each `#click()` and `#moveMouseTo()` call. This new method scrolls the element into view when necessary, and then additionally adjusts the scroll position of the root scroll element by the necessary pixels if the top of the element is within `layout.fixedHeaderHeight` pixels.
2019-01-16 12:37:40 -08:00
Thomas Neirynck ffc8bae820
[GIS] Add Maps Plugin (#24804)
This adds the MVP of the Phase 1 version of the Maps Plugin to Kibana (https://github.com/elastic/kibana/issues/19582).

This is added as a new Stack Feature, requiring a basic license.
2018-12-19 16:14:41 -05:00
Spencer ccfa8a3530
[canvas] remove unnecessary eslint style overrides, use curlys (#27176)
* [canvas] remove styling rules that are handled by prettier, always use curlys in if

* [eslint] autofix missing curly brackets

* [eslint/canvas] remove redundant prettier plugin config

* autofix lint errors in canvas_plugin_src/renderers/time_filter/components/datetime_range_absolute/datetime_range_absolute.js
2018-12-17 17:32:06 -08:00
Bhavya RM 7e2e450486
Adding label-has-associated-control to jsx-a11y lint rules and associated UI fixes 2018-12-12 10:04:15 -05:00
Spencer 0b4ae5020b
[npm] prepare @kbn/datemath for publishing (#26559)
We need to share `@kbn/datemath` with `@elastic/eui`, and rather than making them rely on Kibana for their dependencies we've decided to republish `@kbn/datemath` as `@elastic/datemath`. This isn't something we want to do often, so please check with the platform team if you'd like to do this for another module.
2018-12-03 16:01:16 -08:00
Spencer c122fa96a0
[eslint] use disallow license header rule (#26309)
Fixes #26295

There are several places where we have accidentally added new license headers with linters but failed to remove old license headers manually. This prevents that by applying the an inverted version of the license headers rule that removed invalid license headers when files are moved.
2018-11-27 16:49:17 -08:00
Spencer 54f1a739cd
[@kbn/interpreter] improve build/packaging (#26096)
Summary of changes:

 - move all build artifacts under `target` directory
 - run babel and webpack in parallel
 - support optional watch and sourcemaps in build
 - expose /common /public /plugin /server sub-exports as index.js
 - avoid importing deeply from `@kbn/interpreter`
 - move a couple missed dependencies from x-pack to kibana
 - remove custom babel-register implementation
2018-11-23 14:16:38 -07:00
Spencer cfaa1783c3
[canvas] move yarn scripts to node scripts (#25258)
* [canvas] move yarn scripts to node scripts

* [canvas/eslint] allow scripts to access devDeps

* [canvas/eslint] remove packageDir override

* [x-pack] move babel-register to deps for canvas

* [canvas] rename scripts from : to _

* [canvas] update readme with correct script paths

* [canvas] remove yarn.lock file

* Remove redundant require
2018-11-07 10:53:06 -08:00
Spencer 5f9337e35b [canvas] unify eslint config in .eslintrc.js (#25260)
Simply remove the remaining eslint config files from canvas and merge with other canvas related overrides in `.eslintrc.js`
2018-11-07 09:33:39 -07:00
Joe Fleming f6fd86aa4d
Chore: fix canvas linting (#25024)
This fixes `yarn run lint` from within the Canvas plugin path.

- Point to the correct eslint config file
- Use absolute path for `packageDir`
- Remove extraneous `packageDir` settings
2018-11-02 11:24:11 -06:00
Bhavya RM 4c0a5e5a67
Adding jsxa11y into eslint rules (#23932) 2018-11-01 12:47:16 -04:00
Aleh Zasypkin b2baf32fba
Expose core config schema validation system as @kbn/config-schema package. (#23609) 2018-10-04 09:18:40 +02:00
Maryia Lapata 110c987c89 Update versions of @babel/parser and @babel/types (#23268)
Update versions of @babel/parser, @babel/types, eslint, babel-eslint
2018-09-25 14:35:31 +03:00
joe fleming af84ecca84 chore: eslint fixes in canvas
adds license headers and includes project linting overrides
2018-09-13 14:58:36 -07:00
Joe Fleming ef4b694e83
Chore: Reorg the x-pack gulp tasks (#22785)
- Removes deprecated, non-functional lint scripts
- Removes some unused (and barely used) dependencies
- Replaces deprecated `gulp-util` dependency
- Adds eslint rule to prevent future use of deprecated `gulp-util` dependency
- Moves all gulp tasks into `tasks` path
- Moves `gulp_helpers` into `tasks/helpers`
- All tasks in `gulpfile.js` were moved into `tasks` and broken up by domain

This is basically a no-op moving files around PR. All the existing tasks appear to work the same with these changes.

<img width="334" alt="screenshot 2018-09-06 15 42 45" src="https://user-images.githubusercontent.com/404731/45188971-8618c000-b1eb-11e8-9b26-b072ccc7ddb7.png">
2018-09-07 09:43:17 -07:00
Tyler Smalley 46bacc6c64
Workaround for yarn interdependency conflicts (#20805)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-07-16 07:42:49 -07:00
Tim Roes cb5ee01c6a
Increase prettier line width to 100 (#20535)
* Increase prettier line width to 100

* Fix packages JS prettier

* Change style guide to 100 width

* Fix line-width in latest master changes
2018-07-09 22:50:37 +02:00
Maxim Tolochko f522b31ac9
Add draft implementation of I18n engine (#19555)
* Add draft implementation of I18n engine

* Add i18n loader

* kbn-i18n refactoring

* Fix react i18n context and update doc

* i18n engine refactoring

* Fix locales data loading and add more jsdoc comments

* Fix verify_translations task

* I18n tests refactoring

* Add build scripts to kbn-i18n package

* Fix some bugs

* Move uiI18nMixin into ui_i18n folder

* Add 'browser' field to kbn-i18n package.json

* Get rid of "showError" method

* Make i18n and i18nLoader a singleton object

* Add default locale as fallback if translation files were not registered

* Update yarn.lock

* kbn-i18n fix

* Add default formats

* Try to fix build

* Add more examples into kbn-i18n/README.md

* kbn-i18n fix

* Fix app_bootstrap tests

* Add links to issues in TODO comments
2018-06-28 12:38:39 +03:00
Josh Soref 2b27fb1c5f Fix misspellings (#19981) 2018-06-26 20:17:41 -07:00
Spencer f0cc432faf
Apache 2.0 license headers (#19383)
In order to make the license that applies to each file as clear as possible, and to be consistent with elasticsearch, we are adding Apache 2.0 license headers to the top of each file.

Existence of this header is enforced by eslint and tslint and missing headers were automatically added in the last commit by running:

```
node scripts/eslint --fix && node scripts/tslint --fix
```
2018-05-28 20:06:30 -07:00
Tiago Costa 194aba149f
Validate current node version (#19154)
* feat(12976): node version validation at runtime.

* refact(12976): move the code into a static utilities class.

* test(12976): added first test case using jest.

* test(12976): added test cases for node_version.

* feat(12976): create setup env node to bootstrap babel, ts-node and node version validator.

* refact(12976): migrated node version code from es6 to es5.

* feat(12976): node version validation at runtime.

* refact(12976): move the code into a static utilities class.

* test(12976): added first test case using jest.

* test(12976): added test cases for node_version.

* feat(12976): create setup env node to bootstrap babel, ts-node and node version validator.

* refact(12976): migrated node version code from es6 to es5.

* fix(12976): remove one level from ts node register cache directory link.

* chore(12976): added caret to semver dependecy in order to support minor versions.

* refact(12976): small change from named import to default import on node version validator.

* refact(12976): removed ts_node_register and add the code to babel_register.

* feat(12976): split eslint config in order to properly support files built to run before and after node version validator. refact(12976): convert script files to es5 code. refact(12976): delete inline eslint configs from node version check related files.

* refact(12976): remove ts node register file.

* refact(12976): completely port setup_node_env to es5.

* refact(12976): remove babel_register invokation from external dependencies in scripts.

* refact(12976): move node_version code directly into node_version_validator inside setup_node_env folder.

* refact(12976): only node version validator for kbn script.
2018-05-25 18:43:01 +01:00
Spencer 0b03166d2d
[eslint] unify resolver configs (#19102)
* [eslint] unify resolver configs

Our eslint resolver settings currently rely on the fact that we define
our resolver with a string globally, and an object in the overrides.
This causes the override value to completely override/replace the global
setting, which is desired, but when the global setting is converted to
an object they are merged, causing both resolvers to run.

This is a problem because some dependencies in the UI side of things
will resolve with the node resolver, but will resolve incorrectly
because they are intended to use some webpack specific override.

While trying to add TypeScript I needed to pass argument to the node
resolver which uncovered this issue. The change here moves us away from
using the node resolver directly and instead uses the kibana resolver
with `forceNode: true` set when linting server code and `forceNode:
false` when resolving imports that will be handled by webpack.

* [import-resolver] use object spread operator
2018-05-16 10:45:41 -07:00
Tim Roes f579d2299f
Update React to 16.3 (#18768)
* Update React to 16.3

* Switch off specific eslint rules

* Update enzyme snapshots

* Incorporate PR feedback
2018-05-14 14:05:17 +02:00
archana b58e757794
Functional test setup with kbn-test package (#18568)
Restructure testing with kbn-test package

 - Run with multiple configs, move cli options to config
 - Package-ify kbn-test
 - Eventually we'll have functional_test_runner live in a package
of its own, and then this kbn-test will use that as a dependency,
probably still as a devDependency.
 - Implement functional_tests_server
 - Collapse single and multiple config apis into one command

Use kbn-es

Replace es_test_cluster + es_test_config with kbn/test utils

Implement new createEsTestCluster

Improve scripts, jsdocs, cli top-level tools

Lift error handling to the top level
2018-05-09 18:23:49 -05:00
Spencer e1a2fcbd96
[uiExports] migrate uiApp "uses" to explicit imports in apps (#17828)
* [uiExports] migrate uiApp "uses" to explicit imports in apps

* [uiApp] update tests for getModules() method

* [optimize/uiExports] improve naming and comments

* [uiExports] sort imports so they load in the same order as before

* [testHarness] load hacks when testing in the browser

* [x-pack/uiExports] use new uiExports modules

* [testHarness] describe why we import uiExports/hacks

* [optimize] remove needless [].concat()

* [optimize/createUiExportsModule] string.includes > string.indexOf

* [uiExports/createUiExportsModule] remove needless capture of module exports
2018-05-03 12:18:50 -07:00
Jenkins CI fe4609647d Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
Kim Joar Bekkelund ef900fd42d
Enable Prettier for more packages (#17763) 2018-04-20 17:13:34 +02:00
Spencer 4f2a19bd9b
[eslint-import-resolver-kibana] bring in repo as package (#17665)
* [eslint-import-resolver-kibana] bring in repo as package

* [eslint-import-resolver] enable prettier
2018-04-11 15:21:29 -07:00
Tyler Smalley 82e17f435f
[kbn-es] Package for managing Elasticsearch during dev and testing (#17168)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-03-20 08:30:15 -07:00
Spencer ef3339bd7a
[@kbn/ui-framework] move ui-framework to a package (#17085)
* [@kbn/ui-framework] move ui-framework to a package

* [@kbn/ui-framework] restore doc_site index.html and fix build task names

* [jest] always ignore modules in target dirs
2018-03-13 10:43:39 -07:00
Spencer 4d246a10a8
[kbn-pm] rename from kbn-build (#16739) 2018-02-14 10:57:13 -07:00
Kim Joar Bekkelund 1c3b404774
Production package example: datemath (#16531) 2018-02-13 21:49:55 +01:00
Spencer 2c7a1f34cb
[kbn-plugin-generator] add plugin generator to the repo (#16655)
* [kbn-plugin-generator] add plugin generator to the repo

* [plugin-generator] use snake_case plugin name for directory name

* [plugin-generator] fix typo

* [plugin-generator] remove translation support until we resume i18n efforts

* [yarn] update lockfile

* [mocha] remove plugin-generator selector from mocha tests

* [plugin-generator] update generated readme to recommend yarn

* [plugin-generator] add readme to generator pacakge

* [plugin-generator] link from plugin-resource docs

* [plugin-generator] mention very important `kbn bootstrap` script

* [plugin-generator] rework some parts of the README

* [plugin-generator] log actual directory name with system separators

* [plugin-generator] include bootstrap/yarn preinstall check script
2018-02-12 12:23:23 -07:00
spalger 9f6ebb12b6 [kbn-plugin-helpers] remove redundant configs 2018-02-08 11:57:08 -07:00
Spencer b596ad3d5d
[eslint] un-ignore .eslintrc.js (#16542) 2018-02-05 16:29:30 -07:00
Kim Joar Bekkelund e58b43f744
Prettier + ESLint setup (#16514)
* Move .eslintrc (yaml) to .eslintrc.js (js)

* Add Prettier setup to ESLint

* Run Prettier on @kbn/build

* Update style guide with Prettier
2018-02-05 18:18:43 +01:00