Skip to content

Commit

Permalink
Update PageObjects for Visualize, Dashboard, and Discover to use data…
Browse files Browse the repository at this point in the history
…-test-subj selectors for menu items. (elastic#9155)

Backports PR elastic#9133

**Commit 1:**
Update PageObjects for Visualize, Dashboard, and Discover to use data-test-subj selectors for menu items.

* Original sha: 84cf9ba
* Authored by CJ Cenizal <[email protected]> on 2016-11-17T21:28:09Z

**Commit 2:**
Run checkPlugins task as part of test:ui:runner task.

* Original sha: 7cdf829
* Authored by CJ Cenizal <[email protected]> on 2016-11-19T18:07:47Z

Former-commit-id: 1150ea3
  • Loading branch information
elastic-jasper authored and cjcenizal committed Nov 19, 2016
1 parent 6ee27e6 commit 98278d4
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 51 deletions.
16 changes: 11 additions & 5 deletions src/core_plugins/kibana/public/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
14 changes: 9 additions & 5 deletions src/core_plugins/kibana/public/discover/controllers/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
15 changes: 10 additions & 5 deletions src/core_plugins/kibana/public/visualize/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
21 changes: 13 additions & 8 deletions src/core_plugins/timelion/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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: '<timelion-docs></timelion-docs>'
template: '<timelion-docs></timelion-docs>',
testId: 'timelionDocsButton',
}];


Expand Down
1 change: 1 addition & 0 deletions tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ module.exports = function (grunt) {
]);

grunt.registerTask('test:ui:server', [
'checkPlugins',
'esvm:ui',
'run:testUIDevServer:keepalive'
]);
Expand Down
12 changes: 4 additions & 8 deletions test/support/page_objects/dashboard_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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');
Expand Down
12 changes: 4 additions & 8 deletions test/support/page_objects/discover_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -192,8 +189,7 @@ export default class DiscoverPage {
}

clickShare() {
return this.findTimeout
.findByCssSelector('[aria-label="Share Search"]')
return PageObjects.common.findTestSubject('discoverShareButton')
.click();
}

Expand Down
15 changes: 3 additions & 12 deletions test/support/page_objects/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -433,7 +425,6 @@ export default class VisualizePage {
** Returns an array of height values
*/
getAreaChartData(aggregateName) {

var self = this.remote;
var chartData = [];
var tempArray = [];
Expand Down

0 comments on commit 98278d4

Please sign in to comment.