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

[8.16] Fix search session filter functional test (#193812) #197503

Merged
merged 2 commits into from
Oct 28, 2024
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
32 changes: 25 additions & 7 deletions test/plugin_functional/test_suites/data_plugin/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +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
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 @@ -92,8 +98,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
});

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

after(async () => {
Expand All @@ -114,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
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