test: more button in multi select dialog
This commit is contained in:
parent
538bdb5a95
commit
8b50b1a6d7
1 changed files with 49 additions and 10 deletions
|
|
@ -2,32 +2,47 @@ context('MultiSelectDialog', () => {
|
|||
before(() => {
|
||||
cy.login();
|
||||
cy.visit('/app');
|
||||
const contact_template = {
|
||||
"doctype": "Contact",
|
||||
"first_name": "Test",
|
||||
"status": "Passive",
|
||||
"email_ids": [
|
||||
{
|
||||
"doctype": "Contact Email",
|
||||
"email_id": "test@example.com",
|
||||
"is_primary": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
const promises = Array.from({length: 25})
|
||||
.map(_ => cy.insert_doc('Contact', contact_template, true));
|
||||
Promise.all(promises);
|
||||
});
|
||||
|
||||
function open_multi_select_dialog() {
|
||||
cy.window().its('frappe').then(frappe => {
|
||||
new frappe.ui.form.MultiSelectDialog({
|
||||
doctype: "Assignment Rule",
|
||||
doctype: "Contact",
|
||||
target: {},
|
||||
setters: {
|
||||
document_type: null,
|
||||
priority: null
|
||||
status: null,
|
||||
gender: null
|
||||
},
|
||||
add_filters_group: 1,
|
||||
allow_child_item_selection: 1,
|
||||
child_fieldname: "assignment_days",
|
||||
child_columns: ["day"]
|
||||
child_fieldname: "email_ids",
|
||||
child_columns: ["email_id", "is_primary"]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
it('multi select dialog api works', () => {
|
||||
it('checks multi select dialog api works', () => {
|
||||
open_multi_select_dialog();
|
||||
cy.get_open_dialog().should('contain', 'Select Assignment Rules');
|
||||
cy.get_open_dialog().should('contain', 'Select Contacts');
|
||||
});
|
||||
|
||||
it('checks for filters', () => {
|
||||
['search_term', 'document_type', 'priority'].forEach(fieldname => {
|
||||
['search_term', 'status', 'gender'].forEach(fieldname => {
|
||||
cy.get_open_dialog().get(`.frappe-control[data-fieldname="${fieldname}"]`).should('exist');
|
||||
});
|
||||
|
||||
|
|
@ -50,9 +65,33 @@ context('MultiSelectDialog', () => {
|
|||
.should('exist');
|
||||
|
||||
cy.get_open_dialog()
|
||||
.get(`.dt-row-header`).should('contain', 'Assignment Rule');
|
||||
.get(`.dt-row-header`).should('contain', 'Contact');
|
||||
|
||||
cy.get_open_dialog()
|
||||
.get(`.dt-row-header`).should('contain', 'Day');
|
||||
.get(`.dt-row-header`).should('contain', 'Email Id');
|
||||
|
||||
cy.get_open_dialog()
|
||||
.get(`.dt-row-header`).should('contain', 'Is Primary');
|
||||
});
|
||||
|
||||
it('tests more button', () => {
|
||||
cy.get_open_dialog()
|
||||
.get(`.frappe-control[data-fieldname="more_btn"]`)
|
||||
.should('exist')
|
||||
.as('more-btn');
|
||||
|
||||
cy.get_open_dialog().get('.list-item-container').should(($rows) => {
|
||||
expect($rows).to.have.length(20);
|
||||
});
|
||||
|
||||
cy.get('@more-btn').find('button').click();
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get_open_dialog().get('.list-item-container').should(($rows) => {
|
||||
if ($rows.length <= 20) {
|
||||
throw new Error("More button doesn't work")
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue