fix(tests): fix tests related to tab + User cleanup
This commit is contained in:
parent
d1ac1af776
commit
ec9239525b
5 changed files with 22 additions and 4 deletions
|
|
@ -41,7 +41,7 @@ context("Data Control", () => {
|
|||
it("check custom formatters", () => {
|
||||
cy.visit(`/app/doctype/User`);
|
||||
cy.get(
|
||||
'[data-fieldname="fields"] .grid-row[data-idx="2"] [data-fieldname="fieldtype"] .static-area'
|
||||
'[data-fieldname="fields"] .grid-row[data-idx="3"] [data-fieldname="fieldtype"] .static-area'
|
||||
).should("have.text", "Section Break");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ context("Dashboard links", () => {
|
|||
cy.get(".list-row-col > .level-item > .ellipsis").eq(0).click({ force: true });
|
||||
|
||||
//To check if initially the dashboard contains only the "Contact" link and there is no counter
|
||||
cy.select_form_tab("Connections");
|
||||
cy.get('[data-doctype="Contact"]').should("contain", "Contact");
|
||||
|
||||
//Adding a new contact
|
||||
|
|
@ -44,6 +45,7 @@ context("Dashboard links", () => {
|
|||
cy.get(".list-row-col > .level-item > .ellipsis").eq(0).click({ force: true });
|
||||
|
||||
//To check if the counter for contact doc is "1" after adding the contact
|
||||
cy.select_form_tab("Connections");
|
||||
cy.get('[data-doctype="Contact"] > .count').should("contain", "1");
|
||||
cy.get('[data-doctype="Contact"]').contains("Contact").click();
|
||||
|
||||
|
|
@ -64,6 +66,7 @@ context("Dashboard links", () => {
|
|||
it("Report link in dashboard", () => {
|
||||
cy.visit("/app/user");
|
||||
cy.visit("/app/user/Administrator");
|
||||
cy.select_form_tab("Connections");
|
||||
cy.get('[data-doctype="Contact"]').should("contain", "Contact");
|
||||
cy.findByText("Connections");
|
||||
cy.window()
|
||||
|
|
|
|||
|
|
@ -240,6 +240,10 @@ Cypress.Commands.add("new_form", (doctype) => {
|
|||
cy.get("body").should("have.attr", "data-ajax-state", "complete");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("select_form_tab", (label) => {
|
||||
cy.get(".form-tabs-list [data-toggle='tab']").contains(label).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("go_to_list", (doctype) => {
|
||||
let dt_in_route = doctype.toLowerCase().replace(/ /g, "-");
|
||||
cy.visit(`/app/${dt_in_route}`);
|
||||
|
|
|
|||
|
|
@ -1910,7 +1910,7 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
}
|
||||
|
||||
// uncollapse section
|
||||
if (field.section.is_collapsed()) {
|
||||
if (field.section?.is_collapsed()) {
|
||||
field.section.collapse(false);
|
||||
}
|
||||
|
||||
|
|
@ -1919,7 +1919,9 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
|
||||
// focus if text field
|
||||
if (focus) {
|
||||
$el.find("input, select, textarea").focus();
|
||||
setTimeout(() => {
|
||||
$el.find("input, select, textarea").focus();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// highlight control inside field
|
||||
|
|
|
|||
|
|
@ -378,11 +378,20 @@ frappe.ui.form.Layout = class Layout {
|
|||
|
||||
const visible_tabs = this.tabs.filter((tab) => !tab.hidden);
|
||||
if (visible_tabs && visible_tabs.length == 1) {
|
||||
visible_tabs[0].parent.toggleClass("hide show");
|
||||
visible_tabs[0].tab_link.toggleClass("hide show");
|
||||
}
|
||||
this.set_tab_as_active();
|
||||
}
|
||||
|
||||
select_tab(label_or_fieldname) {
|
||||
for (let tab of this.tabs) {
|
||||
if (tab.label.toLowerCase() === label_or_fieldname.toLowerCase() || tab.df.fieldname?.toLowerCase() === label_or_fieldname.toLowerCase()) {
|
||||
tab.set_active();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_tab_as_active() {
|
||||
let frm_active_tab = this?.frm.get_active_tab?.();
|
||||
if (frm_active_tab) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue