diff --git a/src/core_plugins/kibana/public/dashboard/index.js b/src/core_plugins/kibana/public/dashboard/index.js index c8b125d009b00..89b420fec166c 100644 --- a/src/core_plugins/kibana/public/dashboard/index.js +++ b/src/core_plugins/kibana/public/dashboard/index.js @@ -108,26 +108,32 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, key: 'new', description: 'New Dashboard', run: function () { kbnUrl.change('/dashboard', {}); }, + testId: 'dashboardNewButton', }, { key: 'add', description: 'Add a panel to the dashboard', - template: require('plugins/kibana/dashboard/partials/pick_visualization.html') + template: require('plugins/kibana/dashboard/partials/pick_visualization.html'), + testId: 'dashboardAddPanelButton', }, { key: 'save', description: 'Save Dashboard', - template: require('plugins/kibana/dashboard/partials/save_dashboard.html') + template: require('plugins/kibana/dashboard/partials/save_dashboard.html'), + testId: 'dashboardSaveButton', }, { key: 'open', description: 'Open Saved Dashboard', - template: require('plugins/kibana/dashboard/partials/load_dashboard.html') + template: require('plugins/kibana/dashboard/partials/load_dashboard.html'), + testId: 'dashboardOpenButton', }, { key: 'share', description: 'Share Dashboard', - template: require('plugins/kibana/dashboard/partials/share.html') + template: require('plugins/kibana/dashboard/partials/share.html'), + testId: 'dashboardShareButton', }, { key: 'options', description: 'Options', - template: require('plugins/kibana/dashboard/partials/options.html') + template: require('plugins/kibana/dashboard/partials/options.html'), + testId: 'dashboardOptionsButton', }]; $scope.refresh = _.bindKey(courier, 'fetch'); diff --git a/src/core_plugins/kibana/public/discover/controllers/discover.js b/src/core_plugins/kibana/public/discover/controllers/discover.js index f70e0d08fd5d3..86ae3f23c4760 100644 --- a/src/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/core_plugins/kibana/public/discover/controllers/discover.js @@ -115,19 +115,23 @@ function discoverController($scope, config, courier, $route, $window, Notifier, $scope.topNavMenu = [{ key: 'new', description: 'New Search', - run: function () { kbnUrl.change('/discover'); } + run: function () { kbnUrl.change('/discover'); }, + testId: 'discoverNewButton', }, { key: 'save', description: 'Save Search', - template: require('plugins/kibana/discover/partials/save_search.html') + template: require('plugins/kibana/discover/partials/save_search.html'), + testId: 'discoverSaveButton', }, { key: 'open', - description: 'Load Saved Search', - template: require('plugins/kibana/discover/partials/load_search.html') + description: 'Open Saved Search', + template: require('plugins/kibana/discover/partials/load_search.html'), + testId: 'discoverOpenButton', }, { key: 'share', description: 'Share Search', - template: require('plugins/kibana/discover/partials/share_search.html') + template: require('plugins/kibana/discover/partials/share_search.html'), + testId: 'discoverShareButton', }]; $scope.timefilter = timefilter; diff --git a/src/core_plugins/kibana/public/visualize/editor/editor.js b/src/core_plugins/kibana/public/visualize/editor/editor.js index ea8bd1bbee123..ac459a423d573 100644 --- a/src/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/core_plugins/kibana/public/visualize/editor/editor.js @@ -104,23 +104,28 @@ function VisEditor($scope, $route, timefilter, AppState, $location, kbnUrl, $tim $scope.topNavMenu = [{ key: 'new', description: 'New Visualization', - run: function () { kbnUrl.change('/visualize', {}); } + run: function () { kbnUrl.change('/visualize', {}); }, + testId: 'visualizeNewButton', }, { key: 'save', + description: 'Save Visualization', template: require('plugins/kibana/visualize/editor/panels/save.html'), - description: 'Save Visualization' + testId: 'visualizeSaveButton', }, { key: 'open', - template: require('plugins/kibana/visualize/editor/panels/load.html'), description: 'Open Saved Visualization', + template: require('plugins/kibana/visualize/editor/panels/load.html'), + testId: 'visualizeOpenButton', }, { key: 'share', + description: 'Share Visualization', template: require('plugins/kibana/visualize/editor/panels/share.html'), - description: 'Share Visualization' + testId: 'visualizeShareButton', }, { key: 'refresh', description: 'Refresh', - run: function () { $scope.fetch(); } + run: function () { $scope.fetch(); }, + testId: 'visualizeRefreshButton', }]; if (savedVis.id) { diff --git a/src/core_plugins/timelion/public/app.js b/src/core_plugins/timelion/public/app.js index be8d263a0afa4..cd16759251b63 100644 --- a/src/core_plugins/timelion/public/app.js +++ b/src/core_plugins/timelion/public/app.js @@ -28,7 +28,6 @@ require('ui/saved_objects/saved_object_registry').register(require('plugins/time // TODO: Expose an api for dismissing notifications var unsafeNotifications = require('ui/notify')._notifs; -//var ConfigTemplate = require('ui/config_template'); require('ui/routes').enable(); @@ -67,27 +66,33 @@ app.controller('timelion', function ( $scope.topNavMenu = [{ key: 'new', description: 'New Sheet', - run: function () { kbnUrl.change('/'); } + run: function () { kbnUrl.change('/'); }, + testId: 'timelionNewButton', }, { key: 'add', description: 'Add a chart', - run: function () { $scope.newCell(); } + run: function () { $scope.newCell(); }, + testId: 'timelionAddChartButton', }, { key: 'save', description: 'Save Sheet', - template: require('plugins/timelion/partials/save_sheet.html') + template: require('plugins/timelion/partials/save_sheet.html'), + testId: 'timelionSaveButton', }, { key: 'open', - description: 'Load Sheet', - template: require('plugins/timelion/partials/load_sheet.html') + description: 'Open Sheet', + template: require('plugins/timelion/partials/load_sheet.html'), + testId: 'timelionOpenButton', }, { key: 'options', description: 'Options', - template: require('plugins/timelion/partials/sheet_options.html') + template: require('plugins/timelion/partials/sheet_options.html'), + testId: 'timelionOptionsButton', }, { key: 'docs', description: 'Documentation', - template: '' + template: '', + testId: 'timelionDocsButton', }]; diff --git a/tasks/test.js b/tasks/test.js index 7e67e54f39126..edbc06f8f82a4 100644 --- a/tasks/test.js +++ b/tasks/test.js @@ -76,6 +76,7 @@ module.exports = function (grunt) { ]); grunt.registerTask('test:ui:server', [ + 'checkPlugins', 'esvm:ui', 'run:testUIDevServer:keepalive' ]); diff --git a/test/support/page_objects/dashboard_page.js b/test/support/page_objects/dashboard_page.js index 426efebee0147..8e20f2080186b 100644 --- a/test/support/page_objects/dashboard_page.js +++ b/test/support/page_objects/dashboard_page.js @@ -13,14 +13,12 @@ export default class DashboardPage { } clickNewDashboard() { - return this.findTimeout - .findByCssSelector('[aria-label="New Dashboard"]') + return PageObjects.common.findTestSubject('dashboardNewButton') .click(); } clickAddVisualization() { - return this.findTimeout - .findByCssSelector('[aria-label="Add a panel to the dashboard"]') + return PageObjects.common.findTestSubject('dashboardAddPanelButton') .click(); } @@ -70,8 +68,7 @@ export default class DashboardPage { } saveDashboard(dashName) { - return this.findTimeout - .findByCssSelector('[aria-label="Save Dashboard"]') + return PageObjects.common.findTestSubject('dashboardSaveButton') .click() .then(() => { return PageObjects.header.isGlobalLoadingIndicatorHidden(); @@ -125,8 +122,7 @@ export default class DashboardPage { // entry, or at least to a single page of results loadSavedDashboard(dashName) { var self = this; - return this.findTimeout - .findByCssSelector('[aria-label="Open Saved Dashboard"]') + return PageObjects.common.findTestSubject('dashboardOpenButton') .click() .then(function filterDashboard() { PageObjects.common.debug('Load Saved Dashboard button clicked'); diff --git a/test/support/page_objects/discover_page.js b/test/support/page_objects/discover_page.js index aed34e59c168b..647dcbc2b2b0c 100644 --- a/test/support/page_objects/discover_page.js +++ b/test/support/page_objects/discover_page.js @@ -57,20 +57,17 @@ export default class DiscoverPage { } clickNewSearchButton() { - return this.findTimeout - .findByCssSelector('[aria-label="New Search"]') + return PageObjects.common.findTestSubject('discoverNewButton') .click(); } clickSaveSearchButton() { - return this.findTimeout - .findByCssSelector('[aria-label="Save Search"]') + return PageObjects.common.findTestSubject('discoverSaveButton') .click(); } clickLoadSavedSearchButton() { - return this.findTimeout - .findDisplayedByCssSelector('[aria-label="Load Saved Search"]') + return PageObjects.common.findTestSubject('discoverOpenButton') .click(); } @@ -192,8 +189,7 @@ export default class DiscoverPage { } clickShare() { - return this.findTimeout - .findByCssSelector('[aria-label="Share Search"]') + return PageObjects.common.findTestSubject('discoverShareButton') .click(); } diff --git a/test/support/page_objects/visualize_page.js b/test/support/page_objects/visualize_page.js index e92288c0232e4..c048aa9fa95c6 100644 --- a/test/support/page_objects/visualize_page.js +++ b/test/support/page_objects/visualize_page.js @@ -292,19 +292,13 @@ export default class VisualizePage { }); } - clickNewVisualization() { - return this.remote - .setFindTimeout(defaultFindTimeout) - .findByCssSelector('[aria-label="New Visualization"]') + return PageObjects.common.findTestSubject('visualizeNewButton') .click(); } - saveVisualization(vizName) { - return this.remote - .setFindTimeout(defaultFindTimeout) - .findByCssSelector('[aria-label="Save Visualization"]') + return PageObjects.common.findTestSubject('visualizeSaveButton') .click() .then(() => { return PageObjects.common.sleep(1000); @@ -339,9 +333,7 @@ export default class VisualizePage { } clickLoadSavedVisButton() { - return this.remote - .setFindTimeout(defaultFindTimeout) - .findDisplayedByCssSelector('[aria-label="Open Saved Visualization"]') + return PageObjects.common.findTestSubject('visualizeOpenButton') .click(); } @@ -433,7 +425,6 @@ export default class VisualizePage { ** Returns an array of height values */ getAreaChartData(aggregateName) { - var self = this.remote; var chartData = []; var tempArray = [];