mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* small tweaks to make tests more stable * fix empty list check, update more tests * fix
This commit is contained in:
parent
29ef8a5c63
commit
03fcbe1ab8
7 changed files with 43 additions and 27 deletions
|
@ -134,8 +134,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
it('should not import saved objects linked to saved searches when saved search index pattern does not exist', async function () {
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaIndexPatterns();
|
||||
await PageObjects.settings.clickIndexPatternLogstash();
|
||||
await PageObjects.settings.removeIndexPattern();
|
||||
await PageObjects.settings.removeLogstashIndexPatternIfExist();
|
||||
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaSavedObjects();
|
||||
|
@ -169,8 +168,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
// First, we need to delete the index pattern
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaIndexPatterns();
|
||||
await PageObjects.settings.clickIndexPatternLogstash();
|
||||
await PageObjects.settings.removeIndexPattern();
|
||||
await PageObjects.settings.removeLogstashIndexPatternIfExist();
|
||||
|
||||
// Then, import the objects
|
||||
await PageObjects.settings.clickKibanaSavedObjects();
|
||||
|
@ -301,8 +299,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
// Second, we need to delete the index pattern
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaIndexPatterns();
|
||||
await PageObjects.settings.clickIndexPatternLogstash();
|
||||
await PageObjects.settings.removeIndexPattern();
|
||||
await PageObjects.settings.removeLogstashIndexPatternIfExist();
|
||||
|
||||
// Last, import a saved object connected to the saved search
|
||||
// This should NOT show the conflicts
|
||||
|
@ -337,8 +334,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
// First, we need to delete the index pattern
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaIndexPatterns();
|
||||
await PageObjects.settings.clickIndexPatternLogstash();
|
||||
await PageObjects.settings.removeIndexPattern();
|
||||
await PageObjects.settings.removeLogstashIndexPatternIfExist();
|
||||
|
||||
// Then, import the objects
|
||||
await PageObjects.settings.clickKibanaSavedObjects();
|
||||
|
|
|
@ -35,8 +35,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
after(async function afterAll() {
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaIndexPatterns();
|
||||
await PageObjects.settings.clickIndexPatternLogstash();
|
||||
await PageObjects.settings.removeIndexPattern();
|
||||
await PageObjects.settings.removeLogstashIndexPatternIfExist();
|
||||
});
|
||||
|
||||
it('should allow setting advanced settings', async function () {
|
||||
|
|
|
@ -59,8 +59,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
after(async function afterAll() {
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaIndexPatterns();
|
||||
await PageObjects.settings.clickIndexPatternLogstash();
|
||||
await PageObjects.settings.removeIndexPattern();
|
||||
await PageObjects.settings.removeLogstashIndexPatternIfExist();
|
||||
});
|
||||
|
||||
it('should not allow saving of invalid scripts', async function () {
|
||||
|
|
|
@ -40,8 +40,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
after(async function afterAll() {
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaIndexPatterns();
|
||||
await PageObjects.settings.clickIndexPatternLogstash();
|
||||
await PageObjects.settings.removeIndexPattern();
|
||||
await PageObjects.settings.removeLogstashIndexPatternIfExist();
|
||||
});
|
||||
|
||||
it('should display script error when script is invalid', async function () {
|
||||
|
|
|
@ -55,9 +55,11 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
|
|||
|
||||
// check for the index pattern info flyout that covers the
|
||||
// create index pattern button on smaller screens
|
||||
if (await testSubjects.exists('CreateIndexPatternPrompt')) {
|
||||
await testSubjects.click('CreateIndexPatternPrompt > euiFlyoutCloseButton');
|
||||
}
|
||||
await retry.waitFor('index pattern info flyout', async () => {
|
||||
if (await testSubjects.exists('CreateIndexPatternPrompt')) {
|
||||
await testSubjects.click('CreateIndexPatternPrompt > euiFlyoutCloseButton');
|
||||
} else return true;
|
||||
});
|
||||
}
|
||||
|
||||
async getAdvancedSettings(propertyName) {
|
||||
|
@ -285,6 +287,19 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
|
|||
await indexLink.click();
|
||||
}
|
||||
|
||||
async isIndexPatternListEmpty() {
|
||||
await testSubjects.existOrFail('indexPatternTable', { timeout: 5000 });
|
||||
const indexPatternList = await find.allByCssSelector('[data-test-subj="indexPatternTable"] .euiTable a');
|
||||
return indexPatternList.length === 0;
|
||||
}
|
||||
|
||||
async removeLogstashIndexPatternIfExist() {
|
||||
if (!(await this.isIndexPatternListEmpty())) {
|
||||
await this.clickIndexPatternLogstash();
|
||||
await this.removeIndexPattern();
|
||||
}
|
||||
}
|
||||
|
||||
async createIndexPattern(indexPatternName, timefield = '@timestamp') {
|
||||
await retry.try(async () => {
|
||||
await this.navigateTo();
|
||||
|
|
|
@ -754,7 +754,7 @@ export function VisualizePageProvider({ getService, getPageObjects, updateBaseli
|
|||
async saveVisualizationExpectSuccess(vizName, { saveAsNew = false } = {}) {
|
||||
await this.saveVisualization(vizName, { saveAsNew });
|
||||
const successToast = await testSubjects.exists('saveVisualizationSuccess', {
|
||||
timeout: defaultFindTimeout
|
||||
timeout: 2 * defaultFindTimeout
|
||||
});
|
||||
expect(successToast).to.be(true);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ export function TableProvider({ getService }: FtrProviderContext) {
|
|||
class Table {
|
||||
/**
|
||||
* Finds table and returns data in the nested array format
|
||||
* [ [cell1_in_row1, cell2_in_row1], [cell1_in_row2, cell2_in_row2] ]
|
||||
* @param dataTestSubj data-test-subj selector
|
||||
*/
|
||||
|
||||
|
@ -37,16 +38,23 @@ export function TableProvider({ getService }: FtrProviderContext) {
|
|||
/**
|
||||
* Converts the table data into nested array
|
||||
* [ [cell1_in_row1, cell2_in_row1], [cell1_in_row2, cell2_in_row2] ]
|
||||
* @param table
|
||||
* @param element table
|
||||
*/
|
||||
public async getDataFromElement(table: WebElementWrapper): Promise<string[][]> {
|
||||
const rows = await table.findAllByTagName('tr');
|
||||
return await Promise.all(
|
||||
rows.map(async row => {
|
||||
const cells = await row.findAllByTagName('td');
|
||||
return await Promise.all(cells.map(async cell => await cell.getVisibleText()));
|
||||
})
|
||||
);
|
||||
public async getDataFromElement(element: WebElementWrapper): Promise<string[][]> {
|
||||
const $ = await element.parseDomContent();
|
||||
return $('tr')
|
||||
.toArray()
|
||||
.map(row =>
|
||||
$(row)
|
||||
.find('td')
|
||||
.toArray()
|
||||
.map(cell =>
|
||||
$(cell)
|
||||
.text()
|
||||
.replace(/ /g, '')
|
||||
.trim()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue