Skip to content

Commit

Permalink
wait for dom changes instead of sleeping
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Oct 9, 2019
1 parent 9bb0c3d commit cae13ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 0 additions & 2 deletions x-pack/test/functional/apps/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {

it('should show correct node labels', async function() {
await PageObjects.graph.selectIndexPattern('secrepo*');
await PageObjects.common.sleep(1000);
await buildGraph();
const { nodes } = await PageObjects.graph.getGraphObjects();
const circlesText = nodes.map(({ label }) => label);
Expand Down Expand Up @@ -119,7 +118,6 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
it('should create new Graph workspace', async function() {
await PageObjects.graph.newGraph();
await PageObjects.graph.selectIndexPattern('secrepo*');
await PageObjects.common.sleep(1000);
const { nodes, edges } = await PageObjects.graph.getGraphObjects();
expect(nodes).to.be.empty();
expect(edges).to.be.empty();
Expand Down
11 changes: 10 additions & 1 deletion x-pack/test/functional/page_objects/graph_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,19 @@ export function GraphPageProvider({ getService, getPageObjects }: FtrProviderCon
async selectIndexPattern(pattern: string) {
await testSubjects.click('graphDatasourceButton');
await testSubjects.click(`savedObjectTitle${pattern.split(' ').join('-')}`);
// wait till add fields button becomes available, then the index pattern is loaded completely
await testSubjects.waitForAttributeToChange(
'graph-add-field-button',
'aria-disabled',
'false'
);
}

async clickAddField() {
await testSubjects.click('graph-add-field-button');
await retry.try(async () => {
await testSubjects.click('graph-add-field-button');
await testSubjects.existOrFail('graph-field-search', { timeout: 3000 });
});
}

async selectField(field: string) {
Expand Down

0 comments on commit cae13ee

Please sign in to comment.