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

[Cases] Unskip MKI tests #168924

Merged
merged 19 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1197,13 +1197,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});

it('updates a custom field correctly', async () => {
const summary = await testSubjects.find(`case-text-custom-field-${customFields[0].key}`);
expect(await summary.getVisibleText()).equal('this is a text field value');
const textField = await testSubjects.find(`case-text-custom-field-${customFields[0].key}`);
expect(await textField.getVisibleText()).equal('this is a text field value');

const sync = await testSubjects.find(
const toggle = await testSubjects.find(
`case-toggle-custom-field-form-field-${customFields[1].key}`
);
expect(await sync.getAttribute('aria-checked')).equal('true');
expect(await toggle.getAttribute('aria-checked')).equal('true');

await testSubjects.click(`case-text-custom-field-edit-button-${customFields[0].key}`);

Expand All @@ -1221,19 +1221,23 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await testSubjects.click(`case-text-custom-field-submit-button-${customFields[0].key}`);

await header.waitUntilLoadingHasFinished();

await retry.waitFor('update toast exist', async () => {
return await testSubjects.exists('toastCloseButton');
});

await testSubjects.click('toastCloseButton');

await sync.click();
await header.waitUntilLoadingHasFinished();
Copy link
Member Author

Choose a reason for hiding this comment

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

We need to wait here for the case to be refreshed. Otherwise we get an 403 conflict error because the test is too fast.


await toggle.click();

await header.waitUntilLoadingHasFinished();

expect(await summary.getVisibleText()).equal('this is a text field value edited!!');
expect(await textField.getVisibleText()).equal('this is a text field value edited!!');

expect(await sync.getAttribute('aria-checked')).equal('false');
expect(await toggle.getAttribute('aria-checked')).equal('false');

// validate user action
const userActions = await find.allByCssSelector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const cases = getService('cases');
const svlCases = getService('svlCases');
const find = getService('find');

describe('Cases persistable attachments', function () {
// security_exception: action [indices:data/write/delete/byquery] is unauthorized for user [elastic] with effective roles [superuser] on restricted indices [.kibana_alerting_cases], this action is granted by the index privileges [delete,write,all]
this.tags(['failsOnMKI']);
describe('lens visualization', () => {
before(async () => {
await svlCommonPage.login();
Expand All @@ -32,18 +31,15 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
);

await svlObltNavigation.navigateToLandingPage();

await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'dashboards' });

await dashboard.clickNewDashboard();

await lens.createAndAddLensFromDashboard({});

await dashboard.waitForRenderComplete();
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed to avoid permission errors when deleting directly a document from the .kibana_alerting_cases system index.


await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.importExport.unload(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const svlObltNavigation = getService('svlObltNavigation');
const testSubjects = getService('testSubjects');
const cases = getService('cases');
const svlCases = getService('svlCases');
const toasts = getService('toasts');
const retry = getService('retry');
const find = getService('find');

describe('Configure Case', function () {
// security_exception: action [indices:data/write/delete/byquery] is unauthorized for user [elastic] with effective roles [superuser] on restricted indices [.kibana_alerting_cases], this action is granted by the index privileges [delete,write,all]
this.tags(['failsOnMKI']);
before(async () => {
await svlCommonPage.login();
await svlObltNavigation.navigateToLandingPage();
Expand All @@ -42,7 +41,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
await svlCommonPage.forceLogout();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ const owner = OBSERVABILITY_OWNER;

export default ({ getService, getPageObject }: FtrProviderContext) => {
describe('Create Case', function () {
// security_exception: action [indices:data/write/delete/byquery] is unauthorized for user [elastic] with effective roles [superuser] on restricted indices [.kibana_alerting_cases], this action is granted by the index privileges [delete,write,all]
this.tags(['failsOnMKI']);
const find = getService('find');
const cases = getService('cases');
const svlCases = getService('svlCases');
const testSubjects = getService('testSubjects');
const svlCommonPage = getPageObject('svlCommonPage');
const config = getService('config');
Expand All @@ -35,7 +34,7 @@ export default ({ getService, getPageObject }: FtrProviderContext) => {
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
await svlCommonPage.forceLogout();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('Serverless Observability Cases', function () {
loadTestFile(require.resolve('./attachment_framework'));
loadTestFile(require.resolve('./view_case'));
loadTestFile(require.resolve('./configure'));
loadTestFile(require.resolve('./create_case_form'));
loadTestFile(require.resolve('./list_view'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const header = getPageObject('header');
const testSubjects = getService('testSubjects');
const cases = getService('cases');
const svlCases = getService('svlCases');
const svlCommonNavigation = getPageObject('svlCommonNavigation');
const svlCommonPage = getPageObject('svlCommonPage');
const svlObltNavigation = getService('svlObltNavigation');

describe('Cases list', function () {
// multiple errors in after hook due to delete permission
this.tags(['failsOnMKI']);
before(async () => {
await svlCommonPage.login();
await svlObltNavigation.navigateToLandingPage();
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-overview:cases' });
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
await cases.casesTable.waitForCasesToBeDeleted();
await svlCommonPage.forceLogout();
});
Expand Down Expand Up @@ -107,7 +106,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});

afterEach(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
await cases.casesTable.waitForCasesToBeDeleted();
});

Expand Down Expand Up @@ -170,7 +169,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
await cases.casesTable.waitForCasesToBeDeleted();
});

Expand Down Expand Up @@ -274,6 +273,7 @@ const createNCasesBeforeDeleteAllAfter = (
getService: FtrProviderContext['getService']
) => {
const cases = getService('cases');
const svlCases = getService('svlCases');
const header = getPageObject('header');

before(async () => {
Expand All @@ -283,7 +283,7 @@ const createNCasesBeforeDeleteAllAfter = (
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
await cases.casesTable.waitForCasesToBeDeleted();
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const header = getPageObject('header');
const testSubjects = getService('testSubjects');
const cases = getService('cases');
const svlCases = getService('svlCases');
const find = getService('find');

const retry = getService('retry');
Expand All @@ -34,14 +35,12 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const svlCommonPage = getPageObject('svlCommonPage');

describe('Case View', function () {
// security_exception: action [indices:data/write/delete/byquery] is unauthorized for user [elastic] with effective roles [superuser] on restricted indices [.kibana_alerting_cases], this action is granted by the index privileges [delete,write,all]
this.tags(['failsOnMKI']);
before(async () => {
await svlCommonPage.login();
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
await svlCommonPage.forceLogout();
});

Expand Down Expand Up @@ -280,7 +279,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

after(async () => {
await cases.testResources.removeKibanaSampleData('logs');
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
});

it('adds lens visualization in description', async () => {
Expand Down Expand Up @@ -325,7 +324,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
});

it('initially renders user actions list correctly', async () => {
Expand Down Expand Up @@ -437,7 +436,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
});

it('should set the cases title', async () => {
Expand Down Expand Up @@ -498,17 +497,17 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});

afterEach(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
});

it('updates a custom field correctly', async () => {
const summary = await testSubjects.find(`case-text-custom-field-${customFields[0].key}`);
expect(await summary.getVisibleText()).equal('this is a text field value');
const textField = await testSubjects.find(`case-text-custom-field-${customFields[0].key}`);
expect(await textField.getVisibleText()).equal('this is a text field value');

const sync = await testSubjects.find(
const toggle = await testSubjects.find(
`case-toggle-custom-field-form-field-${customFields[1].key}`
);
expect(await sync.getAttribute('aria-checked')).equal('true');
expect(await toggle.getAttribute('aria-checked')).equal('true');

await testSubjects.click(`case-text-custom-field-edit-button-${customFields[0].key}`);

Expand All @@ -526,19 +525,23 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await testSubjects.click(`case-text-custom-field-submit-button-${customFields[0].key}`);

await header.waitUntilLoadingHasFinished();

await retry.waitFor('update toast exist', async () => {
return await testSubjects.exists('toastCloseButton');
});

await testSubjects.click('toastCloseButton');

await sync.click();
await header.waitUntilLoadingHasFinished();

await toggle.click();

await header.waitUntilLoadingHasFinished();

expect(await summary.getVisibleText()).equal('this is a text field value edited!!');
expect(await textField.getVisibleText()).equal('this is a text field value edited!!');

expect(await sync.getAttribute('aria-checked')).equal('false');
expect(await toggle.getAttribute('aria-checked')).equal('false');

// validate user action
const userActions = await find.allByCssSelector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('serverless observability UI', function () {
loadTestFile(require.resolve('./landing_page'));
loadTestFile(require.resolve('./navigation'));
loadTestFile(require.resolve('./observability_log_explorer'));
loadTestFile(require.resolve('./cases/attachment_framework'));
loadTestFile(require.resolve('./rules/rules_list'));
loadTestFile(require.resolve('./cases/view_case'));
loadTestFile(require.resolve('./cases/configure'));
loadTestFile(require.resolve('./cases/create_case_form'));
loadTestFile(require.resolve('./cases/list_view'));
loadTestFile(require.resolve('./advanced_settings'));
loadTestFile(require.resolve('./infra'));
loadTestFile(require.resolve('./ml'));
// loadTestFile(require.resolve('./landing_page'));
// loadTestFile(require.resolve('./navigation'));
// loadTestFile(require.resolve('./observability_log_explorer'));
// loadTestFile(require.resolve('./rules/rules_list'));
loadTestFile(require.resolve('./cases'));
// loadTestFile(require.resolve('./advanced_settings'));
// loadTestFile(require.resolve('./infra'));
// loadTestFile(require.resolve('./ml'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,28 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const dashboard = getPageObject('dashboard');
const lens = getPageObject('lens');
const svlSecNavigation = getService('svlSecNavigation');
const svlCommonPage = getPageObject('svlCommonPage');
const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const cases = getService('cases');
const svlCases = getService('svlCases');
const find = getService('find');

// Failing
// Issue: https://github.com/elastic/kibana/issues/165135
describe.skip('Cases persistable attachments', () => {
describe('Cases persistable attachments', () => {
describe('lens visualization', () => {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/dashboard/feature_controls/security/security.json'
);

await svlCommonPage.login();
await svlSecNavigation.navigateToLandingPage();

await testSubjects.click('solutionSideNavItemLink-dashboards');

await testSubjects.click('createDashboardButton');

await lens.createAndAddLensFromDashboard({});

await dashboard.waitForRenderComplete();
});

after(async () => {
await cases.api.deleteAllCases();

await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json'
);
await svlCases.api.deleteAllCaseItems();
await svlCommonPage.forceLogout();
});

it('adds lens visualization to a new case', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const svlSecNavigation = getService('svlSecNavigation');
const testSubjects = getService('testSubjects');
const cases = getService('cases');
const svlCases = getService('svlCases');
const toasts = getService('toasts');
const retry = getService('retry');
const find = getService('find');

describe('Configure Case', function () {
// security_exception: action [indices:data/write/delete/byquery] is unauthorized for user [elastic] with effective roles [superuser] on restricted indices [.kibana_alerting_cases], this action is granted by the index privileges [delete,write,all]
this.tags(['failsOnMKI']);
before(async () => {
await svlCommonPage.login();
await svlSecNavigation.navigateToLandingPage();
Expand All @@ -41,7 +40,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});

after(async () => {
await cases.api.deleteAllCases();
await svlCases.api.deleteAllCaseItems();
await svlCommonPage.forceLogout();
});

Expand Down