Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

passwordGeneration.spec.js 5.2 KiB

pirms 4 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. describe("Password Generation", function() {
  2. it("can't decrease counter under 0", function() {
  3. cy.visit("/");
  4. cy.wait(500);
  5. cy.get("#decreaseCounter__btn").click();
  6. cy.get("#decreaseCounter__btn").click();
  7. cy.get("#passwordCounter").should("have.value", "1");
  8. });
  9. it("should generate the appropriate password", function() {
  10. function clickAndAssertOption(cy, button, password1, password2) {
  11. cy.get(button).click();
  12. cy.get("#generatePassword__btn").click();
  13. cy.get("#generated-password").should("have.value", password1);
  14. cy.get(button).click();
  15. cy.get("#generatePassword__btn").click();
  16. cy.get("#generated-password").should("have.value", password2);
  17. }
  18. cy.visit("/");
  19. cy.wait(500);
  20. cy.get("#siteField")
  21. .type("lesspass.com")
  22. .tab();
  23. cy.get("#login").type("test@lesspass.com");
  24. cy.get("#passwordField").type("test@lesspass.com");
  25. cy.wait(500);
  26. cy.get("#fingerprint .fa-cutlery").should("be.visible");
  27. cy.get("#fingerprint .fa-subway").should("be.visible");
  28. cy.get("#fingerprint .fa-plane").should("be.visible");
  29. cy.get("#generatePassword__btn").click();
  30. cy.get("#generated-password").should("have.value", "hjV@\\5ULp3bIs,6B");
  31. cy.get("#decreaseLength__btn").click();
  32. cy.get("#passwordLength").should("have.value", "15");
  33. cy.get("#increaseLength__btn").click();
  34. cy.get("#increaseLength__btn").click();
  35. cy.get("#passwordLength").should("have.value", "17");
  36. cy.get("#generatePassword__btn").click();
  37. cy.get("#generated-password").should("have.value", "hj@r\\ULp3Is62@HB~");
  38. cy.get("#decreaseLength__btn").click();
  39. cy.get("#passwordLength").should("have.value", "16");
  40. cy.get("#increaseCounter__btn").click();
  41. cy.get("#passwordCounter").should("have.value", "2");
  42. cy.get("#generatePassword__btn").click();
  43. cy.get("#generated-password").should("have.value", "#wOxv!q;URh:k82(");
  44. cy.get("#passwordCounter")
  45. .clear()
  46. .type("1");
  47. clickAndAssertOption(
  48. cy,
  49. "#lowercase__btn",
  50. "^>_9>+}OV?[3[_U,",
  51. "hjV@\\5ULp3bIs,6B"
  52. );
  53. clickAndAssertOption(
  54. cy,
  55. "#uppercase__btn",
  56. "^>_9>+}ov?[3[_u,",
  57. "hjV@\\5ULp3bIs,6B"
  58. );
  59. clickAndAssertOption(
  60. cy,
  61. "#numbers__btn",
  62. 'jCmMpNy=T."+u^ZQ',
  63. "hjV@\\5ULp3bIs,6B"
  64. );
  65. clickAndAssertOption(
  66. cy,
  67. "#symbols__btn",
  68. "XAwlOl5mtjGSY6PA",
  69. "hjV@\\5ULp3bIs,6B"
  70. );
  71. });
  72. it("should have a min length of 5 and max length of 35", function() {
  73. cy.visit("/");
  74. cy.wait(500);
  75. cy.get("#passwordLength")
  76. .clear()
  77. .type("35");
  78. cy.get("#increaseLength__btn").click();
  79. cy.get("#passwordLength").should("have.value", "35");
  80. cy.get("#passwordLength")
  81. .clear()
  82. .type("5");
  83. cy.get("#decreaseLength__btn").click();
  84. cy.get("#passwordLength").should("have.value", "5");
  85. });
  86. it("should consider counter as string not hex value nrt_328", function() {
  87. cy.visit("/");
  88. cy.wait(500);
  89. cy.get("#siteField").type("site");
  90. cy.get("#login").type("login");
  91. cy.get("#passwordField").type("test");
  92. cy.get("#passwordCounter")
  93. .clear()
  94. .type("10");
  95. cy.get("#generatePassword__btn").click();
  96. cy.get("#generated-password").should("have.value", "XFt0F*,r619:+}[.");
  97. });
  98. it("should generate password when hit enter nrt_266", function() {
  99. cy.visit("/");
  100. cy.wait(500);
  101. cy.get("#siteField")
  102. .type("lesspass.com")
  103. .tab();
  104. cy.get("#login").type("test@lesspass.com");
  105. cy.get("#passwordField")
  106. .type("test@lesspass.com")
  107. .type("{enter}");
  108. cy.get("#generated-password").should("have.value", "hjV@\\5ULp3bIs,6B");
  109. });
  110. it("should keep site field in sync nrt_441", function() {
  111. cy.visit("/");
  112. cy.wait(500);
  113. cy.get("#login").type("user");
  114. cy.get("#passwordField").type("password");
  115. cy.get("#siteField")
  116. .type("subdomain.domain.com")
  117. .type("{home}")
  118. .type("{rightarrow}")
  119. .type("{backspace}")
  120. .type("{downarrow}")
  121. .type("{downarrow}")
  122. .type("{enter}");
  123. cy.get("#generatePassword__btn").click();
  124. cy.get("#generated-password").should("have.value", "ZT^IK2e!t@k$9`*)");
  125. });
  126. it("should clear password generated when master password change", function() {
  127. cy.visit("/");
  128. cy.wait(500);
  129. cy.get("#siteField")
  130. .type("example.org")
  131. .tab();
  132. cy.get("#login").type("user");
  133. cy.get("#passwordField").type("password");
  134. cy.get("#generatePassword__btn").should("be.visible");
  135. cy.get("#generatePassword__btn").click();
  136. cy.get("#copyPasswordButton").should("be.visible");
  137. cy.get("#generatePassword__btn").should("not.exist");
  138. cy.get("#passwordField").type("password");
  139. cy.get("#copyPasswordButton").should("not.be.visible");
  140. cy.get("#generatePassword__btn").should("be.visible");
  141. });
  142. it("should generate password with 2 tabs and enter", function() {
  143. cy.visit("/");
  144. cy.wait(500);
  145. cy.get("#siteField")
  146. .type("lesspass.com")
  147. .tab()
  148. .type("test@lesspass.com")
  149. .tab()
  150. .type("test@lesspass.com")
  151. .type("{enter}");
  152. cy.get("#generated-password").should("have.value", "hjV@\\5ULp3bIs,6B");
  153. });
  154. });