mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This commit is contained in:
parent
6eba02212a
commit
f74044a12d
2 changed files with 58 additions and 19 deletions
|
@ -6,6 +6,26 @@ export default function ({ getService, getPageObjects }) {
|
|||
const remote = getService('remote');
|
||||
let kibanaBaseUrl;
|
||||
|
||||
const urlQuery = `` +
|
||||
`_g=(refreshInterval:(display:Off,pause:!f,value:0),` +
|
||||
`time:(from:'2012-11-17T00:00:00.000Z',mode:absolute,to:'2015-11-17T18:01:36.621Z'))&` +
|
||||
`_a=(description:'',filters:!(),` +
|
||||
`fullScreenMode:!f,` +
|
||||
`options:(darkTheme:!f),` +
|
||||
`panels:!((col:1,id:Visualization-MetricChart,panelIndex:1,row:1,size_x:6,size_y:3,type:visualization),` +
|
||||
`(col:7,id:Visualization-PieChart,panelIndex:2,row:1,size_x:6,size_y:3,type:visualization)),` +
|
||||
`query:(language:lucene,query:'memory:%3E220000'),` +
|
||||
`timeRestore:!f,` +
|
||||
`title:'New+Dashboard',` +
|
||||
`uiState:(P-1:(vis:(defaultColors:('0+-+100':'rgb(0,104,55)'))),` +
|
||||
`P-2:(vis:(colors:('200,000':%23F9D9F9,` +
|
||||
`'240,000':%23F9D9F9,` +
|
||||
`'280,000':%23F9D9F9,` +
|
||||
`'320,000':%23F9D9F9,` +
|
||||
`'360,000':%23F9D9F9),` +
|
||||
`legendOpen:!t))),` +
|
||||
`viewMode:edit)`;
|
||||
|
||||
describe('bwc shared urls', function describeIndexTests() {
|
||||
before(async function () {
|
||||
await PageObjects.dashboard.initTests();
|
||||
|
@ -16,25 +36,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
describe('6.0 urls', () => {
|
||||
it('loads an unsaved dashboard', async function () {
|
||||
const url = `${kibanaBaseUrl}#/dashboard?` +
|
||||
`_g=(refreshInterval:(display:Off,pause:!f,value:0),` +
|
||||
`time:(from:'2012-11-17T00:00:00.000Z',mode:absolute,to:'2015-11-17T18:01:36.621Z'))&` +
|
||||
`_a=(description:'',filters:!(),` +
|
||||
`fullScreenMode:!f,` +
|
||||
`options:(darkTheme:!f),` +
|
||||
`panels:!((col:1,id:Visualization-MetricChart,panelIndex:1,row:1,size_x:6,size_y:3,type:visualization),` +
|
||||
`(col:7,id:Visualization-PieChart,panelIndex:2,row:1,size_x:6,size_y:3,type:visualization)),` +
|
||||
`query:(language:lucene,query:'memory:%3E220000'),` +
|
||||
`timeRestore:!f,` +
|
||||
`title:'New+Dashboard',` +
|
||||
`uiState:(P-1:(vis:(defaultColors:('0+-+100':'rgb(0,104,55)'))),` +
|
||||
`P-2:(vis:(colors:('200,000':%23F9D9F9,` +
|
||||
`'240,000':%23F9D9F9,` +
|
||||
`'280,000':%23F9D9F9,` +
|
||||
`'320,000':%23F9D9F9,` +
|
||||
`'360,000':%23F9D9F9),` +
|
||||
`legendOpen:!t))),` +
|
||||
`viewMode:edit)`;
|
||||
const url = `${kibanaBaseUrl}#/dashboard?${urlQuery}`;
|
||||
|
||||
await remote.get(url, true);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
@ -46,6 +48,35 @@ export default function ({ getService, getPageObjects }) {
|
|||
await dashboardExpect.panelCount(2);
|
||||
await dashboardExpect.selectedLegendColorCount('#F9D9F9', 5);
|
||||
});
|
||||
|
||||
it('loads a saved dashboard', async function () {
|
||||
await PageObjects.dashboard.saveDashboard('saved with colors', { storeTimeWithDashboard: true });
|
||||
|
||||
const id = await PageObjects.dashboard.getDashboardIdFromCurrentUrl();
|
||||
|
||||
const url = `${kibanaBaseUrl}#/dashboard/${id}`;
|
||||
|
||||
await remote.get(url, true);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
const query = await PageObjects.dashboard.getQuery();
|
||||
expect(query).to.equal('memory:>220000');
|
||||
|
||||
await dashboardExpect.pieSliceCount(5);
|
||||
await dashboardExpect.panelCount(2);
|
||||
await dashboardExpect.selectedLegendColorCount('#F9D9F9', 5);
|
||||
});
|
||||
|
||||
it('uiState in url takes precedence over saved dashboard state', async function () {
|
||||
const id = await PageObjects.dashboard.getDashboardIdFromCurrentUrl();
|
||||
const updatedQuery = urlQuery.replace(/F9D9F9/g, '000000');
|
||||
const url = `${kibanaBaseUrl}#/dashboard/${id}?${updatedQuery}`;
|
||||
|
||||
await remote.get(url, true);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await dashboardExpect.selectedLegendColorCount('#000000', 5);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -80,6 +80,14 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
|
|||
await testSubjects.click('exitFullScreenModeText');
|
||||
}
|
||||
|
||||
async getDashboardIdFromCurrentUrl() {
|
||||
const currentUrl = await remote.getCurrentUrl();
|
||||
const urlSubstring = 'kibana#/dashboard/';
|
||||
const startOfIdIndex = currentUrl.indexOf(urlSubstring) + urlSubstring.length;
|
||||
const endIndex = currentUrl.indexOf('?');
|
||||
return currentUrl.substring(startOfIdIndex, endIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if already on the dashboard landing page (that page doesn't have a link to itself).
|
||||
* @returns {Promise<boolean>}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue