ES6 conversion on Management Tests (#19870)

This commit is contained in:
Rashmi Kulkarni 2018-06-15 12:52:42 -07:00
parent ec15213b97
commit bffe876587
4 changed files with 84 additions and 120 deletions

View file

@ -24,15 +24,12 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['settings', 'common']);
describe('"Create Index Pattern" wizard', function () {
beforeEach(function () {
before(async function () {
// delete .kibana index and then wait for Kibana to re-create it
return kibanaServer.uiSettings.replace({})
.then(function () {
return PageObjects.settings.navigateTo();
})
.then(function () {
return PageObjects.settings.clickKibanaIndices();
});
await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndices();
});
describe('step 1 next button', function () {

View file

@ -25,30 +25,26 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['settings']);
describe('index pattern filter', function describeIndexTests() {
before(function () {
before(async function () {
// delete .kibana index and then wait for Kibana to re-create it
return kibanaServer.uiSettings.replace({})
.then(function () {
return PageObjects.settings.navigateTo();
})
.then(function () {
return PageObjects.settings.clickKibanaIndices();
});
await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndices();
});
beforeEach(function () {
return PageObjects.settings.createIndexPattern();
beforeEach(async function () {
await PageObjects.settings.createIndexPattern();
});
afterEach(function () {
return PageObjects.settings.removeIndexPattern();
afterEach(async function () {
await PageObjects.settings.removeIndexPattern();
});
it('should filter indexed fields', async function () {
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndices();
await PageObjects.settings.getFieldTypes();
await PageObjects.settings.setFieldTypeFilter('string');
await retry.try(async function () {

View file

@ -25,62 +25,52 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['settings', 'common']);
describe('index result popularity', function describeIndexTests() {
before(function () {
const fieldName = 'geo.coordinates';
before(async function () {
// delete .kibana index and then wait for Kibana to re-create it
return kibanaServer.uiSettings.replace({})
.then(function () {
return PageObjects.settings.navigateTo();
});
await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
});
beforeEach(function be() {
return PageObjects.settings.createIndexPattern();
beforeEach(async () => {
await PageObjects.settings.createIndexPattern();
// increase Popularity of geo.coordinates
log.debug('Starting openControlsByName (' + fieldName + ')');
await PageObjects.settings.openControlsByName(fieldName);
log.debug('increasePopularity');
await PageObjects.settings.increasePopularity();
});
afterEach(function ae() {
return PageObjects.settings.removeIndexPattern();
afterEach(async () => {
await PageObjects.settings.controlChangeCancel();
await PageObjects.settings.removeIndexPattern();
// Cancel saving the popularity change (we didn't make a change in this case, just checking the value)
});
describe('change popularity', function indexPatternCreation() {
const fieldName = 'geo.coordinates';
it('should update the popularity input', async function () {
const popularity = await PageObjects.settings.getPopularity();
log.debug('popularity = ' + popularity);
expect(popularity).to.be('1');
});
beforeEach(async function () {
// increase Popularity of geo.coordinates
log.debug('Starting openControlsByName (' + fieldName + ')');
await PageObjects.settings.openControlsByName(fieldName);
log.debug('increasePopularity');
await PageObjects.settings.increasePopularity();
});
it('should be reset on cancel', async function () {
// Cancel saving the popularity change
await PageObjects.settings.controlChangeCancel();
await PageObjects.settings.openControlsByName(fieldName);
// check that it is 0 (previous increase was cancelled
const popularity = await PageObjects.settings.getPopularity();
log.debug('popularity = ' + popularity);
expect(popularity).to.be('0');
});
afterEach(async function () {
// Cancel saving the popularity change (we didn't make a change in this case, just checking the value)
await PageObjects.settings.controlChangeCancel();
});
it('should update the popularity input', async function () {
const popularity = await PageObjects.settings.getPopularity();
log.debug('popularity = ' + popularity);
expect(popularity).to.be('1');
});
it('should be reset on cancel', async function () {
// Cancel saving the popularity change
await PageObjects.settings.controlChangeCancel();
await PageObjects.settings.openControlsByName(fieldName);
// check that it is 0 (previous increase was cancelled
const popularity = await PageObjects.settings.getPopularity();
log.debug('popularity = ' + popularity);
expect(popularity).to.be('0');
});
it('can be saved', async function () {
// Saving the popularity change
await PageObjects.settings.controlChangeSave();
await PageObjects.settings.openControlsByName(fieldName);
const popularity = await PageObjects.settings.getPopularity();
log.debug('popularity = ' + popularity);
expect(popularity).to.be('1');
});
}); // end 'change popularity'
}); // end index result popularity
it('can be saved', async function () {
// Saving the popularity change
await PageObjects.settings.controlChangeSave();
await PageObjects.settings.openControlsByName(fieldName);
const popularity = await PageObjects.settings.getPopularity();
log.debug('popularity = ' + popularity);
expect(popularity).to.be('1');
});
}); // end 'change popularity'
}

View file

@ -25,89 +25,70 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['settings', 'common']);
describe('index result field sort', function describeIndexTests() {
before(function () {
before(async function () {
// delete .kibana index and then wait for Kibana to re-create it
return kibanaServer.uiSettings.replace({});
await kibanaServer.uiSettings.replace({});
});
const columns = [{
heading: 'Name',
first: '@message',
last: 'xss.raw',
selector: function () {
return PageObjects.settings.getTableRow(0, 0).getVisibleText();
selector: async function () {
return await PageObjects.settings.getTableRow(0, 0).getVisibleText();
}
}, {
heading: 'Type',
first: '_source',
last: 'string',
selector: function () {
return PageObjects.settings.getTableRow(0, 1).getVisibleText();
selector: async function () {
return await PageObjects.settings.getTableRow(0, 1).getVisibleText();
}
}];
columns.forEach(function (col) {
describe('sort by heading - ' + col.heading, function indexPatternCreation() {
before(function () {
return PageObjects.settings.navigateTo()
.then(function () {
return PageObjects.settings.clickKibanaIndices();
});
before(async function () {
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndices();
await PageObjects.settings.createIndexPattern();
});
beforeEach(function () {
return PageObjects.settings.createIndexPattern();
after(async function () {
return await PageObjects.settings.removeIndexPattern();
});
afterEach(function () {
return PageObjects.settings.removeIndexPattern();
it('should sort ascending', async function () {
await PageObjects.settings.sortBy(col.heading);
const rowText = await col.selector();
expect(rowText).to.be(col.first);
});
it('should sort ascending', function () {
return PageObjects.settings.sortBy(col.heading)
.then(function getText() {
return col.selector();
})
.then(function (rowText) {
expect(rowText).to.be(col.first);
});
});
it('should sort descending', function () {
return PageObjects.settings.sortBy(col.heading)
.then(function sortAgain() {
return PageObjects.settings.sortBy(col.heading);
})
.then(function getText() {
return col.selector();
})
.then(function (rowText) {
expect(rowText).to.be(col.last);
});
it('should sort descending', async function () {
await PageObjects.settings.sortBy(col.heading);
const getText = await col.selector();
expect(getText).to.be(col.last);
});
});
});
describe('field list pagination', function () {
const EXPECTED_FIELD_COUNT = 86;
before(function () {
return PageObjects.settings.navigateTo()
.then(function () {
return PageObjects.settings.createIndexPattern();
});
before(async function () {
await PageObjects.settings.navigateTo();
await PageObjects.settings.createIndexPattern();
});
after(function () {
return PageObjects.settings.removeIndexPattern();
after(async function () {
return await PageObjects.settings.removeIndexPattern();
});
it('makelogs data should have expected number of fields', function () {
return retry.try(function () {
return PageObjects.settings.getFieldsTabCount()
.then(function (tabCount) {
expect(tabCount).to.be('' + EXPECTED_FIELD_COUNT);
});
it('makelogs data should have expected number of fields', async function () {
await retry.try(async function () {
const TabCount = await PageObjects.settings.getFieldsTabCount();
expect(TabCount).to.be('' + EXPECTED_FIELD_COUNT);
});
});
}); // end describe pagination