-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Unskips visualize integration tests #142917
Changes from all commits
6c91648
b4d5b03
6b8183e
49d08ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,16 @@ export class ListingTableService extends FtrService { | |
return visualizationNames; | ||
} | ||
|
||
private async getAllSelectableItemsNamesOnCurrentPage(): Promise<string[]> { | ||
const visualizationNames = []; | ||
const links = await this.find.allByCssSelector('.euiTableRow-isSelectable .euiLink'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
for (let i = 0; i < links.length; i++) { | ||
visualizationNames.push(await links[i].getVisibleText()); | ||
} | ||
this.log.debug(`Found ${visualizationNames.length} selectable visualizations on current page`); | ||
return visualizationNames; | ||
} | ||
|
||
public async waitUntilTableIsLoaded() { | ||
return this.retry.try(async () => { | ||
const isLoaded = await this.find.existsByDisplayedByCssSelector( | ||
|
@@ -65,6 +75,29 @@ export class ListingTableService extends FtrService { | |
}); | ||
} | ||
|
||
/** | ||
* Navigates through all pages on Landing page and returns array of items names that are selectable | ||
* Added for visualize_integration saved object tagging tests | ||
*/ | ||
public async getAllSelectableItemsNames(): Promise<string[]> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implements selecting "selectable" items |
||
this.log.debug('ListingTable.getAllItemsNames'); | ||
let morePages = true; | ||
let visualizationNames: string[] = []; | ||
while (morePages) { | ||
visualizationNames = visualizationNames.concat( | ||
await this.getAllSelectableItemsNamesOnCurrentPage() | ||
); | ||
morePages = !( | ||
(await this.testSubjects.getAttribute('pagination-button-next', 'disabled')) === 'true' | ||
); | ||
if (morePages) { | ||
await this.testSubjects.click('pagerNextButton'); | ||
await this.header.waitUntilLoadingHasFinished(); | ||
} | ||
} | ||
return visualizationNames; | ||
} | ||
|
||
/** | ||
* Navigates through all pages on Landing page and returns array of items names | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
[{ | ||
"id": "tag-1", | ||
"type": "tag", | ||
"attributes": { | ||
|
@@ -8,8 +8,7 @@ | |
}, | ||
"references": [], | ||
"updated_at": "2021-06-17T18:57:58.076Z" | ||
} | ||
|
||
}, | ||
{ | ||
"id": "tag-2", | ||
"type": "tag", | ||
|
@@ -20,8 +19,7 @@ | |
}, | ||
"references": [], | ||
"updated_at": "2021-06-17T18:57:58.076Z" | ||
} | ||
|
||
}, | ||
{ | ||
"id": "tag-3", | ||
"type": "tag", | ||
|
@@ -32,8 +30,18 @@ | |
}, | ||
"references": [], | ||
"updated_at": "2021-06-17T18:57:58.076Z" | ||
} | ||
|
||
}, | ||
{ | ||
"id": "myextratag", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tag for adding to a visualization that's been edited |
||
"type": "tag", | ||
"attributes": { | ||
"name": "myextratag", | ||
"description": "We need one more", | ||
"color": "#000000" | ||
}, | ||
"references": [], | ||
"updated_at": "2021-06-17T18:57:58.076Z" | ||
}, | ||
{ | ||
"id": "logstash-*", | ||
"type": "index-pattern", | ||
|
@@ -45,8 +53,7 @@ | |
}, | ||
"references": [], | ||
"updated_at": "2021-06-17T18:57:58.076Z" | ||
} | ||
|
||
}, | ||
{ | ||
"id": "vis-area-1", | ||
"type": "visualization", | ||
|
@@ -67,8 +74,7 @@ | |
} | ||
], | ||
"updated_at": "2021-06-17T18:57:58.076Z" | ||
} | ||
|
||
}, | ||
{ | ||
"id": "vis-area-2", | ||
"type": "visualization", | ||
|
@@ -89,8 +95,7 @@ | |
} | ||
], | ||
"updated_at": "2021-06-17T18:57:58.076Z" | ||
} | ||
|
||
}, | ||
{ | ||
"id": "vis-area-3", | ||
"type": "visualization", | ||
|
@@ -115,4 +120,4 @@ | |
} | ||
], | ||
"updated_at": "2021-06-17T18:57:58.076Z" | ||
} | ||
}] |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -16,7 +16,14 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { | |||||
const listingTable = getService('listingTable'); | ||||||
const testSubjects = getService('testSubjects'); | ||||||
const find = getService('find'); | ||||||
const PageObjects = getPageObjects(['visualize', 'tagManagement', 'visEditor', 'common']); | ||||||
const retry = getService('retry'); | ||||||
const PageObjects = getPageObjects([ | ||||||
'visualize', | ||||||
'tagManagement', | ||||||
'visEditor', | ||||||
'common', | ||||||
'header', | ||||||
]); | ||||||
|
||||||
/** | ||||||
* Select tags in the searchbar's tag filter. | ||||||
|
@@ -47,10 +54,40 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { | |||||
} | ||||||
await testSubjects.click('savedObjectTitle'); | ||||||
}; | ||||||
// creates a simple markdown vis with a tag provided. | ||||||
const createSimpleMarkdownVis = async (opts: Record<string, string>) => { | ||||||
const { visName, visText, tagName } = opts; | ||||||
await PageObjects.visualize.navigateToNewVisualization(); | ||||||
|
||||||
await PageObjects.visualize.clickMarkdownWidget(); | ||||||
await PageObjects.visEditor.setMarkdownTxt(visText); | ||||||
await PageObjects.visEditor.clickGo(); | ||||||
|
||||||
await PageObjects.visualize.ensureSavePanelOpen(); | ||||||
await PageObjects.visualize.setSaveModalValues(visName, { | ||||||
saveAsNew: false, | ||||||
redirectToOrigin: true, | ||||||
}); | ||||||
if (tagName) { | ||||||
await selectSavedObjectTags(tagName); | ||||||
} | ||||||
|
||||||
// Failing: See https://github.com/elastic/kibana/issues/89958 | ||||||
describe.skip('visualize integration', () => { | ||||||
await testSubjects.click('confirmSaveSavedObjectButton'); | ||||||
await retry.waitForWithTimeout('Save modal to disappear', 5000, () => | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Increased timeout waiting for the modal to clear |
||||||
testSubjects | ||||||
.missingOrFail('confirmSaveSavedObjectButton') | ||||||
.then(() => true) | ||||||
.catch(() => false) | ||||||
); | ||||||
|
||||||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||||||
}; | ||||||
|
||||||
describe('visualize integration', () => { | ||||||
before(async () => { | ||||||
// clean up any left-over visualizations and tags from tests that didn't clean up after themselves | ||||||
await kibanaServer.savedObjects.clean({ types: ['tag', 'visualization'] }); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found that if previous tests hadn't cleaned up after themselves, we get a mismatch on the visualizations remaining. |
||||||
|
||||||
await kibanaServer.importExport.load( | ||||||
'x-pack/test/saved_object_tagging/common/fixtures/es_archiver/visualize/data.json' | ||||||
); | ||||||
|
@@ -62,7 +99,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { | |||||
await kibanaServer.importExport.unload( | ||||||
'x-pack/test/saved_object_tagging/common/fixtures/es_archiver/visualize/data.json' | ||||||
); | ||||||
await kibanaServer.savedObjects.clean({ types: ['tag'] }); | ||||||
// clean up after test suite | ||||||
await kibanaServer.savedObjects.clean({ types: ['tag', 'visualization'] }); | ||||||
await esArchiver.unload( | ||||||
'x-pack/test/saved_object_tagging/common/fixtures/es_archiver/logstash_functional' | ||||||
); | ||||||
|
@@ -77,48 +115,46 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { | |||||
it('allows to manually type tag filter query', async () => { | ||||||
await listingTable.searchForItemWithName('tag:(tag-1)', { escape: false }); | ||||||
await listingTable.expectItemsCount('visualize', 2); | ||||||
const itemNames = await listingTable.getAllItemsNames(); | ||||||
const itemNames = await listingTable.getAllSelectableItemsNames(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implements selecting all visualizations by 'euiTableRow-isSelectable` |
||||||
expect(itemNames).to.eql(['Visualization 1 (tag-1)', 'Visualization 3 (tag-1 + tag-3)']); | ||||||
}); | ||||||
|
||||||
it('allows to filter by selecting a tag in the filter menu', async () => { | ||||||
await selectFilterTags('tag-1'); | ||||||
|
||||||
await listingTable.expectItemsCount('visualize', 2); | ||||||
const itemNames = await listingTable.getAllItemsNames(); | ||||||
const itemNames = await listingTable.getAllSelectableItemsNames(); | ||||||
expect(itemNames).to.eql(['Visualization 1 (tag-1)', 'Visualization 3 (tag-1 + tag-3)']); | ||||||
}); | ||||||
|
||||||
it('allows to filter by multiple tags', async () => { | ||||||
await selectFilterTags('tag-2', 'tag-3'); | ||||||
|
||||||
await listingTable.expectItemsCount('visualize', 2); | ||||||
const itemNames = await listingTable.getAllItemsNames(); | ||||||
const itemNames = await listingTable.getAllSelectableItemsNames(); | ||||||
expect(itemNames).to.eql(['Visualization 2 (tag-2)', 'Visualization 3 (tag-1 + tag-3)']); | ||||||
}); | ||||||
}); | ||||||
|
||||||
describe('creating', () => { | ||||||
before(async () => { | ||||||
await PageObjects.visualize.gotoVisualizationLandingPage(); | ||||||
// delete all visualizations to create new ones explicitly | ||||||
await PageObjects.visualize.deleteAllVisualizations(); | ||||||
}); | ||||||
it('allows to assign tags to the new visualization', async () => { | ||||||
await PageObjects.visualize.navigateToNewVisualization(); | ||||||
|
||||||
await PageObjects.visualize.clickMarkdownWidget(); | ||||||
await PageObjects.visEditor.setMarkdownTxt('Just some markdown'); | ||||||
await PageObjects.visEditor.clickGo(); | ||||||
|
||||||
await PageObjects.visualize.ensureSavePanelOpen(); | ||||||
await PageObjects.visualize.setSaveModalValues('My new markdown viz'); | ||||||
|
||||||
await selectSavedObjectTags('tag-1'); | ||||||
|
||||||
await testSubjects.click('confirmSaveSavedObjectButton'); | ||||||
await PageObjects.common.waitForSaveModalToClose(); | ||||||
await createSimpleMarkdownVis({ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uses helper method |
||||||
visText: 'Just some markdown', | ||||||
visName: 'My new markdown viz', | ||||||
tagName: 'myextratag', | ||||||
}); | ||||||
|
||||||
await PageObjects.visualize.gotoVisualizationLandingPage(); | ||||||
await listingTable.waitUntilTableIsLoaded(); | ||||||
|
||||||
await selectFilterTags('tag-1'); | ||||||
const itemNames = await listingTable.getAllItemsNames(); | ||||||
await selectFilterTags('myextratag'); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We cannot guarantee the order in which the tests in this suite will run or if any are skipped again in the future, so we use a different tag to add to an existing visualization. |
||||||
const itemNames = await listingTable.getAllSelectableItemsNames(); | ||||||
expect(itemNames).to.contain('My new markdown viz'); | ||||||
}); | ||||||
|
||||||
|
@@ -132,7 +168,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { | |||||
await PageObjects.visEditor.clickGo(); | ||||||
|
||||||
await PageObjects.visualize.ensureSavePanelOpen(); | ||||||
await PageObjects.visualize.setSaveModalValues('vis-with-new-tag'); | ||||||
await PageObjects.visualize.setSaveModalValues('vis-with-new-tag', { | ||||||
saveAsNew: false, | ||||||
redirectToOrigin: true, | ||||||
}); | ||||||
|
||||||
await testSubjects.click('savedObjectTagSelector'); | ||||||
await testSubjects.click(`tagSelectorOption-action__create`); | ||||||
|
@@ -159,33 +198,43 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { | |||||
await listingTable.waitUntilTableIsLoaded(); | ||||||
|
||||||
await selectFilterTags('my-new-tag'); | ||||||
const itemNames = await listingTable.getAllItemsNames(); | ||||||
const itemNames = await listingTable.getAllSelectableItemsNames(); | ||||||
expect(itemNames).to.contain('vis-with-new-tag'); | ||||||
}); | ||||||
}); | ||||||
|
||||||
// FLAKY: https://github.com/elastic/kibana/issues/88639 | ||||||
describe.skip('editing', () => { | ||||||
beforeEach(async () => { | ||||||
describe('editing', () => { | ||||||
before(async () => { | ||||||
await PageObjects.visualize.gotoVisualizationLandingPage(); | ||||||
await listingTable.waitUntilTableIsLoaded(); | ||||||
await PageObjects.visualize.deleteAllVisualizations(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Finding all links by css-matchers takes time and causes timeouts. We clean up all the other visualizations to increase rendering speed. |
||||||
// create a vis to add a tag to during edit | ||||||
await PageObjects.visualize.navigateToNewVisualization(); | ||||||
await createSimpleMarkdownVis({ | ||||||
visText: 'Edit me!', | ||||||
visName: 'MarkdownViz', | ||||||
}); | ||||||
}); | ||||||
|
||||||
it('allows to assign tags to an existing visualization', async () => { | ||||||
await listingTable.clickItemLink('visualize', 'Visualization 1 (tag-1)'); | ||||||
|
||||||
await PageObjects.visualize.gotoVisualizationLandingPage(); | ||||||
await listingTable.waitUntilTableIsLoaded(); | ||||||
await listingTable.clickItemLink('visualize', 'MarkdownViz'); | ||||||
await PageObjects.visualize.ensureSavePanelOpen(); | ||||||
await selectSavedObjectTags('tag-2'); | ||||||
|
||||||
await selectSavedObjectTags(...['myextratag']); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: do we need the spread?
Suggested change
|
||||||
await testSubjects.click('confirmSaveSavedObjectButton'); | ||||||
await PageObjects.common.waitForSaveModalToClose(); | ||||||
await retry.waitForWithTimeout('Save modal to disappear', 5000, () => | ||||||
testSubjects | ||||||
.missingOrFail('confirmSaveSavedObjectButton') | ||||||
.then(() => true) | ||||||
.catch(() => false) | ||||||
); | ||||||
|
||||||
await PageObjects.visualize.gotoVisualizationLandingPage(); | ||||||
await listingTable.waitUntilTableIsLoaded(); | ||||||
|
||||||
await selectFilterTags('tag-2'); | ||||||
const itemNames = await listingTable.getAllItemsNames(); | ||||||
expect(itemNames).to.contain('Visualization 1 (tag-1)'); | ||||||
await selectFilterTags('myextratag'); | ||||||
const itemNames = await listingTable.getAllSelectableItemsNames(); | ||||||
expect(itemNames).to.contain('MarkdownViz'); | ||||||
}); | ||||||
}); | ||||||
}); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
increase timeout