[Discover] Unskip context navigation test (#68490) (#68985)

This commit is contained in:
Matthias Wilhelm 2020-06-12 14:57:26 +02:00 committed by GitHub
parent 8d654bfbb0
commit cd53b3e5c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 28 deletions

View file

@ -34,49 +34,52 @@ export default function ({ getService, getPageObjects }) {
describe('context link in discover', function contextSize() {
this.tags('smoke');
before(async function () {
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
await Promise.all(
TEST_COLUMN_NAMES.map((columnName) =>
PageObjects.discover.clickFieldListItemAdd(columnName)
)
);
for (const columnName of TEST_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItemAdd(columnName);
}
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItem(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
}
});
after(async () => {
await PageObjects.timePicker.resetDefaultAbsoluteRangeViaUiSettings();
});
it('should open the context view with the selected document as anchor', async function () {
// get the timestamp of the first row
const firstTimestamp = (await docTable.getFields())[0][0];
// navigate to the context view
await docTable.clickRowToggle({ rowIndex: 0 });
await (await docTable.getRowActions({ rowIndex: 0 }))[0].click();
it('should open the context view with the selected document as anchor', async () => {
// check the anchor timestamp in the context view
await retry.try(async () => {
const anchorTimestamp = (await docTable.getFields({ isAnchorRow: true }))[0][0];
expect(anchorTimestamp).to.equal(firstTimestamp);
await retry.waitFor('selected document timestamp matches anchor timestamp ', async () => {
// get the timestamp of the first row
const discoverFields = await docTable.getFields();
const firstTimestamp = discoverFields[0][0];
// navigate to the context view
await docTable.clickRowToggle({ rowIndex: 0 });
const rowActions = await docTable.getRowActions({ rowIndex: 0 });
await rowActions[0].click();
const contextFields = await docTable.getFields({ isAnchorRow: true });
const anchorTimestamp = contextFields[0][0];
return anchorTimestamp === firstTimestamp;
});
});
it('should open the context view with the same columns', async function () {
it('should open the context view with the same columns', async () => {
const columnNames = await docTable.getHeaderFields();
expect(columnNames).to.eql(['Time', ...TEST_COLUMN_NAMES]);
});
it('should open the context view with the filters disabled', async function () {
const hasDisabledFilters = (
await Promise.all(
TEST_FILTER_COLUMN_NAMES.map(([columnName, value]) =>
filterBar.hasFilter(columnName, value, false)
)
)
).reduce((result, hasDisabledFilter) => result && hasDisabledFilter, true);
expect(hasDisabledFilters).to.be(true);
it('should open the context view with the filters disabled', async () => {
let disabledFilterCounter = 0;
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
if (await filterBar.hasFilter(columnName, value, false)) {
disabledFilterCounter++;
}
}
expect(disabledFilterCounter).to.be(TEST_FILTER_COLUMN_NAMES.length);
});
});
}

View file

@ -26,8 +26,22 @@ export function TimePickerPageProvider({ getService, getPageObjects }) {
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['header', 'common']);
const kibanaServer = getService('kibanaServer');
class TimePickerPage {
/**
* the provides a quicker way to set the timepicker to the default range, saves a few seconds
*/
async setDefaultAbsoluteRangeViaUiSettings() {
await kibanaServer.uiSettings.update({
'timepicker:timeDefaults': `{ "from": "2015-09-18T06:31:44.000Z", "to": "2015-09-23T18:31:44.000Z"}`,
});
}
async resetDefaultAbsoluteRangeViaUiSettings() {
await kibanaServer.uiSettings.replace({});
}
async timePickerExists() {
return await testSubjects.exists('superDatePickerToggleQuickMenuButton');
}