kibana/x-pack/test/functional_cors/tests/cors.ts
Mikhail Shustov f125b0feb2
align cors settings names with elasticsearch (#85738) (#85768)
* align cors settings names with elasticsearch

* server.cors.origin: * --> server.cors.origin: ["*"]
2020-12-14 18:30:58 +01:00

30 lines
1.1 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const config = getService('config');
const find = getService('find');
describe('CORS', () => {
it('Communicates to Kibana with configured CORS', async () => {
const args: string[] = config.get('kbnTestServer.serverArgs');
const originSetting = args.find((str) => str.includes('server.cors.allowOrigin'));
if (!originSetting) {
throw new Error('Cannot find "server.cors.allowOrigin" argument');
}
const [, value] = originSetting.split('=');
const url = JSON.parse(value);
await browser.navigateTo(url[0]);
const element = await find.byCssSelector('p');
expect(await element.getVisibleText()).to.be('content from kibana');
});
});
}