[7.7] Improve indexpattern without timefield functional test (#67031) (#67267)

This commit is contained in:
Matthias Wilhelm 2020-06-04 10:59:02 +02:00 committed by GitHub
parent 6c50113be0
commit ae69f51446
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,36 +17,36 @@
* under the License.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'timePicker', 'discover']);
describe('indexpattern without timefield', function () {
before(async function () {
describe('indexpattern without timefield', () => {
before(async () => {
await esArchiver.loadIfNeeded('index_pattern_without_timefield');
});
beforeEach(async function () {
await kibanaServer.uiSettings.replace({ defaultIndex: 'without-timefield' });
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.selectIndexPattern('without-timefield');
});
after(async function unloadMakelogs() {
after(async () => {
await esArchiver.unload('index_pattern_without_timefield');
await kibanaServer.uiSettings.unset('defaultIndex');
});
it('should not display a timepicker', async function () {
const timepickerExists = await PageObjects.timePicker.timePickerExists();
expect(timepickerExists).to.be(false);
it('should not display a timepicker', async () => {
if (await PageObjects.timePicker.timePickerExists()) {
throw new Error('Expected timepicker not to exist');
}
});
it('should display a timepicker after switching to an index pattern with timefield', async function () {
expect(await PageObjects.timePicker.timePickerExists()).to.be(false);
it('should display a timepicker after switching to an index pattern with timefield', async () => {
await PageObjects.discover.selectIndexPattern('with-timefield');
expect(await PageObjects.timePicker.timePickerExists()).to.be(true);
if (!(await PageObjects.timePicker.timePickerExists())) {
throw new Error('Expected timepicker to exist');
}
});
});
}