fix: tests

This commit is contained in:
Rucha Mahabal 2021-07-19 23:34:02 +05:30
parent 982a097d7a
commit 76d192f099
2 changed files with 18 additions and 20 deletions

View File

@ -1,17 +1,16 @@
context('Organizational Chart', () => { context('Organizational Chart', () => {
before(() => { before(() => {
cy.login(); cy.login();
cy.visit('/app'); cy.visit('/app/website');
cy.call('erpnext.tests.ui_test_helpers.create_employee_records');
cy.awesomebar('Organizational Chart'); cy.awesomebar('Organizational Chart');
cy.get('.frappe-control[data-fieldname=company] input').focus().as('input'); cy.call('erpnext.tests.ui_test_helpers.create_employee_records').then(() => {
cy.get('@input') cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
.clear({ force: true }) cy.get('@input')
.type('Test Org Chart', { force: true }); .clear({ force: true })
cy.wait(200); .type('Test Org Chart{enter}', { force: true })
cy.get('@input').blur({ force: true }); .blur({ force: true });
});
}); });
it('renders root nodes and loads children for the first expandable node', () => { it('renders root nodes and loads children for the first expandable node', () => {
@ -27,7 +26,7 @@ context('Organizational Chart', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => { cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// children of 1st root visible // children of 1st root visible
cy.get(`[data-parent="${employee_records.message[0]}"]`).as('child-node'); cy.get(`div[data-parent="${employee_records.message[0]}"]`).as('child-node');
cy.get('@child-node') cy.get('@child-node')
.should('have.length', 1) .should('have.length', 1)
.should('be.visible'); .should('be.visible');

View File

@ -2,17 +2,16 @@ context('Organizational Chart Mobile', () => {
before(() => { before(() => {
cy.login(); cy.login();
cy.viewport(375, 667); cy.viewport(375, 667);
cy.visit('/app'); cy.visit('/app/website');
cy.call('erpnext.tests.ui_test_helpers.create_employee_records');
cy.awesomebar('Organizational Chart'); cy.awesomebar('Organizational Chart');
cy.get('.frappe-control[data-fieldname=company] input').focus().as('input'); cy.call('erpnext.tests.ui_test_helpers.create_employee_records').then(() => {
cy.get('@input') cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
.clear({ force: true }) cy.get('@input')
.type('Test Org Chart', { force: true }); .clear({ force: true })
cy.wait(200); .type('Test Org Chart{enter}', { force: true })
cy.get('@input').blur({ force: true }); .blur({ force: true });
});
}); });
it('renders root nodes', () => { it('renders root nodes', () => {
@ -40,7 +39,7 @@ context('Organizational Chart Mobile', () => {
cy.get('.hierarchy-mobile').find('.level').first().find('ul.node-children').children() cy.get('.hierarchy-mobile').find('.level').first().find('ul.node-children').children()
.should('have.length', 2); .should('have.length', 2);
cy.get(`[data-parent="${employee_records.message[1]}"]`).first().as('child-node'); cy.get(`div[data-parent="${employee_records.message[1]}"]`).first().as('child-node');
cy.get('@child-node').should('be.visible'); cy.get('@child-node').should('be.visible');
cy.get('@child-node') cy.get('@child-node')