test: fix tests using admin account
This commit is contained in:
parent
f07bc3b369
commit
a6b341bd59
7 changed files with 38 additions and 23 deletions
|
|
@ -177,14 +177,14 @@ context("Control Link", () => {
|
|||
cy.intercept("POST", "/api/method/frappe.client.validate_link").as("validate_link");
|
||||
|
||||
cy.get(".frappe-control[data-fieldname=assigned_by] input").focus().as("input");
|
||||
cy.get("@input").type("Administrator", { delay: 100 }).blur();
|
||||
cy.get("@input").type(cy.config("testUser"), { delay: 100 }).blur();
|
||||
cy.wait("@validate_link");
|
||||
cy.get(".frappe-control[data-fieldname=assigned_by_full_name] .control-value").should(
|
||||
"contain",
|
||||
"Administrator"
|
||||
"Frappe"
|
||||
);
|
||||
|
||||
cy.window().its("cur_frm.doc.assigned_by").should("eq", "Administrator");
|
||||
cy.window().its("cur_frm.doc.assigned_by").should("eq", cy.config("testUser"));
|
||||
|
||||
// invalid input
|
||||
cy.get("@input").clear().type("invalid input", { delay: 100 }).blur();
|
||||
|
|
@ -198,10 +198,10 @@ context("Control Link", () => {
|
|||
// set valid value again
|
||||
cy.get("@input").clear().focus();
|
||||
cy.wait("@search_link");
|
||||
cy.get("@input").type("Administrator", { delay: 100 }).blur();
|
||||
cy.get("@input").type(cy.config("testUser"), { delay: 100 }).blur();
|
||||
cy.wait("@validate_link");
|
||||
|
||||
cy.window().its("cur_frm.doc.assigned_by").should("eq", "Administrator");
|
||||
cy.window().its("cur_frm.doc.assigned_by").should("eq", cy.config("testUser"));
|
||||
|
||||
// clear input
|
||||
cy.get("@input").clear().blur();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const child_table_doctype_name = child_table_doctype.name;
|
|||
context("Dashboard links", () => {
|
||||
before(() => {
|
||||
cy.visit("/login");
|
||||
cy.login();
|
||||
cy.login("Administrator");
|
||||
cy.insert_doc("DocType", child_table_doctype, true);
|
||||
cy.insert_doc("DocType", child_table_doctype_1, true);
|
||||
cy.insert_doc("DocType", doctype_with_child_table, true);
|
||||
|
|
@ -27,8 +27,7 @@ context("Dashboard links", () => {
|
|||
cy.visit("/app/contact");
|
||||
cy.clear_filters();
|
||||
|
||||
cy.visit("/app/user");
|
||||
cy.get(".list-row-col > .level-item > .ellipsis").eq(0).click({ force: true });
|
||||
cy.visit(`/app/user/${cy.config("testUser")}`);
|
||||
|
||||
//To check if initially the dashboard contains only the "Contact" link and there is no counter
|
||||
cy.select_form_tab("Connections");
|
||||
|
|
@ -41,12 +40,11 @@ context("Dashboard links", () => {
|
|||
cy.findByRole("button", { name: "Add Contact" }).click();
|
||||
cy.get('[data-doctype="Contact"][data-fieldname="first_name"]').type("Admin");
|
||||
cy.findByRole("button", { name: "Save" }).click();
|
||||
cy.visit("/app/user");
|
||||
cy.get(".list-row-col > .level-item > .ellipsis").eq(0).click({ force: true });
|
||||
cy.visit(`/app/user/${cy.config("testUser")}`);
|
||||
|
||||
//To check if the counter for contact doc is "1" after adding the contact
|
||||
//To check if the counter for contact doc is "2" after adding additional contact
|
||||
cy.select_form_tab("Connections");
|
||||
cy.get('[data-doctype="Contact"] > .count').should("contain", "1");
|
||||
cy.get('[data-doctype="Contact"] > .count').should("contain", "2");
|
||||
cy.get('[data-doctype="Contact"]').contains("Contact").click();
|
||||
|
||||
//Deleting the newly created contact
|
||||
|
|
@ -64,8 +62,7 @@ context("Dashboard links", () => {
|
|||
});
|
||||
|
||||
it("Report link in dashboard", () => {
|
||||
cy.visit("/app/user");
|
||||
cy.visit("/app/user/Administrator");
|
||||
cy.visit(`/app/user/${cy.config("testUser")}`);
|
||||
cy.select_form_tab("Connections");
|
||||
cy.get('.document-link[data-doctype="Contact"]').contains("Contact");
|
||||
cy.window()
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ context("Sidebar", () => {
|
|||
cy.get(".condition").should("have.value", "like");
|
||||
cy.get(".filter-field > .form-group > .input-with-feedback").should(
|
||||
"have.value",
|
||||
"%Administrator%"
|
||||
`%${cy.config("testUser")}%`
|
||||
);
|
||||
cy.click_filter_button();
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ context("Table MultiSelect", () => {
|
|||
cy.fill_field("assign_condition", 'status=="Open"', "Code");
|
||||
cy.get('input[data-fieldname="users"]').focus().as("input");
|
||||
cy.get('input[data-fieldname="users"] + ul').should("be.visible");
|
||||
cy.get("@input").type("test{enter}", { delay: 100 });
|
||||
cy.get("@input").type("test@erpnext", { delay: 100 });
|
||||
cy.wait(500);
|
||||
cy.get("@input").type("{enter}");
|
||||
cy.get(
|
||||
'.frappe-control[data-fieldname="users"] .form-control .tb-selected-value .btn-link-to-form'
|
||||
).as("selected-value");
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@ context("Timeline", () => {
|
|||
cy.click_listview_row_item(0);
|
||||
|
||||
//To check if the submission of the documemt is visible in the timeline content
|
||||
cy.get(".timeline-content").should("contain", "Administrator submitted this document");
|
||||
cy.get(".timeline-content").should("contain", "Frappe submitted this document");
|
||||
cy.get('[id="page-Custom Submittable DocType"] .page-actions')
|
||||
.findByRole("button", { name: "Cancel" })
|
||||
.click();
|
||||
cy.get_open_dialog().findByRole("button", { name: "Yes" }).click();
|
||||
|
||||
//To check if the cancellation of the documemt is visible in the timeline content
|
||||
cy.get(".timeline-content").should("contain", "Administrator cancelled this document");
|
||||
cy.get(".timeline-content").should("contain", "Frappe cancelled this document");
|
||||
|
||||
//Deleting the document
|
||||
cy.visit("/app/custom-submittable-doctype");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
context("Web Form", () => {
|
||||
before(() => {
|
||||
cy.login();
|
||||
cy.login("Administrator");
|
||||
cy.visit("/app/");
|
||||
return cy
|
||||
.window()
|
||||
.its("frappe")
|
||||
.then((frappe) => {
|
||||
return frappe.xcall("frappe.tests.ui_test_helpers.clear_notes");
|
||||
});
|
||||
});
|
||||
|
||||
it("Create Web Form", () => {
|
||||
|
|
@ -42,7 +49,7 @@ context("Web Form", () => {
|
|||
});
|
||||
|
||||
it("Login Required", () => {
|
||||
cy.login();
|
||||
cy.login("Administrator");
|
||||
cy.visit("/app/web-form/note");
|
||||
|
||||
cy.findByRole("tab", { name: "Settings" }).click();
|
||||
|
|
@ -51,7 +58,6 @@ context("Web Form", () => {
|
|||
cy.save();
|
||||
|
||||
cy.visit("/note");
|
||||
cy.url().should("include", "/note/Note%201");
|
||||
|
||||
cy.call("logout");
|
||||
|
||||
|
|
@ -62,7 +68,7 @@ context("Web Form", () => {
|
|||
});
|
||||
|
||||
it("Show List", () => {
|
||||
cy.login();
|
||||
cy.login("Administrator");
|
||||
cy.visit("/app/web-form/note");
|
||||
|
||||
cy.findByRole("tab", { name: "Settings" }).click();
|
||||
|
|
@ -156,7 +162,7 @@ context("Web Form", () => {
|
|||
});
|
||||
|
||||
it("Read Only", () => {
|
||||
cy.login();
|
||||
cy.login("Administrator");
|
||||
cy.visit("/note");
|
||||
cy.url().should("include", "/note/list");
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,15 @@ def create_todo_records():
|
|||
).insert()
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def clear_notes():
|
||||
if not frappe.local.dev_server:
|
||||
frappe.throw(_("Not allowed"), frappe.PermissionError)
|
||||
|
||||
for note in frappe.get_all("Note", pluck="name"):
|
||||
frappe.delete_doc("Note", note, force=True)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_communication_record():
|
||||
doc = frappe.get_doc(
|
||||
|
|
@ -408,6 +417,7 @@ def create_test_user():
|
|||
user.first_name = "Frappe"
|
||||
user.new_password = frappe.local.conf.admin_password
|
||||
user.send_welcome_email = 0
|
||||
user.time_zone = "Asia/Kolkata"
|
||||
user.flags.ignore_password_policy = True
|
||||
user.insert(ignore_if_duplicate=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue