Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Unskip context navigation test #68490

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 33 additions & 31 deletions test/functional/apps/context/_discover_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,52 +31,54 @@ export default function ({ getService, getPageObjects }) {
const filterBar = getService('filterBar');
const PageObjects = getPageObjects(['common', 'discover', 'timePicker']);

// FLAKY: https://github.com/elastic/kibana/issues/53308
describe.skip('context link in discover', function contextSize() {
before(async function () {
describe('context link in discover', () => {
before(async () => {
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);
});
});
}
16 changes: 16 additions & 0 deletions test/functional/page_objects/time_picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function TimePickerProvider({ getService, getPageObjects }: FtrProviderCo
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const { header, common } = getPageObjects(['header', 'common']);
const kibanaServer = getService('kibanaServer');

type CommonlyUsed =
| 'Today'
Expand All @@ -44,11 +45,26 @@ export function TimePickerProvider({ getService, getPageObjects }: FtrProviderCo
class TimePicker {
defaultStartTime = 'Sep 19, 2015 @ 06:31:44.000';
defaultEndTime = 'Sep 23, 2015 @ 18:31:44.000';
defaultStartTimeUTC = '2015-09-18T06:31:44.000Z';
defaultEndTimeUTC = '2015-09-23T18:31:44.000Z';

async setDefaultAbsoluteRange() {
await this.setAbsoluteRange(this.defaultStartTime, this.defaultEndTime);
}

/**
* the provides a quicker way to set the timepicker to the default range, saves a few seconds
*/
async setDefaultAbsoluteRangeViaUiSettings() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should speed go the before section of the test, since there is no interaction necessary to set the time range, however it seems it can't be measured in the jenkins stats of a single test run.

await kibanaServer.uiSettings.update({
'timepicker:timeDefaults': `{ "from": "${this.defaultStartTimeUTC}", "to": "${this.defaultEndTimeUTC}"}`,
});
}

async resetDefaultAbsoluteRangeViaUiSettings() {
await kibanaServer.uiSettings.replace({});
}

private async getTimePickerPanel() {
return await find.byCssSelector('div.euiPopover__panel-isOpen');
}
Expand Down