25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

90 satır
3.0 KiB

  1. const getLogin = () => cy.get("#login");
  2. const getLowercase = () => cy.get("#options #lowercase__btn");
  3. const getUppercase = () => cy.get("#options #uppercase__btn");
  4. const getNumbers = () => cy.get("#options #numbers__btn");
  5. const getSymbols = () => cy.get("#options #symbols__btn");
  6. const getLength = () => cy.get("#options #passwordLength");
  7. const getCounter = () => cy.get("#options #passwordCounter");
  8. const getBaseURL = () => cy.get("#baseURL");
  9. const encryptMasterPassword = () => cy.get("#encryptMasterPassword");
  10. describe("Settings", function() {
  11. it("should start with default values", () => {
  12. cy.visit("/#/settings");
  13. getLogin().should("have.value", "");
  14. getLowercase().should("be.checked");
  15. getUppercase().should("be.checked");
  16. getNumbers().should("be.checked");
  17. getSymbols().should("be.checked");
  18. getLength().should("have.value", "16");
  19. getCounter().should("have.value", "1");
  20. getBaseURL().should("have.value", "https://api.lesspass.com");
  21. encryptMasterPassword().should("be.checked");
  22. });
  23. it("should redirect to the home page when saving", () => {
  24. cy.visit("/#/settings");
  25. cy.get("#btn-submit-settings").click();
  26. cy.location().should(location => {
  27. expect(location.pathname).to.eq("/");
  28. });
  29. });
  30. it("should update the password generator page after changing the settings", () => {
  31. cy.visit("/#/settings");
  32. getLogin()
  33. .clear()
  34. .type("New login");
  35. getLowercase().click();
  36. getUppercase().click();
  37. getNumbers().click();
  38. getSymbols().click();
  39. getLength()
  40. .clear()
  41. .type("5");
  42. getCounter()
  43. .clear()
  44. .type("2");
  45. cy.get("#btn-submit-settings").click();
  46. getLogin().should("have.value", "New login");
  47. getLowercase().should("not.be.checked");
  48. getUppercase().should("not.be.checked");
  49. getNumbers().should("not.be.checked");
  50. getSymbols().should("not.be.checked");
  51. getLength().should("have.value", "5");
  52. getCounter().should("have.value", "2");
  53. });
  54. it("should still show the saved settings when going back to the settings page", () => {
  55. cy.visit("/#/settings");
  56. getLogin()
  57. .clear()
  58. .type("New login");
  59. getLowercase().click();
  60. getUppercase().click();
  61. getNumbers().click();
  62. getSymbols().click();
  63. getLength()
  64. .clear()
  65. .type("5");
  66. getCounter()
  67. .clear()
  68. .type("2");
  69. getBaseURL()
  70. .clear()
  71. .type("https://api.example.org");
  72. encryptMasterPassword().click();
  73. cy.get("#btn-submit-settings").click();
  74. cy.visit("/#/settings");
  75. getLogin().should("have.value", "New login");
  76. getLowercase().should("not.be.checked");
  77. getUppercase().should("not.be.checked");
  78. getNumbers().should("not.be.checked");
  79. getSymbols().should("not.be.checked");
  80. getLength().should("have.value", "5");
  81. getCounter().should("have.value", "2");
  82. getBaseURL().should("have.value", "https://api.example.org");
  83. encryptMasterPassword().should("not.be.checked");
  84. });
  85. });