* 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
* 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.
* [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
* 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
* 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
* [@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
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)
## 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.
* 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.
* 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.
* Revert "Replace Leadfoot with WebDriver API (#26477)"
This reverts commit 0bd3b4fdfb.
* leadfoot expectes execute args to be an array
* disable flaky graphql tests
* [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.
* 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.
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.
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.
* [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
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.
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.
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
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