From d1c22301c7c5d0e56aeafc4f406bb03a4c767ceb Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Wed, 15 Jun 2022 10:26:45 +0100 Subject: [PATCH 1/6] [Archive Migration] x-pack/test/functional/es_archives/spaces/selector --- .../functional/apps/spaces/spaces_selection.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/x-pack/test/functional/apps/spaces/spaces_selection.ts b/x-pack/test/functional/apps/spaces/spaces_selection.ts index 5a8e852ffb11c..b394281db2e78 100644 --- a/x-pack/test/functional/apps/spaces/spaces_selection.ts +++ b/x-pack/test/functional/apps/spaces/spaces_selection.ts @@ -21,14 +21,21 @@ export default function spaceSelectorFunctionalTests({ 'security', 'spaceSelector', ]); + const spacesService = getService('spaces'); describe('Spaces', function () { before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/spaces/selector'); + // await esArchiver.load('x-pack/test/functional/es_archives/spaces/selector'); + await spacesService.create({ + id: 'another-space', + name: 'Another Space', + disabledFeatures: [], + }); + }); + after(async () => { + // await esArchiver.unload('x-pack/test/functional/es_archives/spaces/selector') + await spacesService.delete('another-space'); }); - after( - async () => await esArchiver.unload('x-pack/test/functional/es_archives/spaces/selector') - ); this.tags('includeFirefox'); describe('Space Selector', () => { @@ -41,7 +48,7 @@ export default function spaceSelectorFunctionalTests({ await PageObjects.security.forceLogout(); }); - it('allows user to navigate to different spaces', async () => { + it.only('allows user to navigate to different spaces', async () => { const spaceId = 'another-space'; await PageObjects.security.login(undefined, undefined, { From d7137704b65b3bb4d36e6e8fa23e882423ef02a3 Mon Sep 17 00:00:00 2001 From: rashmikulkarni Date: Thu, 23 Jun 2022 08:57:56 -0700 Subject: [PATCH 2/6] migrations space selector --- .../apps/spaces/spaces_selection.ts | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/spaces/spaces_selection.ts b/x-pack/test/functional/apps/spaces/spaces_selection.ts index b394281db2e78..a0807b758c38d 100644 --- a/x-pack/test/functional/apps/spaces/spaces_selection.ts +++ b/x-pack/test/functional/apps/spaces/spaces_selection.ts @@ -31,10 +31,72 @@ export default function spaceSelectorFunctionalTests({ name: 'Another Space', disabledFeatures: [], }); + await spacesService.create({ + id: 'space-1', + name: 'Space 1', + disabledFeatures: [], + }); + + await spacesService.create({ + id: 'space-2', + name: 'Space 2', + disabledFeatures: [], + }); + + await spacesService.create({ + id: 'space-3', + name: 'Space 3', + disabledFeatures: [], + }); + + await spacesService.create({ + id: 'space-4', + name: 'Space 4', + disabledFeatures: [], + }); + + await spacesService.create({ + id: 'space-5', + name: 'Space 5', + disabledFeatures: [], + }); + + await spacesService.create({ + id: 'space-6', + name: 'Space 6', + disabledFeatures: [], + }); + + await spacesService.create({ + id: 'space-7', + name: 'Space 7', + disabledFeatures: [], + }); + + await spacesService.create({ + id: 'space-8', + name: 'Space 8', + disabledFeatures: [], + }); + + await spacesService.create({ + id: 'space-9', + name: 'Space 9', + disabledFeatures: [], + }); }); after(async () => { // await esArchiver.unload('x-pack/test/functional/es_archives/spaces/selector') await spacesService.delete('another-space'); + await spacesService.delete('space-1'); + await spacesService.delete('space-2'); + await spacesService.delete('space-3'); + await spacesService.delete('space-4'); + await spacesService.delete('space-5'); + await spacesService.delete('space-6'); + await spacesService.delete('space-7'); + await spacesService.delete('space-8'); + await spacesService.delete('space-9'); }); this.tags('includeFirefox'); @@ -48,7 +110,7 @@ export default function spaceSelectorFunctionalTests({ await PageObjects.security.forceLogout(); }); - it.only('allows user to navigate to different spaces', async () => { + it('allows user to navigate to different spaces', async () => { const spaceId = 'another-space'; await PageObjects.security.login(undefined, undefined, { From c875b7eb40b56d1c1c0b20b1101026b9f9109584 Mon Sep 17 00:00:00 2001 From: rashmikulkarni Date: Thu, 23 Jun 2022 11:51:23 -0700 Subject: [PATCH 3/6] removed unused esarchiver declaration --- x-pack/test/functional/apps/spaces/spaces_selection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/spaces/spaces_selection.ts b/x-pack/test/functional/apps/spaces/spaces_selection.ts index a0807b758c38d..237041bd52466 100644 --- a/x-pack/test/functional/apps/spaces/spaces_selection.ts +++ b/x-pack/test/functional/apps/spaces/spaces_selection.ts @@ -11,7 +11,7 @@ export default function spaceSelectorFunctionalTests({ getService, getPageObjects, }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); + // const esArchiver = getService('esArchiver'); const listingTable = getService('listingTable'); const PageObjects = getPageObjects([ 'common', From e740beac673007eb97b68d952030a09730d1c250 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 24 Jun 2022 16:26:46 +0100 Subject: [PATCH 4/6] Make it data driven --- .../apps/spaces/spaces_selection.ts | 80 +----- .../es_archives/spaces/selector/data.json | 179 ------------- .../es_archives/spaces/selector/mappings.json | 245 ------------------ 3 files changed, 9 insertions(+), 495 deletions(-) delete mode 100644 x-pack/test/functional/es_archives/spaces/selector/data.json delete mode 100644 x-pack/test/functional/es_archives/spaces/selector/mappings.json diff --git a/x-pack/test/functional/apps/spaces/spaces_selection.ts b/x-pack/test/functional/apps/spaces/spaces_selection.ts index 237041bd52466..e8746f5286de6 100644 --- a/x-pack/test/functional/apps/spaces/spaces_selection.ts +++ b/x-pack/test/functional/apps/spaces/spaces_selection.ts @@ -11,7 +11,6 @@ export default function spaceSelectorFunctionalTests({ getService, getPageObjects, }: FtrProviderContext) { - // const esArchiver = getService('esArchiver'); const listingTable = getService('listingTable'); const PageObjects = getPageObjects([ 'common', @@ -25,79 +24,18 @@ export default function spaceSelectorFunctionalTests({ describe('Spaces', function () { before(async () => { - // await esArchiver.load('x-pack/test/functional/es_archives/spaces/selector'); - await spacesService.create({ - id: 'another-space', - name: 'Another Space', - disabledFeatures: [], - }); - await spacesService.create({ - id: 'space-1', - name: 'Space 1', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-2', - name: 'Space 2', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-3', - name: 'Space 3', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-4', - name: 'Space 4', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-5', - name: 'Space 5', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-6', - name: 'Space 6', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-7', - name: 'Space 7', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-8', - name: 'Space 8', - disabledFeatures: [], + const testSpacesIds = ['another-space', ...Array.from('123456789', (idx) => `space-${idx}`)]; + before(async () => { + for (const testSpaceId of testSpacesIds) { + await spacesService.create({ id: testSpaceId, name: `${testSpaceId} name` }); + } }); - - await spacesService.create({ - id: 'space-9', - name: 'Space 9', - disabledFeatures: [], + after(async () => { + for (const testSpaceId of testSpacesIds) { + await spacesService.delete(testSpaceId); + } }); }); - after(async () => { - // await esArchiver.unload('x-pack/test/functional/es_archives/spaces/selector') - await spacesService.delete('another-space'); - await spacesService.delete('space-1'); - await spacesService.delete('space-2'); - await spacesService.delete('space-3'); - await spacesService.delete('space-4'); - await spacesService.delete('space-5'); - await spacesService.delete('space-6'); - await spacesService.delete('space-7'); - await spacesService.delete('space-8'); - await spacesService.delete('space-9'); - }); this.tags('includeFirefox'); describe('Space Selector', () => { diff --git a/x-pack/test/functional/es_archives/spaces/selector/data.json b/x-pack/test/functional/es_archives/spaces/selector/data.json deleted file mode 100644 index 43fbca65865b6..0000000000000 --- a/x-pack/test/functional/es_archives/spaces/selector/data.json +++ /dev/null @@ -1,179 +0,0 @@ -{ - "type": "doc", - "value": { - "id": "config:6.0.0-alpha1", - "index": ".kibana", - "source": { - "config": { - "buildNum": 8467, - "dateFormat:tz": "UTC" - }, - "type": "config" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:default", - "index": ".kibana", - "source": { - "space": { - "description": "This is the default space!", - "name": "Default" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:another-space", - "index": ".kibana", - "source": { - "space": { - "description": "This is another space", - "name": "Another Space" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:space-1", - "index": ".kibana", - "source": { - "space": { - "description": "This is space I", - "name": "Space 1" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:space-2", - "index": ".kibana", - "source": { - "space": { - "description": "This is space II", - "name": "Space 2" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:space-3", - "index": ".kibana", - "source": { - "space": { - "description": "This is space III", - "name": "Space 3" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:space-4", - "index": ".kibana", - "source": { - "space": { - "description": "This is space IV", - "name": "Space 4" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:space-5", - "index": ".kibana", - "source": { - "space": { - "description": "This is space V", - "name": "Space 5" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:space-6", - "index": ".kibana", - "source": { - "space": { - "description": "This is space VI", - "name": "Space 6" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:space-7", - "index": ".kibana", - "source": { - "space": { - "description": "This is space VII", - "name": "Space 7" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:space-8", - "index": ".kibana", - "source": { - "space": { - "description": "This is space VIII", - "name": "Space 8" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:space-9", - "index": ".kibana", - "source": { - "space": { - "description": "This is space IX", - "name": "Space 9" - }, - "type": "space" - } - } -} diff --git a/x-pack/test/functional/es_archives/spaces/selector/mappings.json b/x-pack/test/functional/es_archives/spaces/selector/mappings.json deleted file mode 100644 index 07dc66dd8ce94..0000000000000 --- a/x-pack/test/functional/es_archives/spaces/selector/mappings.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": {} - }, - "index": ".kibana_1", - "mappings": { - "properties": { - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - }, - "dateFormat:tz": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "dashboard": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "index-pattern": { - "dynamic": "strict", - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "search": { - "dynamic": "strict", - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "dynamic": "strict", - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "space": { - "properties": { - "_reserved": { - "type": "boolean" - }, - "color": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "disabledFeatures": { - "type": "keyword" - }, - "initials": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "spaceId": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "url": { - "dynamic": "strict", - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "visualization": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - }, - "settings": { - "index": { - "number_of_replicas": "1", - "number_of_shards": "1" - } - } - } -} From 83d946022bf33807cb06d3c9345f0abc52a528c3 Mon Sep 17 00:00:00 2001 From: rashmikulkarni Date: Fri, 24 Jun 2022 08:36:00 -0700 Subject: [PATCH 5/6] incorporated the suggestions --- .../apps/spaces/spaces_selection.ts | 78 ++----------------- 1 file changed, 7 insertions(+), 71 deletions(-) diff --git a/x-pack/test/functional/apps/spaces/spaces_selection.ts b/x-pack/test/functional/apps/spaces/spaces_selection.ts index 237041bd52466..09921eb57051e 100644 --- a/x-pack/test/functional/apps/spaces/spaces_selection.ts +++ b/x-pack/test/functional/apps/spaces/spaces_selection.ts @@ -11,7 +11,6 @@ export default function spaceSelectorFunctionalTests({ getService, getPageObjects, }: FtrProviderContext) { - // const esArchiver = getService('esArchiver'); const listingTable = getService('listingTable'); const PageObjects = getPageObjects([ 'common', @@ -24,79 +23,16 @@ export default function spaceSelectorFunctionalTests({ const spacesService = getService('spaces'); describe('Spaces', function () { + const testSpacesIds = ['another-space', ...Array.from('123456789', (idx) => `space-${idx}`)]; before(async () => { - // await esArchiver.load('x-pack/test/functional/es_archives/spaces/selector'); - await spacesService.create({ - id: 'another-space', - name: 'Another Space', - disabledFeatures: [], - }); - await spacesService.create({ - id: 'space-1', - name: 'Space 1', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-2', - name: 'Space 2', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-3', - name: 'Space 3', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-4', - name: 'Space 4', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-5', - name: 'Space 5', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-6', - name: 'Space 6', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-7', - name: 'Space 7', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-8', - name: 'Space 8', - disabledFeatures: [], - }); - - await spacesService.create({ - id: 'space-9', - name: 'Space 9', - disabledFeatures: [], - }); + for (const testSpaceId of testSpacesIds) { + await spacesService.create({ id: testSpaceId, name: `${testSpaceId} name` }); + } }); after(async () => { - // await esArchiver.unload('x-pack/test/functional/es_archives/spaces/selector') - await spacesService.delete('another-space'); - await spacesService.delete('space-1'); - await spacesService.delete('space-2'); - await spacesService.delete('space-3'); - await spacesService.delete('space-4'); - await spacesService.delete('space-5'); - await spacesService.delete('space-6'); - await spacesService.delete('space-7'); - await spacesService.delete('space-8'); - await spacesService.delete('space-9'); + for (const testSpaceId of testSpacesIds) { + await spacesService.delete(testSpaceId); + } }); this.tags('includeFirefox'); From b8439025d3548a2d0ea4ca3e33c87274a4c139c1 Mon Sep 17 00:00:00 2001 From: rashmikulkarni Date: Mon, 27 Jun 2022 06:54:37 -0700 Subject: [PATCH 6/6] incorporate the review change --- x-pack/test/functional/apps/spaces/spaces_selection.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/test/functional/apps/spaces/spaces_selection.ts b/x-pack/test/functional/apps/spaces/spaces_selection.ts index 09921eb57051e..45ae0863de6ab 100644 --- a/x-pack/test/functional/apps/spaces/spaces_selection.ts +++ b/x-pack/test/functional/apps/spaces/spaces_selection.ts @@ -87,8 +87,8 @@ export default function spaceSelectorFunctionalTests({ await PageObjects.spaceSelector.expectSearchBoxInSpacesSelector(); }); - it('search for "ce 1" and find one space', async () => { - await PageObjects.spaceSelector.setSearchBoxInSpacesSelector('ce 1'); + it('search for "ce-1 name" and find one space', async () => { + await PageObjects.spaceSelector.setSearchBoxInSpacesSelector('ce-1 name'); await PageObjects.spaceSelector.expectToFindThatManySpace(1); });