You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

90 lines
2.9 KiB

  1. const verify_attachment_visibility = (document, is_private) => {
  2. cy.visit(`/app/${document}`);
  3. const assertion = is_private ? "be.checked" : "not.be.checked";
  4. cy.findByRole("button", { name: "Attach File" }).click();
  5. cy.get_open_dialog().find(".file-upload-area").attachFile("sample_image.jpg", {
  6. subjectType: "drag-n-drop",
  7. });
  8. cy.get_open_dialog().findByRole("checkbox", { name: "Private" }).should(assertion);
  9. };
  10. context("Sidebar", () => {
  11. before(() => {
  12. cy.visit("/login");
  13. cy.login();
  14. return cy
  15. .window()
  16. .its("frappe")
  17. .then((frappe) => {
  18. return frappe.call("frappe.tests.ui_test_helpers.create_blog_post");
  19. });
  20. });
  21. it("Verify attachment visibility config", () => {
  22. verify_attachment_visibility("doctype/Blog Post", true);
  23. verify_attachment_visibility("blog-post/test-blog-attachment-post", false);
  24. });
  25. it('Test for checking "Assigned To" counter value, adding filter and adding & removing an assignment', () => {
  26. cy.visit("/app/doctype");
  27. cy.click_sidebar_button("Assigned To");
  28. //To check if no filter is available in "Assigned To" dropdown
  29. cy.get(".empty-state").should("contain", "No filters found");
  30. cy.click_sidebar_button("Created By");
  31. //To check if "Created By" dropdown contains filter
  32. cy.get(".group-by-item > .dropdown-item").should("contain", "Me");
  33. //Assigning a doctype to a user
  34. cy.visit("/app/doctype/ToDo");
  35. cy.get(".form-assignments > .flex > .text-muted").click();
  36. cy.get_field("assign_to_me", "Check").click();
  37. cy.get(".modal-footer > .standard-actions > .btn-primary").click();
  38. cy.visit("/app/doctype");
  39. cy.click_sidebar_button("Assigned To");
  40. //To check if filter is added in "Assigned To" dropdown after assignment
  41. cy.get(".group-by-field.show > .dropdown-menu > .group-by-item > .dropdown-item").should(
  42. "contain",
  43. "1"
  44. );
  45. //To check if there is no filter added to the listview
  46. cy.get(".filter-selector > .btn").should("contain", "Filter");
  47. //To add a filter to display data into the listview
  48. cy.get(".group-by-field.show > .dropdown-menu > .group-by-item > .dropdown-item").click();
  49. //To check if filter is applied
  50. cy.click_filter_button().should("contain", "1 filter");
  51. cy.get(".fieldname-select-area > .awesomplete > .form-control").should(
  52. "have.value",
  53. "Assigned To"
  54. );
  55. cy.get(".condition").should("have.value", "like");
  56. cy.get(".filter-field > .form-group > .input-with-feedback").should(
  57. "have.value",
  58. "%Administrator%"
  59. );
  60. cy.click_filter_button();
  61. //To remove the applied filter
  62. cy.clear_filters();
  63. //To remove the assignment
  64. cy.visit("/app/doctype/ToDo");
  65. cy.get(".assignments > .avatar-group > .avatar > .avatar-frame").click();
  66. cy.get(".remove-btn").click({ force: true });
  67. cy.hide_dialog();
  68. cy.visit("/app/doctype");
  69. cy.click_sidebar_button("Assigned To");
  70. cy.get(".empty-state").should("contain", "No filters found");
  71. });
  72. });