Skip to content

Commit

Permalink
[Cases] Unskip MKI tests (#168924)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
cnasikas and kibanamachine committed Oct 23, 2023
1 parent a8a22c3 commit 2146a7e
Show file tree
Hide file tree
Showing 24 changed files with 149 additions and 110 deletions.
5 changes: 5 additions & 0 deletions packages/kbn-test/src/kbn_client/kbn_client_saved_objects.ts
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
21 changes: 12 additions & 9 deletions x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts
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();

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();

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();
});
};

0 comments on commit 2146a7e

Please sign in to comment.