test: Init UI test for customize form

This commit is contained in:
Suraj Shetty 2022-04-27 15:56:20 +05:30
parent a667b00681
commit 2f2fc0440d
2 changed files with 27 additions and 0 deletions

View file

@ -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);
});
});
});

View file

@ -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();
});