Improve logstash pipeline tests (#32198) (#32294)

* [services/pipeline_list] optimize getRows function

* run ciGroup2 x16 times

* [services/pipeline_list] wait for table body loaded

* Revert "run ciGroup2 x16 times"

This reverts commit 4e45a5eaf1.

* removed unused browser_exec_scripts
This commit is contained in:
Dmitry Lemeshko 2019-03-02 08:10:00 +01:00 committed by GitHub
parent c81ddb5936
commit 4dd288e79c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 37 deletions

View file

@ -1,20 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export function readPipelineListRows(container, cssSelectors) {
return Array.prototype.map.call(
container.querySelectorAll(cssSelectors.ROW),
function (row) {
return {
selected: row.querySelector('input[type=checkbox]').checked,
id: row.querySelector(cssSelectors.CELL_ID).innerText.trim(),
description: row.querySelector(cssSelectors.CELL_DESCRIPTION).innerText.trim(),
lastModified: row.querySelector(cssSelectors.CELL_LAST_MODIFIED).innerText.trim(),
username: row.querySelector(cssSelectors.CELL_USERNAME).innerText.trim(),
};
}
);
}

View file

@ -4,12 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { readPipelineListRows } from './browser_exec_scripts/read_pipeline_list_rows';
export function PipelineListProvider({ getService }) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const browser = getService('browser');
const random = getService('random');
// test subject selectors
@ -113,17 +110,17 @@ export function PipelineListProvider({ getService }) {
* @return {Promise<Array<Object>>}
*/
async readRows() {
return await browser.execute(
readPipelineListRows,
await testSubjects.find(SUBJ_CONTAINER),
{
ROW: testSubjects.getCssSelector(INNER_SUBJ_ROW),
CELL_ID: testSubjects.getCssSelector(INNER_SUBJ_CELL_ID),
CELL_DESCRIPTION: testSubjects.getCssSelector(INNER_SUBJ_CELL_DESCRIPTION),
CELL_LAST_MODIFIED: testSubjects.getCssSelector(INNER_SUBJ_CELL_LAST_MODIFIED),
CELL_USERNAME: testSubjects.getCssSelector(INNER_SUBJ_CELL_USERNAME),
},
);
const pipelineTable = await testSubjects.find('pipelineTable');
const $ = await pipelineTable.parseDomContent();
return $.findTestSubjects(INNER_SUBJ_ROW).toArray().map(row => {
return {
selected: $(row).hasClass('euiTableRow-isSelected'),
id: $(row).findTestSubjects(INNER_SUBJ_CELL_ID).text(),
description: $(row).findTestSubjects(INNER_SUBJ_CELL_DESCRIPTION).text(),
lastModified: $(row).findTestSubjects(INNER_SUBJ_CELL_LAST_MODIFIED).text(),
username: $(row).findTestSubjects(INNER_SUBJ_CELL_USERNAME).text()
};
});
}
/**
@ -163,9 +160,11 @@ export function PipelineListProvider({ getService }) {
* @return {Promise<undefined>}
*/
async assertExists() {
await retry.waitFor('pipline list visible on screen', async () => (
await testSubjects.exists(SUBJ_CONTAINER)
));
await retry.waitFor('pipline list visible on screen', async () => {
const container = await testSubjects.find(SUBJ_CONTAINER);
const found = await container.findAllByCssSelector('table tbody');
return found.length > 0;
});
}
/**