fix: flaky Org Chart Test (#27971) (#27988)

(cherry picked from commit 8eacaddde7)

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
This commit is contained in:
mergify[bot]
2021-10-18 11:47:12 +05:30
committed by GitHub
parent 9f71863a6a
commit f328b226fb
3 changed files with 8 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ context('Organizational Chart', () => {
cy.get('.frappe-control[data-fieldname=company] input').focus().as('input'); cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
cy.get('@input') cy.get('@input')
.clear({ force: true }) .clear({ force: true })
.type('Test Org Chart{enter}', { force: true }) .type('Test Org Chart{downarrow}{enter}', { force: true })
.blur({ force: true }); .blur({ force: true });
}); });
}); });

View File

@@ -25,7 +25,7 @@ context('Organizational Chart Mobile', () => {
cy.get('.frappe-control[data-fieldname=company] input').focus().as('input'); cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
cy.get('@input') cy.get('@input')
.clear({ force: true }) .clear({ force: true })
.type('Test Org Chart{enter}', { force: true }) .type('Test Org Chart{downarrow}{enter}', { force: true })
.blur({ force: true }); .blur({ force: true });
}); });
}); });

View File

@@ -334,10 +334,12 @@ erpnext.HierarchyChart = class {
if (child_nodes) { if (child_nodes) {
$.each(child_nodes, (_i, data) => { $.each(child_nodes, (_i, data) => {
this.add_node(node, data); if (!$(`[id="${data.id}"]`).length) {
setTimeout(() => { this.add_node(node, data);
this.add_connector(node.id, data.id); setTimeout(() => {
}, 250); this.add_connector(node.id, data.id);
}, 250);
}
}); });
} }
} }