Skip to content

Commit

Permalink
Improve functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Apr 8, 2020
1 parent ae6f267 commit cf974a9
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,32 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function({ getService, getPageObjects }) {
export default function({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common', 'timePicker', 'discover']);
const kibanaServer = getService('kibanaServer');

describe('indexpattern without timefield', function() {
before(async function() {
await esArchiver.loadIfNeeded('index_pattern_without_timefield');
await kibanaServer.uiSettings.replace({ defaultIndex: 'without-timefield' });
});

beforeEach(async function() {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.selectIndexPattern('without-timefield');
});

after(async function unloadMakelogs() {
await esArchiver.unload('index_pattern_without_timefield');
});

it('should not display a timepicker', async function() {
await PageObjects.common.navigateToApp('discover');
const timepickerExists = await PageObjects.timePicker.timePickerExists();
expect(timepickerExists).to.be(false);
});

it('should display a timepicker after switching to an index pattern with timefield', async function() {
await PageObjects.common.navigateToApp('discover');
expect(await PageObjects.timePicker.timePickerExists()).to.be(false);
await PageObjects.discover.selectIndexPattern('with-timefield');
expect(await PageObjects.timePicker.timePickerExists()).to.be(true);
Expand Down

0 comments on commit cf974a9

Please sign in to comment.