diff --git a/cypress/integration/customize_form.js b/cypress/integration/customize_form.js new file mode 100644 index 0000000000..01b4ebd731 --- /dev/null +++ b/cypress/integration/customize_form.js @@ -0,0 +1,23 @@ +context('Customize Form', () => { + before(() => { + cy.visit('/app/customize-form'); + }); + it('Changing to naming rule should update autoname', () => { + cy.fill_field("doc_type", "ToDo", "Link").blur(); + cy.click_form_section("Naming"); + const naming_rule_default_autoname_map = { + "Autoincrement": "autoincrement", + "Set by user": "prompt", + "By fieldname": "field:", + 'By "Naming Series" field': "naming_series:", + "Expression": "format:", + "Expression (old style)": "", + "Random": "hash", + "By script": "" + }; + Cypress._.forOwn(naming_rule_default_autoname_map, (value, naming_rule) => { + cy.fill_field("naming_rule", naming_rule, "Select"); + cy.get_field("autoname", "Data").should("have.value", value); + }); + }); +}); \ No newline at end of file diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 636312376d..99bec50b37 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -340,3 +340,7 @@ Cypress.Commands.add('click_timeline_action_btn', (btn_name) => { Cypress.Commands.add('select_listview_row_checkbox', (row_no) => { cy.get('.frappe-list .select-like > .list-row-checkbox').eq(row_no).click(); }); + +Cypress.Commands.add('click_form_section', (section_name) => { + cy.get('.section-head').contains(section_name).click(); +});