improve preserve app cross state logic (#15464)

This commit is contained in:
Stacey Gammon 2017-12-07 16:07:17 -05:00 committed by GitHub
parent 1c84458078
commit c008f3225e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 33 deletions

View file

@ -15,7 +15,8 @@ export default function ({ getService, getPageObjects }) {
describe('dashboard tab', function describeIndexTests() {
before(async function () {
return PageObjects.dashboard.initTests();
await PageObjects.dashboard.initTests();
await PageObjects.dashboard.preserveCrossAppState();
});
after(async function () {
@ -27,13 +28,6 @@ export default function ({ getService, getPageObjects }) {
});
it('should be able to add visualizations to dashboard', async function addVisualizations() {
// This flip between apps fixes the url so state is preserved when switching apps in test mode.
// Without this flip the url in test mode looks something like
// "http://localhost:5620/app/kibana?_t=1486069030837#/dashboard?_g=...."
// after the initial flip, the url will look like this: "http://localhost:5620/app/kibana#/dashboard?_g=...."
await PageObjects.header.clickVisualize();
await PageObjects.header.clickDashboard();
await PageObjects.dashboard.clickNewDashboard();
await dashboardVisualizations.createAndAddTSVBVisualization('TSVB');
await PageObjects.dashboard.addVisualizations(PageObjects.dashboard.getTestVisualizationNames());

View file

@ -13,7 +13,8 @@ export default function ({ getService, getPageObjects }) {
describe('dashboard queries', function describeIndexTests() {
before(async function () {
return PageObjects.dashboard.initTests();
await PageObjects.dashboard.initTests();
await PageObjects.dashboard.preserveCrossAppState();
});
after(async function () {
@ -25,13 +26,6 @@ export default function ({ getService, getPageObjects }) {
});
it('Nested visualization query filters data as expected', async () => {
// This flip between apps fixes the url so state is preserved when switching apps in test mode.
// Without this flip the url in test mode looks something like
// "http://localhost:5620/app/kibana?_t=1486069030837#/dashboard?_g=...."
// after the initial flip, the url will look like this: "http://localhost:5620/app/kibana#/dashboard?_g=...."
await PageObjects.header.clickVisualize();
await PageObjects.header.clickDashboard();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.setTimepickerInDataRange();

View file

@ -14,12 +14,7 @@ export default function ({ getService, getPageObjects }) {
describe('dashboard state', function describeIndexTests() {
before(async function () {
await PageObjects.dashboard.initTests();
// This flip between apps fixes the url so state is preserved when switching apps in test mode.
// Without this flip the url in test mode looks something like
// "http://localhost:5620/app/kibana?_t=1486069030837#/dashboard?_g=...."
// after the initial flip, the url will look like this: "http://localhost:5620/app/kibana#/dashboard?_g=...."
await PageObjects.header.clickVisualize();
await PageObjects.header.clickDashboard();
await PageObjects.dashboard.preserveCrossAppState();
});
after(async function () {

View file

@ -11,10 +11,7 @@ export default function ({ getPageObjects }) {
describe('dashboard time', function dashboardSaveWithTime() {
before(async function () {
await PageObjects.dashboard.initTests();
// This flip between apps fixes the url so state is preserved when switching apps in test mode.
await PageObjects.header.clickVisualize();
await PageObjects.header.clickDashboard();
await PageObjects.dashboard.preserveCrossAppState();
});
after(async function () {

View file

@ -11,6 +11,7 @@ export default function ({ getService, getPageObjects }) {
describe('dashboard view edit mode', function viewEditModeTests() {
before(async function () {
await PageObjects.dashboard.initTests();
await PageObjects.dashboard.preserveCrossAppState();
await kibanaServer.uiSettings.disableToastAutohide();
await remote.refresh();
});
@ -20,13 +21,6 @@ export default function ({ getService, getPageObjects }) {
});
it('create new dashboard opens in edit mode', async function () {
// This flip between apps fixes the url so state is preserved when switching apps in test mode.
// Without this flip the url in test mode looks something like
// "http://localhost:5620/app/kibana?_t=1486069030837#/dashboard?_g=...."
// after the initial flip, the url will look like this: "http://localhost:5620/app/kibana#/dashboard?_g=...."
await PageObjects.header.clickVisualize();
await PageObjects.header.clickDashboard();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.clickCancelOutOfEditMode();
});

View file

@ -34,6 +34,11 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
await PageObjects.common.navigateToApp('dashboard');
}
async preserveCrossAppState() {
const url = await remote.getCurrentUrl();
await remote.get(url, false);
}
async clickEditVisualization() {
log.debug('clickEditVisualization');