diff --git a/test/functional/apps/visualize/group3/_annotation_listing.ts b/test/functional/apps/visualize/group3/_annotation_listing.ts index cdb0cb615be47..5d33f714159f0 100644 --- a/test/functional/apps/visualize/group3/_annotation_listing.ts +++ b/test/functional/apps/visualize/group3/_annotation_listing.ts @@ -13,6 +13,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['visualize', 'annotationEditor']); const listingTable = getService('listingTable'); const kibanaServer = getService('kibanaServer'); + const testSubjects = getService('testSubjects'); const find = getService('find'); const retry = getService('retry'); const log = getService('log'); @@ -32,6 +33,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.gotoVisualizationLandingPage(); await PageObjects.visualize.selectAnnotationsTab(); + await listingTable.waitUntilTableIsLoaded(); }); after(async function () { @@ -156,7 +158,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - describe.skip('data view switching', () => { + describe('data view switching', () => { it('recovers from missing data view', async () => { await listingTable.clickItemLink('eventAnnotation', 'missing data view'); @@ -175,7 +177,36 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.annotationEditor.saveGroup(); }); - it('recovers from missing field in data view', () => {}); + it('recovers from missing field in data view', async () => { + const assertShowingMissingFieldError = async (yes: boolean) => { + const [failureExists, canvasExists] = await Promise.all([ + testSubjects.exists('embeddable-lens-failure'), + find.existsByCssSelector('canvas', 1000), + ]); + expect(failureExists).to.be(yes); + expect(canvasExists).to.be(!yes); + }; + + await listingTable.clickItemLink('eventAnnotation', 'Group with additional fields'); + + await assertShowingMissingFieldError(false); + + await retry.try(async () => { + await PageObjects.annotationEditor.editGroupMetadata({ + dataView: 'Data view without fields', + }); + + await assertShowingMissingFieldError(true); + }); + + await retry.try(async () => { + await PageObjects.annotationEditor.editGroupMetadata({ + dataView: 'logs*', + }); + + await assertShowingMissingFieldError(false); + }); + }); }); }); }); diff --git a/test/functional/fixtures/kbn_archiver/annotation_listing_page_search.json b/test/functional/fixtures/kbn_archiver/annotation_listing_page_search.json index 34f4fb8ed1b48..a54a042effb6e 100644 --- a/test/functional/fixtures/kbn_archiver/annotation_listing_page_search.json +++ b/test/functional/fixtures/kbn_archiver/annotation_listing_page_search.json @@ -21,6 +21,29 @@ "version": "WzIyNywxXQ==" } +{ + "attributes": { + "fieldAttrs": "{}", + "fieldFormatMap": "{}", + "fields": "[]", + "name": "Data view without fields", + "runtimeFieldMap": "{}", + "sourceFilters": "[]", + "timeFieldName": "timestamp", + "title": "kibana_sample_data_logs", + "typeMeta": "{}" + }, + "coreMigrationVersion": "8.8.0", + "created_at": "2023-09-07T17:23:20.906Z", + "id": "data-view-without-fields", + "managed": false, + "references": [], + "type": "index-pattern", + "typeMigrationVersion": "8.0.0", + "updated_at": "2023-09-11T15:50:59.227Z", + "version": "WzIyNywxXQ==" +} + { "attributes": { "fieldAttrs": "{}", @@ -44,6 +67,44 @@ "version": "WzIyNywxXQ==" } +{ + "attributes": { + "annotations": [ + { + "extraFields": [ + "@message.raw" + ], + "icon": "triangle", + "id": "3d28ce7e-fc5e-409b-aea3-4d9e15010843", + "key": { + "type": "point_in_time" + }, + "label": "Event", + "timeField": "@timestamp", + "type": "query" + } + ], + "dataViewSpec": null, + "description": "", + "ignoreGlobalFilters": true, + "title": "Group with additional fields" + }, + "coreMigrationVersion": "8.8.0", + "created_at": "2023-10-06T17:15:58.790Z", + "id": "12371e00-5174-11ee-a5c4-7dce2e3293a7", + "managed": false, + "references": [ + { + "id": "90943e30-9a47-11e8-b64d-95841ca0b247", + "name": "event-annotation-group_dataView-ref-90943e30-9a47-11e8-b64d-95841ca0b247", + "type": "index-pattern" + } + ], + "type": "event-annotation-group", + "updated_at": "2023-10-06T17:17:05.384Z", + "version": "WzE4MywxXQ==" +} + { "attributes": { "annotations": [