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.
 
 
 
 
 
 

86 lines
3.2 KiB

  1. context("Folder Navigation", () => {
  2. before(() => {
  3. cy.visit("/login");
  4. cy.login();
  5. cy.visit("/app/file");
  6. });
  7. it("Adding Folders", () => {
  8. //Adding filter to go into the home folder
  9. cy.get(".filter-selector > .btn").findByText("1 filter").click();
  10. cy.findByRole("button", { name: "Clear Filters" }).click();
  11. cy.get(".filter-action-buttons > .text-muted").findByText("+ Add a Filter").click();
  12. cy.get(".fieldname-select-area > .awesomplete > .form-control").type("Fol{enter}");
  13. cy.get(
  14. ".filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback"
  15. ).type("Home{enter}");
  16. cy.get(".filter-action-buttons > div > .btn-primary").findByText("Apply Filters").click();
  17. //Adding folder (Test Folder)
  18. cy.click_menu_button("New Folder");
  19. cy.fill_field("value", "Test Folder");
  20. cy.click_modal_primary_button("Create");
  21. });
  22. it("Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct", () => {
  23. //Navigating inside the Attachments folder
  24. cy.get('[title="Attachments"] > span').click();
  25. //To check if the URL formed after visiting the attachments folder is correct
  26. cy.location("pathname").should("eq", "/app/file/view/home/Attachments");
  27. cy.visit("/app/file/view/home/Attachments");
  28. //Adding folder inside the attachments folder
  29. cy.click_menu_button("New Folder");
  30. cy.fill_field("value", "Test Folder");
  31. cy.click_modal_primary_button("Create");
  32. //Navigating inside the added folder in the Attachments folder
  33. cy.get('[title="Test Folder"] > span').click();
  34. //To check if the URL is correct after visiting the Test Folder
  35. cy.location("pathname").should("eq", "/app/file/view/home/Attachments/Test%20Folder");
  36. cy.visit("/app/file/view/home/Attachments/Test%20Folder");
  37. //Adding a file inside the Test Folder
  38. cy.findByRole("button", { name: "Add File" }).eq(0).click({ force: true });
  39. cy.get(".file-uploader").findByText("Link").click();
  40. cy.get(".input-group > .form-control").type(
  41. "https://wallpaperplay.com/walls/full/8/2/b/72402.jpg"
  42. );
  43. cy.click_modal_primary_button("Upload");
  44. //To check if the added file is present in the Test Folder
  45. cy.get("span.level-item > span").should("contain", "Test Folder");
  46. cy.get(".list-row-container").eq(0).should("contain.text", "72402.jpg");
  47. cy.get(".list-row-checkbox").eq(0).click();
  48. cy.intercept({
  49. method: "POST",
  50. url: "api/method/frappe.desk.reportview.delete_items",
  51. }).as("file_deleted");
  52. //Deleting the added file from the Test folder
  53. cy.click_action_button("Delete");
  54. cy.click_modal_primary_button("Yes");
  55. cy.wait("@file_deleted");
  56. //Deleting the Test Folder
  57. cy.visit("/app/file/view/home/Attachments");
  58. cy.get(".list-row-checkbox").eq(0).click();
  59. cy.click_action_button("Delete");
  60. cy.click_modal_primary_button("Yes");
  61. cy.wait("@file_deleted");
  62. });
  63. it("Deleting Test Folder from the home", () => {
  64. //Deleting the Test Folder added in the home directory
  65. cy.visit("/app/file/view/home");
  66. cy.get(".level-left > .list-subject > .file-select >.list-row-checkbox")
  67. .eq(0)
  68. .click({ force: true, delay: 500 });
  69. cy.click_action_button("Delete");
  70. cy.click_modal_primary_button("Yes");
  71. });
  72. });