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 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
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ const STANDARD_LIST_TYPES = [
'lens',
'links',
'map',
// cases saved objects
'cases',
'cases-comments',
'cases-user-actions',
'cases-configure',
'cases-connector-mappings',
// synthetics based objects
'synthetics-monitor',
'uptime-dynamic-settings',
Expand Down
1 change: 0 additions & 1 deletion x-pack/test/functional/services/cases/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export function CasesCommonServiceProvider({ getService, getPageObject }: FtrPro
async expectToasterToContain(content: string) {
const toast = await toasts.getToastElement(1);
expect(await toast.getVisibleText()).to.contain(content);
await toasts.dismissAllToasts();
},

async assertCaseModalVisible(expectVisible = true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1154,8 +1154,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/168534
describe.skip('customFields', () => {
describe('customFields', () => {
const customFields = [
{
key: 'valid_key_1',
Expand Down Expand Up @@ -1198,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 @@ -1222,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 @@ -61,6 +61,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const dashboard = getPageObject('dashboard');
const lens = getPageObject('lens');
const listingTable = getService('listingTable');
const toasts = getService('toasts');

const createAttachmentAndNavigate = async (attachment: AttachmentRequest) => {
const caseData = await cases.api.createCase({
Expand Down Expand Up @@ -249,6 +250,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
*/
await cases.create.createCase({ owner });
await cases.common.expectToasterToContain('has been updated');
await toasts.dismissAllToastsWithChecks();
}

const casesCreatedFromFlyout = await findCases({ supertest });
Expand Down Expand Up @@ -325,6 +327,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
await testSubjects.click(`cases-table-row-select-${currentCaseId}`);

await cases.common.expectToasterToContain('has been updated');
await toasts.dismissAllToastsWithChecks();
await ensureFirstCommentOwner(currentCaseId, owner);
}
});
Expand Down Expand Up @@ -387,6 +390,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await cases.common.expectToasterToContain(`${caseTitle} has been updated`);
await testSubjects.click('toaster-content-case-view-link');
await toasts.dismissAllToastsWithChecks();

const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]');
expect(await title.getVisibleText()).toEqual(caseTitle);
Expand Down Expand Up @@ -414,6 +418,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await cases.common.expectToasterToContain(`${theCaseTitle} has been updated`);
await testSubjects.click('toaster-content-case-view-link');
await toasts.dismissAllToastsWithChecks();

const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]');
expect(await title.getVisibleText()).toEqual(theCaseTitle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function SvlCasesApiServiceProvider({ getService }: FtrProviderContext) {

async deleteAllCaseItems() {
await Promise.all([
this.deleteCasesByESQuery(),
this.deleteCases(),
this.deleteCasesUserActions(),
this.deleteComments(),
this.deleteConfiguration(),
Expand All @@ -91,7 +91,7 @@ export function SvlCasesApiServiceProvider({ getService }: FtrProviderContext) {
await kbnServer.savedObjects.clean({ types: ['cases-user-actions'] });
},

async deleteCasesByESQuery(): Promise<void> {
async deleteCases(): Promise<void> {
await kbnServer.savedObjects.clean({ types: ['cases'] });
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default ({ getService }: FtrProviderContext): void => {

describe('get_case', () => {
afterEach(async () => {
await svlCases.api.deleteCasesByESQuery();
await svlCases.api.deleteCases();
});

it('should return a case', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default ({ getService }: FtrProviderContext): void => {

describe('post_case', () => {
afterEach(async () => {
await svlCases.api.deleteCasesByESQuery();
await svlCases.api.deleteCases();
});

it('should create a case', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default ({ getService }: FtrProviderContext): void => {

describe('get_case', () => {
afterEach(async () => {
await svlCases.api.deleteCasesByESQuery();
await svlCases.api.deleteCases();
});

it('should return a case', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default ({ getService }: FtrProviderContext): void => {

describe('post_case', () => {
afterEach(async () => {
await svlCases.api.deleteCasesByESQuery();
await svlCases.api.deleteCases();
});

it('should create a case', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,37 @@ 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');
const toasts = getService('toasts');

// failing test https://github.com/elastic/kibana/issues/166592
describe.skip('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('Cases persistable attachments', function () {
describe('lens visualization', () => {
before(async () => {
await svlCommonPage.login();
await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json'
);

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(
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json'
);

await kibanaServer.savedObjects.cleanStandardList();
await svlCommonPage.forceLogout();
});

Expand All @@ -73,8 +71,8 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
await testSubjects.click('create-case-submit');

await cases.common.expectToasterToContain(`${caseTitle} has been updated`);

await testSubjects.click('toaster-content-case-view-link');
await toasts.dismissAllToastsWithChecks();

if (await testSubjects.exists('appLeaveConfirmModal')) {
await testSubjects.exists('confirmModalConfirmButton');
Expand Down Expand Up @@ -108,6 +106,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await cases.common.expectToasterToContain(`${theCaseTitle} has been updated`);
await testSubjects.click('toaster-content-case-view-link');
await toasts.dismissAllToastsWithChecks();

if (await testSubjects.exists('appLeaveConfirmModal')) {
await testSubjects.exists('confirmModalConfirmButton');
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();
});
};
Loading
Loading