Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional tests: refactor dashboard_page #54588

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions test/functional/apps/dashboard/dashboard_clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import expect from '@kbn/expect';

export default function({ getService, getPageObjects }) {
const retry = getService('retry');
const listingTable = getService('listingTable');
const PageObjects = getPageObjects(['dashboard', 'header', 'common']);

describe('dashboard clone', function describeIndexTests() {
Expand All @@ -40,10 +41,12 @@ export default function({ getService, getPageObjects }) {

await PageObjects.dashboard.clickClone();
await PageObjects.dashboard.confirmClone();

const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
await PageObjects.dashboard.gotoDashboardLandingPage();
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
clonedDashboardName
);

expect(countOfDashboards).to.equal(1);
});

Expand All @@ -70,8 +73,10 @@ export default function({ getService, getPageObjects }) {

it("and doesn't save", async () => {
await PageObjects.dashboard.cancelClone();
await PageObjects.dashboard.gotoDashboardLandingPage();

const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
dashboardName
);
expect(countOfDashboards).to.equal(1);
Expand All @@ -85,8 +90,10 @@ export default function({ getService, getPageObjects }) {
await PageObjects.dashboard.expectDuplicateTitleWarningDisplayed({ displayed: true });
await PageObjects.dashboard.confirmClone();
await PageObjects.dashboard.waitForRenderComplete();
await PageObjects.dashboard.gotoDashboardLandingPage();

const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
dashboardName + ' Copy'
);
expect(countOfDashboards).to.equal(2);
Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/dashboard/dashboard_filter_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function({ getService, getPageObjects }) {
const pieChart = getService('pieChart');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize']);
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']);

describe('dashboard filter bar', () => {
before(async () => {
Expand Down Expand Up @@ -91,7 +91,7 @@ export default function({ getService, getPageObjects }) {
await filterBar.ensureFieldEditorModalIsClosed();
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.setTimepickerInDataRange();
await PageObjects.timePicker.setDefaultDataRange();
});

it('are not selected by default', async function() {
Expand Down Expand Up @@ -136,7 +136,7 @@ export default function({ getService, getPageObjects }) {
await filterBar.ensureFieldEditorModalIsClosed();
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.setTimepickerInDataRange();
await PageObjects.timePicker.setDefaultDataRange();
});

it('are added when a cell magnifying glass is clicked', async function() {
Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/dashboard/dashboard_filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const dashboardPanelActions = getService('dashboardPanelActions');
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize']);
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']);

describe('dashboard filtering', function() {
this.tags('smoke');
Expand All @@ -52,7 +52,7 @@ export default function({ getService, getPageObjects }) {
describe('adding a filter that excludes all data', () => {
before(async () => {
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.setTimepickerInDataRange();
await PageObjects.timePicker.setDefaultDataRange();
await dashboardAddPanel.addEveryVisualization('"Filter Bytes Test"');
await dashboardAddPanel.addEverySavedSearch('"Filter Bytes Test"');

Expand Down Expand Up @@ -234,7 +234,7 @@ export default function({ getService, getPageObjects }) {

it('visualization saved with a query filters data', async () => {
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.setTimepickerInDataRange();
await PageObjects.timePicker.setDefaultDataRange();

await dashboardAddPanel.addVisualization('Rendering-Test:-animal-sounds-pie');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down
54 changes: 30 additions & 24 deletions test/functional/apps/dashboard/dashboard_listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import expect from '@kbn/expect';
export default function({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['dashboard', 'header', 'common']);
const browser = getService('browser');
const listingTable = getService('listingTable');

describe('dashboard listing page', function describeIndexTests() {
const dashboardName = 'Dashboard Listing Test';
Expand All @@ -41,7 +42,8 @@ export default function({ getService, getPageObjects }) {
await PageObjects.dashboard.saveDashboard(dashboardName);

await PageObjects.dashboard.gotoDashboardLandingPage();
const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
dashboardName
);
expect(countOfDashboards).to.equal(1);
Expand All @@ -53,7 +55,8 @@ export default function({ getService, getPageObjects }) {
});

it('is not shown when there are no dashboards shown during a search', async function() {
const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
'gobeldeguck'
);
expect(countOfDashboards).to.equal(0);
Expand All @@ -65,29 +68,31 @@ export default function({ getService, getPageObjects }) {

describe('delete', function() {
it('default confirm action is cancel', async function() {
await PageObjects.dashboard.searchForDashboardWithName(dashboardName);
await PageObjects.dashboard.checkDashboardListingSelectAllCheckbox();
await PageObjects.dashboard.clickDeleteSelectedDashboards();
await listingTable.searchForItemWithName(dashboardName);
await listingTable.checkListingSelectAllCheckbox();
await listingTable.clickDeleteSelected();

await PageObjects.common.expectConfirmModalOpenState(true);

await PageObjects.common.pressEnterKey();

await PageObjects.common.expectConfirmModalOpenState(false);

const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
dashboardName
);
expect(countOfDashboards).to.equal(1);
});

it('succeeds on confirmation press', async function() {
await PageObjects.dashboard.checkDashboardListingSelectAllCheckbox();
await PageObjects.dashboard.clickDeleteSelectedDashboards();
await listingTable.checkListingSelectAllCheckbox();
await listingTable.clickDeleteSelected();

await PageObjects.common.clickConfirmOnModal();

const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
dashboardName
);
expect(countOfDashboards).to.equal(0);
Expand All @@ -96,44 +101,45 @@ export default function({ getService, getPageObjects }) {

describe('search', function() {
before(async () => {
await PageObjects.dashboard.clearSearchValue();
await listingTable.clearSearchFilter();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.saveDashboard('Two Words');
await PageObjects.dashboard.gotoDashboardLandingPage();
});

it('matches on the first word', async function() {
await PageObjects.dashboard.searchForDashboardWithName('Two');
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
await listingTable.searchForItemWithName('Two');
const countOfDashboards = await listingTable.getItemsCount('dashboard');
expect(countOfDashboards).to.equal(1);
});

it('matches the second word', async function() {
await PageObjects.dashboard.searchForDashboardWithName('Words');
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
await listingTable.searchForItemWithName('Words');
const countOfDashboards = await listingTable.getItemsCount('dashboard');
expect(countOfDashboards).to.equal(1);
});

it('matches the second word prefix', async function() {
await PageObjects.dashboard.searchForDashboardWithName('Wor');
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
await listingTable.searchForItemWithName('Wor');
const countOfDashboards = await listingTable.getItemsCount('dashboard');
expect(countOfDashboards).to.equal(1);
});

it('does not match mid word', async function() {
await PageObjects.dashboard.searchForDashboardWithName('ords');
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
await listingTable.searchForItemWithName('ords');
const countOfDashboards = await listingTable.getItemsCount('dashboard');
expect(countOfDashboards).to.equal(0);
});

it('is case insensitive', async function() {
await PageObjects.dashboard.searchForDashboardWithName('two words');
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
await listingTable.searchForItemWithName('two words');
const countOfDashboards = await listingTable.getItemsCount('dashboard');
expect(countOfDashboards).to.equal(1);
});

it('is using AND operator', async function() {
await PageObjects.dashboard.searchForDashboardWithName('three words');
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
await listingTable.searchForItemWithName('three words');
const countOfDashboards = await listingTable.getItemsCount('dashboard');
expect(countOfDashboards).to.equal(0);
});
});
Expand Down Expand Up @@ -176,7 +182,7 @@ export default function({ getService, getPageObjects }) {
});

it('preloads search filter bar when there is no match', async function() {
const searchFilter = await PageObjects.dashboard.getSearchFilterValue();
const searchFilter = await listingTable.getSearchFilterValue();
expect(searchFilter).to.equal('"nodashboardsnamedme"');
});

Expand All @@ -196,7 +202,7 @@ export default function({ getService, getPageObjects }) {
});

it('preloads search filter bar when there is more than one match', async function() {
const searchFilter = await PageObjects.dashboard.getSearchFilterValue();
const searchFilter = await listingTable.getSearchFilterValue();
expect(searchFilter).to.equal('"two words"');
});

Expand Down
17 changes: 12 additions & 5 deletions test/functional/apps/dashboard/dashboard_save.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@

import expect from '@kbn/expect';

export default function({ getPageObjects }) {
export default function({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['dashboard', 'header']);
const listingTable = getService('listingTable');

describe('dashboard save', function describeIndexTests() {
this.tags('smoke');
Expand All @@ -47,8 +48,10 @@ export default function({ getPageObjects }) {

it('does not save on reject confirmation', async function() {
await PageObjects.dashboard.cancelSave();
await PageObjects.dashboard.gotoDashboardLandingPage();

const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
dashboardName
);
expect(countOfDashboards).to.equal(1);
Expand All @@ -68,15 +71,17 @@ export default function({ getPageObjects }) {
// wait till it finishes reloading or it might reload the url after simulating the
// dashboard landing page click.
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.dashboard.gotoDashboardLandingPage();

const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
dashboardName
);
expect(countOfDashboards).to.equal(2);
});

it('Does not warn when you save an existing dashboard with the title it already has, and that title is a duplicate', async function() {
await PageObjects.dashboard.selectDashboard(dashboardName);
await listingTable.clickItemLink('dashboard', dashboardName);
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.dashboard.switchToEditMode();
await PageObjects.dashboard.saveDashboard(dashboardName);
Expand Down Expand Up @@ -121,8 +126,10 @@ export default function({ getPageObjects }) {
// wait till it finishes reloading or it might reload the url after simulating the
// dashboard landing page click.
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.dashboard.gotoDashboardLandingPage();

const countOfDashboards = await PageObjects.dashboard.getDashboardCountWithName(
const countOfDashboards = await listingTable.searchAndGetItemsCount(
'dashboard',
dashboardNameEnterKey
);
expect(countOfDashboards).to.equal(1);
Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/dashboard/dashboard_snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import expect from '@kbn/expect';

export default function({ getService, getPageObjects, updateBaselines }) {
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'common']);
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'common', 'timePicker']);
const screenshot = getService('screenshots');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
Expand Down Expand Up @@ -48,7 +48,7 @@ export default function({ getService, getPageObjects, updateBaselines }) {
it('compare TSVB snapshot', async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.setTimepickerInLogstashDataRange();
await PageObjects.timePicker.setLogstashDataRange();
await dashboardAddPanel.addVisualization('Rendering Test: tsvb-ts');
await PageObjects.common.closeToast();

Expand All @@ -71,7 +71,7 @@ export default function({ getService, getPageObjects, updateBaselines }) {
it('compare area chart snapshot', async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.setTimepickerInLogstashDataRange();
await PageObjects.timePicker.setLogstashDataRange();
await dashboardAddPanel.addVisualization('Rendering Test: area with not filter');
await PageObjects.common.closeToast();

Expand Down
7 changes: 4 additions & 3 deletions test/functional/apps/dashboard/dashboard_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function({ getService, getPageObjects }) {
'discover',
'tileMap',
'visChart',
'timePicker',
]);
const testSubjects = getService('testSubjects');
const browser = getService('browser');
Expand All @@ -58,7 +59,7 @@ export default function({ getService, getPageObjects }) {
await PageObjects.dashboard.gotoDashboardLandingPage();

await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.setTimepickerInHistoricalDataRange();
await PageObjects.timePicker.setHistoricalDataRange();

await dashboardAddPanel.addVisualization(AREA_CHART_VIS_NAME);
await PageObjects.dashboard.saveDashboard('Overridden colors');
Expand All @@ -83,7 +84,7 @@ export default function({ getService, getPageObjects }) {
await PageObjects.dashboard.gotoDashboardLandingPage();

await PageObjects.header.clickDiscover();
await PageObjects.dashboard.setTimepickerInHistoricalDataRange();
await PageObjects.timePicker.setHistoricalDataRange();
await PageObjects.discover.clickFieldListItemAdd('bytes');
await PageObjects.discover.saveSearch('my search');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down Expand Up @@ -147,7 +148,7 @@ export default function({ getService, getPageObjects }) {
await PageObjects.dashboard.gotoDashboardLandingPage();

await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.setTimepickerInHistoricalDataRange();
await PageObjects.timePicker.setHistoricalDataRange();

await dashboardAddPanel.addVisualization('Visualization TileMap');
await PageObjects.dashboard.saveDashboard('No local edits');
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/dashboard/dashboard_time_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function({ getService, getPageObjects }) {
await PageObjects.dashboard.addVisualizations([PIE_CHART_VIS_NAME]);
await pieChart.expectPieSliceCount(0);

await PageObjects.dashboard.setTimepickerInHistoricalDataRange();
await PageObjects.timePicker.setHistoricalDataRange();
await pieChart.expectPieSliceCount(10);
});

Expand Down Expand Up @@ -95,7 +95,7 @@ export default function({ getService, getPageObjects }) {
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.addVisualizations([PIE_CHART_VIS_NAME]);
// Same date range as `setTimepickerInHistoricalDataRange`
// Same date range as `timePicker.setHistoricalDataRange()`
await PageObjects.timePicker.setAbsoluteRange(
'2015-09-19 06:31:44.000',
'2015-09-23 18:31:44.000'
Expand Down
Loading