Fix visualize app chart type test (#47807)
* Add method to detect oss in settings pages - if it's not OSS, than 'Maps' is added to the expected chart types Co-authored-by: liza-mae <liza-mae@users.noreply.github.com>
This commit is contained in:
parent
7bcc7634ec
commit
83b4b4568c
|
@ -18,18 +18,22 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import expect from '@kbn/expect';
|
import expect from '@kbn/expect';
|
||||||
|
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||||
|
|
||||||
export default function ({ getService, getPageObjects }) {
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
export default function({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
const log = getService('log');
|
const log = getService('log');
|
||||||
const PageObjects = getPageObjects(['common', 'visualize']);
|
const PageObjects = getPageObjects(['common', 'visualize']);
|
||||||
|
let isOss = true;
|
||||||
|
|
||||||
describe('chart types', function () {
|
describe('chart types', function() {
|
||||||
before(function () {
|
before(async function() {
|
||||||
log.debug('navigateToApp visualize');
|
log.debug('navigateToApp visualize');
|
||||||
return PageObjects.visualize.navigateToNewVisualization();
|
isOss = await PageObjects.common.isOss();
|
||||||
|
await PageObjects.visualize.navigateToNewVisualization();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show the correct chart types', async function () {
|
it('should show the correct chart types', async function() {
|
||||||
const expectedChartTypes = [
|
const expectedChartTypes = [
|
||||||
'Area',
|
'Area',
|
||||||
'Controls',
|
'Controls',
|
||||||
|
@ -50,6 +54,11 @@ export default function ({ getService, getPageObjects }) {
|
||||||
'Vega',
|
'Vega',
|
||||||
'Vertical Bar',
|
'Vertical Bar',
|
||||||
];
|
];
|
||||||
|
if (!isOss) {
|
||||||
|
expectedChartTypes.push('Maps');
|
||||||
|
expectedChartTypes.sort();
|
||||||
|
}
|
||||||
|
log.debug('oss= ' + isOss);
|
||||||
|
|
||||||
// find all the chart types and make sure there all there
|
// find all the chart types and make sure there all there
|
||||||
const chartTypes = await PageObjects.visualize.getChartTypes();
|
const chartTypes = await PageObjects.visualize.getChartTypes();
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import { delay } from 'bluebird';
|
import { delay } from 'bluebird';
|
||||||
import expect from '@kbn/expect';
|
import expect from '@kbn/expect';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
import getUrl from '../../../src/test_utils/get_url';
|
import getUrl from '../../../src/test_utils/get_url';
|
||||||
|
|
||||||
export function CommonPageProvider({ getService, getPageObjects }) {
|
export function CommonPageProvider({ getService, getPageObjects }) {
|
||||||
|
@ -405,6 +405,24 @@ export function CommonPageProvider({ getService, getPageObjects }) {
|
||||||
return await jsonElement.getVisibleText();
|
return await jsonElement.getVisibleText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to detect an OSS licensed Kibana
|
||||||
|
* Useful for functional testing in cloud environment
|
||||||
|
*/
|
||||||
|
async isOss() {
|
||||||
|
const baseUrl = this.getEsHostPort();
|
||||||
|
const username = config.get('servers.elasticsearch.username');
|
||||||
|
const password = config.get('servers.elasticsearch.password');
|
||||||
|
const response = await fetch(baseUrl + '/_xpack', {
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': 'Basic ' + Buffer.from(username + ':' + password).toString('base64')
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return response.status !== 200;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CommonPage();
|
return new CommonPage();
|
||||||
|
|
Loading…
Reference in a new issue