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.
 
 
 
 
 
 

42 line
1.4 KiB

  1. context.skip("Permissions API", () => {
  2. before(() => {
  3. cy.visit("/login");
  4. cy.remove_role("xhiveframework@example.com", "System Manager");
  5. cy.visit("/app");
  6. });
  7. it("Checks permissions via `has_perm` for Kanban Board DocType", () => {
  8. cy.visit("/app/kanban-board/view/list");
  9. cy.window()
  10. .its("xhiveframework")
  11. .then((xhiveframework) => {
  12. xhiveframework.model.with_doctype("Kanban Board", function () {
  13. // needed to make sure doc meta is loaded
  14. expect(xhiveframework.perm.has_perm("Kanban Board", 0, "read")).to.equal(true);
  15. expect(xhiveframework.perm.has_perm("Kanban Board", 0, "write")).to.equal(true);
  16. expect(xhiveframework.perm.has_perm("Kanban Board", 0, "print")).to.equal(false);
  17. });
  18. });
  19. });
  20. it("Checks permissions via `get_perm` for Kanban Board DocType", () => {
  21. cy.visit("/app/kanban-board/view/list");
  22. cy.window()
  23. .its("xhiveframework")
  24. .then((xhiveframework) => {
  25. xhiveframework.model.with_doctype("Kanban Board", function () {
  26. // needed to make sure doc meta is loaded
  27. const perms = xhiveframework.perm.get_perm("Kanban Board");
  28. expect(perms.read).to.equal(true);
  29. expect(perms.write).to.equal(true);
  30. expect(perms.rights_without_if_owner).to.include("read");
  31. });
  32. });
  33. });
  34. after(() => {
  35. cy.add_role("xhiveframework@example.com", "System Manager");
  36. cy.call("logout");
  37. });
  38. });