@@ -137,7 +137,7 @@ jobs: | |||||
- name: UI Tests | - name: UI Tests | ||||
if: ${{ steps.check-build.outputs.build == 'strawberry' }} | if: ${{ steps.check-build.outputs.build == 'strawberry' }} | ||||
run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests frappe --with-coverage --headless --parallel --ci-build-id $GITHUB_RUN_ID | |||||
run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests frappe --with-coverage --headless --parallel --ci-build-id $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT | |||||
env: | env: | ||||
CYPRESS_RECORD_KEY: 4a48f41c-11b3-425b-aa88-c58048fa69eb | CYPRESS_RECORD_KEY: 4a48f41c-11b3-425b-aa88-c58048fa69eb | ||||
@@ -77,11 +77,11 @@ context('MultiSelectDialog', () => { | |||||
it('tests more button', () => { | it('tests more button', () => { | ||||
cy.get_open_dialog() | cy.get_open_dialog() | ||||
.get(`.frappe-control[data-fieldname="more_btn"]`) | |||||
.get(`.frappe-control[data-fieldname="more_child_btn"]`) | |||||
.should('exist') | .should('exist') | ||||
.as('more-btn'); | .as('more-btn'); | ||||
cy.get_open_dialog().get('.list-item-container').should(($rows) => { | |||||
cy.get_open_dialog().get('.datatable .dt-scrollable .dt-row').should(($rows) => { | |||||
expect($rows).to.have.length(20); | expect($rows).to.have.length(20); | ||||
}); | }); | ||||
@@ -89,7 +89,7 @@ context('MultiSelectDialog', () => { | |||||
cy.get('@more-btn').find('button').click({force: true}); | cy.get('@more-btn').find('button').click({force: true}); | ||||
cy.wait('@get-more-records'); | cy.wait('@get-more-records'); | ||||
cy.get_open_dialog().get('.list-item-container').should(($rows) => { | |||||
cy.get_open_dialog().get('.datatable .dt-scrollable .dt-row').should(($rows) => { | |||||
if ($rows.length <= 20) { | if ($rows.length <= 20) { | ||||
throw new Error("More button doesn't work"); | throw new Error("More button doesn't work"); | ||||
} | } | ||||
@@ -113,42 +113,44 @@ frappe.ui.SortSelector = class SortSelector { | |||||
if(!this.args.options) { | if(!this.args.options) { | ||||
// default options | // default options | ||||
var _options = [ | var _options = [ | ||||
{'fieldname': 'modified'} | |||||
{'fieldname': 'modified'}, | |||||
{'fieldname': 'name'}, | |||||
{'fieldname': 'creation'}, | |||||
{'fieldname': 'idx'}, | |||||
] | ] | ||||
// title field | // title field | ||||
if(meta.title_field) { | |||||
_options.push({'fieldname': meta.title_field}); | |||||
if (meta.title_field) { | |||||
_options.splice(1, 0, {'fieldname': meta.title_field}); | |||||
} | |||||
// sort field - set via DocType schema or Customize Form | |||||
if (meta_sort_field) { | |||||
_options.splice(1, 0, { 'fieldname': meta_sort_field }); | |||||
} | } | ||||
// bold or mandatory | |||||
// bold, mandatory and fields that are available in list view | |||||
meta.fields.forEach(function(df) { | meta.fields.forEach(function(df) { | ||||
if(df.mandatory || df.bold) { | |||||
if ( | |||||
(df.mandatory || df.bold || df.in_list_view) | |||||
&& frappe.model.is_value_type(df.fieldtype) | |||||
&& frappe.perm.has_perm(me.doctype, df.permlevel, "read") | |||||
) { | |||||
_options.push({fieldname: df.fieldname, label: df.label}); | _options.push({fieldname: df.fieldname, label: df.label}); | ||||
} | } | ||||
}); | }); | ||||
// meta sort field | |||||
if(meta_sort_field) _options.push({ 'fieldname': meta_sort_field }); | |||||
// more default options | |||||
_options.push( | |||||
{'fieldname': 'name'}, | |||||
{'fieldname': 'creation'}, | |||||
{'fieldname': 'idx'} | |||||
) | |||||
// add missing labels | |||||
_options.forEach(option => { | |||||
if (!option.label) { | |||||
option.label = me.get_label(option.fieldname); | |||||
} | |||||
}); | |||||
// de-duplicate | // de-duplicate | ||||
this.args.options = _options.uniqBy(function(obj) { | |||||
this.args.options = _options.uniqBy(obj => { | |||||
return obj.fieldname; | return obj.fieldname; | ||||
}); | }); | ||||
// add missing labels | |||||
this.args.options.forEach(function(o) { | |||||
if(!o.label) { | |||||
o.label = me.get_label(o.fieldname); | |||||
} | |||||
}); | |||||
} | } | ||||
// set default | // set default | ||||