Skip to content

Commit

Permalink
[Discover] Unskip context size tests (elastic#68213) (elastic#68368)
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal authored Jun 5, 2020
1 parent 7ce16b8 commit b6fb4b1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 53 deletions.
32 changes: 15 additions & 17 deletions test/functional/apps/context/_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* under the License.
*/

import expect from '@kbn/expect';

const TEST_INDEX_PATTERN = 'logstash-*';
const TEST_ANCHOR_ID = 'AU_x3_BrGFA8no6QjjaI';
const TEST_ANCHOR_FILTER_FIELD = 'geo.src';
Expand All @@ -40,20 +38,19 @@ export default function ({ getService, getPageObjects }) {
});

it('inclusive filter should be addable via expanded doc table rows', async function () {
await docTable.toggleRowExpanded({ isAnchorRow: true });

await retry.try(async () => {
await retry.waitFor(`filter ${TEST_ANCHOR_FILTER_FIELD} in filterbar`, async () => {
await docTable.toggleRowExpanded({ isAnchorRow: true });
const anchorDetailsRow = await docTable.getAnchorDetailsRow();
await docTable.addInclusiveFilter(anchorDetailsRow, TEST_ANCHOR_FILTER_FIELD);
await PageObjects.context.waitUntilContextLoadingHasFinished();
expect(
await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, TEST_ANCHOR_FILTER_VALUE, true)
).to.be(true);

return await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, TEST_ANCHOR_FILTER_VALUE, true);
});
await retry.waitFor(`filter matching docs in docTable`, async () => {
const fields = await docTable.getFields();
const hasOnlyFilteredRows = fields
return fields
.map((row) => row[2])
.every((fieldContent) => fieldContent === TEST_ANCHOR_FILTER_VALUE);
expect(hasOnlyFilteredRows).to.be(true);
});
});

Expand All @@ -64,26 +61,27 @@ export default function ({ getService, getPageObjects }) {
await filterBar.toggleFilterEnabled(TEST_ANCHOR_FILTER_FIELD);
await PageObjects.context.waitUntilContextLoadingHasFinished();

await retry.try(async () => {
expect(
await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, TEST_ANCHOR_FILTER_VALUE, false)
).to.be(true);
await retry.waitFor(`a disabled filter in filterbar`, async () => {
return await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, TEST_ANCHOR_FILTER_VALUE, false);
});

await retry.waitFor('filters are disabled', async () => {
const fields = await docTable.getFields();
const hasOnlyFilteredRows = fields
.map((row) => row[2])
.every((fieldContent) => fieldContent === TEST_ANCHOR_FILTER_VALUE);
expect(hasOnlyFilteredRows).to.be(false);
return hasOnlyFilteredRows === false;
});
});

it('filter for presence should be addable via expanded doc table rows', async function () {
await docTable.toggleRowExpanded({ isAnchorRow: true });

await retry.try(async () => {
await retry.waitFor('an exists filter in the filterbar', async () => {
const anchorDetailsRow = await docTable.getAnchorDetailsRow();
await docTable.addExistsFilter(anchorDetailsRow, TEST_ANCHOR_FILTER_FIELD);
await PageObjects.context.waitUntilContextLoadingHasFinished();
expect(await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, 'exists', true)).to.be(true);
return await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, 'exists', true);
});
});
});
Expand Down
72 changes: 36 additions & 36 deletions test/functional/apps/context/_size.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,69 +16,69 @@
* specific language governing permissions and limitations
* under the License.
*/

import expect from '@kbn/expect';

const TEST_INDEX_PATTERN = 'logstash-*';
const TEST_ANCHOR_ID = 'AU_x3_BrGFA8no6QjjaI';
const TEST_DEFAULT_CONTEXT_SIZE = 7;
const TEST_STEP_SIZE = 3;
const TEST_DEFAULT_CONTEXT_SIZE = 2;
const TEST_STEP_SIZE = 2;

export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');
const docTable = getService('docTable');
const PageObjects = getPageObjects(['context']);
let expectedRowLength = 2 * TEST_DEFAULT_CONTEXT_SIZE + 1;

// FLAKY: https://github.com/elastic/kibana/issues/53888
describe.skip('context size', function contextSize() {
describe('context size', function contextSize() {
before(async function () {
await kibanaServer.uiSettings.update({
'context:defaultSize': `${TEST_DEFAULT_CONTEXT_SIZE}`,
'context:step': `${TEST_STEP_SIZE}`,
});
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, TEST_ANCHOR_ID);
});

it('should default to the `context:defaultSize` setting', async function () {
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, TEST_ANCHOR_ID);

await retry.try(async function () {
expect(await docTable.getRowsText()).to.have.length(2 * TEST_DEFAULT_CONTEXT_SIZE + 1);
});
await retry.try(async function () {
const predecessorCountPicker = await PageObjects.context.getPredecessorCountPicker();
expect(await predecessorCountPicker.getAttribute('value')).to.equal(
`${TEST_DEFAULT_CONTEXT_SIZE}`
);
});
await retry.try(async function () {
const successorCountPicker = await PageObjects.context.getSuccessorCountPicker();
expect(await successorCountPicker.getAttribute('value')).to.equal(
`${TEST_DEFAULT_CONTEXT_SIZE}`
);
});
await retry.waitFor(
`number of rows displayed initially is ${expectedRowLength}`,
async function () {
const rows = await docTable.getRowsText();
return rows.length === expectedRowLength;
}
);
await retry.waitFor(
`predecessor count picker is set to ${TEST_DEFAULT_CONTEXT_SIZE}`,
async function () {
const predecessorCountPicker = await PageObjects.context.getPredecessorCountPicker();
const value = await predecessorCountPicker.getAttribute('value');
return value === String(TEST_DEFAULT_CONTEXT_SIZE);
}
);
});

it('should increase according to the `context:step` setting when clicking the `load newer` button', async function () {
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, TEST_ANCHOR_ID);
await PageObjects.context.clickPredecessorLoadMoreButton();
expectedRowLength += TEST_STEP_SIZE;

await retry.try(async function () {
expect(await docTable.getRowsText()).to.have.length(
2 * TEST_DEFAULT_CONTEXT_SIZE + TEST_STEP_SIZE + 1
);
});
await retry.waitFor(
`number of rows displayed after clicking load more predecessors is ${expectedRowLength}`,
async function () {
const rows = await docTable.getRowsText();
return rows.length === expectedRowLength;
}
);
});

it('should increase according to the `context:step` setting when clicking the `load older` button', async function () {
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, TEST_ANCHOR_ID);
await PageObjects.context.clickSuccessorLoadMoreButton();
expectedRowLength += TEST_STEP_SIZE;

await retry.try(async function () {
expect(await docTable.getRowsText()).to.have.length(
2 * TEST_DEFAULT_CONTEXT_SIZE + TEST_STEP_SIZE + 1
);
});
await retry.waitFor(
`number of rows displayed after clicking load more successors is ${expectedRowLength}`,
async function () {
const rows = await docTable.getRowsText();
return rows.length === expectedRowLength;
}
);
});
});
}

0 comments on commit b6fb4b1

Please sign in to comment.