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

Fix search session filter functional test #193812

Merged
Merged
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
33 changes: 25 additions & 8 deletions test/plugin_functional/test_suites/data_plugin/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,33 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
const toasts = getService('toasts');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');
const browser = getService('browser');

const getSessionIds = async () => {
const sessionsBtn = await testSubjects.find('showSessionsButton');
await sessionsBtn.click();
const toast = await toasts.getElementByIndex(1);
const sessionIds = await toast.getVisibleText();
await toasts.dismissAll();
return sessionIds.split(',');
};

// Failing: See https://github.com/elastic/kibana/issues/192510
// Failing: See https://github.com/elastic/kibana/issues/192510
describe.skip('Session management', function describeSessionManagementTests() {
const clearSessionIds = async () => {
await testSubjects.click('clearSessionsButton');
await toasts.dismissAll();
};

describe('Session management', function describeSessionManagementTests() {
describe('Discover', () => {
before(async () => {
await common.navigateToApp('discover');
await testSubjects.click('clearSessionsButton');
await clearSessionIds();
await header.waitUntilLoadingHasFinished();
});

afterEach(async () => {
await testSubjects.click('clearSessionsButton');
await toasts.dismissAll();
await clearSessionIds();
});

it('Starts on index pattern select', async () => {
Expand Down Expand Up @@ -93,8 +98,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
});

afterEach(async () => {
await testSubjects.click('clearSessionsButton');
await toasts.dismissAll();
await clearSessionIds();
});

after(async () => {
Expand All @@ -115,6 +119,19 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
});

it('starts a session on filter change', async () => {
// For some reason, when loading the dashboard, sometimes the filter doesn't show up, so we
// refresh until it shows up
Comment on lines +122 to +123
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm it sounds like this may be catching an actual issue in Dashboard. I wonder if anyone from @elastic/kibana-presentation has an idea of why this started failing a couple of weeks ago?

Copy link
Contributor

Choose a reason for hiding this comment

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

Created #194307 to track

Copy link
Contributor

Choose a reason for hiding this comment

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

Great, thanks. Created a followup issue on our end to revert this change once the Dashboard issue is resolved: #194331.

await retry.try(
async () => {
const hasFilter = await filterBar.hasFilter('animal', 'dog');
if (!hasFilter) throw new Error('filter not found');
},
async () => {
await browser.refresh();
await header.waitUntilLoadingHasFinished();
await clearSessionIds();
}
);
await filterBar.removeFilter('animal');
const sessionIds = await getSessionIds();
expect(sessionIds.length).to.be(1);
Expand Down