25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

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