seitime-frappe/cypress/integration/table_multiselect.js
Komal-Saraf0609 a8fe3a8668
test: Adding Cypress tests for sidebar, timeline and email testing (#13729)
* test: fix get_field command

* test: Add timeline email test cases

* test: Add sidebar test cases

* test: Add timeline test cases

* test: Added new commands

* test: Added proper name for test case, added comments and removed redundancy

* test: Added proper name for test case, added comments and removed redundancy

* test: Added proper name for test case, added comments and removed redundancy

* test: Added new commands

* test: Added proper name for test case, added comments and removed redundancy

* test: Added proper name for test case, added comments and removed redundancy

* fix: Sider issues

* fix: Sider issues

* fix: Sider issues

* fix: UI Tests

* fix: UI tests

* fix: UI tests

* fix: UI tests

* fix: UI tests

* fix: UI tests

* fix: UI tests

* fix: UI tests

* fix: UI tests

* fix: UI tests

* fix: UI tests

* fix: UI tests

* fix: UI test

* fix: UI tests

* fix: UI tests

* fix: Context correction

* test: fix fill_field command

* test: fixed get_field command
(removed :visible for code)

* test: Fixed fill_field command
(removed .blur())

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2021-08-06 07:52:24 +00:00

51 lines
2.2 KiB
JavaScript

context('Table MultiSelect', () => {
before(() => {
cy.login();
});
let name = 'table multiselect' + Math.random().toString().slice(2, 8);
it('select value from multiselect dropdown', () => {
cy.new_form('Assignment Rule');
cy.fill_field('__newname', name);
cy.fill_field('document_type', 'Blog Post');
cy.get('.section-head').contains('Assignment Rules').scrollIntoView();
cy.fill_field('assign_condition', 'status=="Open"', 'Code');
cy.get('input[data-fieldname="users"]').focus().as('input');
cy.get('input[data-fieldname="users"] + ul').should('be.visible');
cy.get('@input').type('test{enter}', { delay: 100 });
cy.get('.frappe-control[data-fieldname="users"] .form-control .tb-selected-value .btn-link-to-form')
.as('selected-value');
cy.get('@selected-value').should('contain', 'test@erpnext.com');
cy.intercept('POST', '/api/method/frappe.desk.form.save.savedocs').as('save_form');
// trigger save
cy.get('.primary-action').click();
cy.wait('@save_form').its('response.statusCode').should('eq', 200);
cy.get('@selected-value').should('contain', 'test@erpnext.com');
});
it('delete value using backspace', () => {
cy.go_to_list('Assignment Rule');
cy.get(`.list-subject:contains("table multiselect")`).last().find('a').click();
cy.get('input[data-fieldname="users"]').focus().type('{backspace}');
cy.get('.frappe-control[data-fieldname="users"] .form-control .tb-selected-value')
.should('not.exist');
});
it('delete value using x', () => {
cy.go_to_list('Assignment Rule');
cy.get(`.list-subject:contains("table multiselect")`).last().find('a').click();
cy.get('.frappe-control[data-fieldname="users"] .form-control .tb-selected-value').as('existing_value');
cy.get('@existing_value').find('.btn-remove').click();
cy.get('@existing_value').should('not.exist');
});
it('navigate to selected value', () => {
cy.go_to_list('Assignment Rule');
cy.get(`.list-subject:contains("table multiselect")`).last().find('a').click();
cy.get('.frappe-control[data-fieldname="users"] .form-control .tb-selected-value').as('existing_value');
cy.get('@existing_value').find('.btn-link-to-form').click();
cy.location('pathname').should('contain', '/user/test@erpnext.com');
});
});