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.
 
 
 
 
 
 

93 line
3.4 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.wait(500);
  25. cy.get('[title="Attachments"] > span').click();
  26. //To check if the URL formed after visiting the attachments folder is correct
  27. cy.location("pathname").should("eq", "/app/file/view/home/Attachments");
  28. cy.visit("/app/file/view/home/Attachments");
  29. //Adding folder inside the attachments folder
  30. cy.click_menu_button("New Folder");
  31. cy.fill_field("value", "Test Folder");
  32. cy.click_modal_primary_button("Create");
  33. //Navigating inside the added folder in the Attachments folder
  34. cy.wait(500);
  35. cy.get('[title="Test Folder"] > span').click();
  36. //To check if the URL is correct after visiting the Test Folder
  37. cy.location("pathname").should("eq", "/app/file/view/home/Attachments/Test%20Folder");
  38. cy.visit("/app/file/view/home/Attachments/Test%20Folder");
  39. //Adding a file inside the Test Folder
  40. cy.findByRole("button", { name: "Add File" }).eq(0).click({ force: true });
  41. cy.get(".file-uploader").findByText("Link").click();
  42. cy.get(".input-group > .form-control").type(
  43. "https://wallpaperplay.com/walls/full/8/2/b/72402.jpg"
  44. );
  45. cy.click_modal_primary_button("Upload");
  46. //To check if the added file is present in the Test Folder
  47. cy.visit("/app/file/view/home/Attachments");
  48. cy.wait(500);
  49. cy.get("span.level-item > a > span").should("contain", "Test Folder");
  50. cy.visit("/app/file/view/home/Attachments/Test%20Folder");
  51. cy.wait(500);
  52. cy.get(".list-row-container").eq(0).should("contain.text", "72402.jpg");
  53. cy.get(".list-row-checkbox").eq(0).click();
  54. cy.intercept({
  55. method: "POST",
  56. url: "api/method/frappe.desk.reportview.delete_items",
  57. }).as("file_deleted");
  58. //Deleting the added file from the Test folder
  59. cy.click_action_button("Delete");
  60. cy.click_modal_primary_button("Yes");
  61. cy.wait("@file_deleted");
  62. //Deleting the Test Folder
  63. cy.visit("/app/file/view/home/Attachments");
  64. cy.get(".list-row-checkbox").eq(0).click();
  65. cy.click_action_button("Delete");
  66. cy.click_modal_primary_button("Yes");
  67. cy.wait("@file_deleted");
  68. });
  69. it("Deleting Test Folder from the home", () => {
  70. //Deleting the Test Folder added in the home directory
  71. cy.visit("/app/file/view/home");
  72. cy.get(".level-left > .list-subject > .file-select >.list-row-checkbox")
  73. .eq(0)
  74. .click({ force: true, delay: 500 });
  75. cy.click_action_button("Delete");
  76. cy.click_modal_primary_button("Yes");
  77. });
  78. });