yashaka

Untitled

Feb 6th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. @Step
  2. public NewEmail withRecipients(String... recipients) {
  3. for (String recipient : recipients) {
  4. $$(".GS .eV").filter(Condition.visible).first().find(".oj .vO")
  5. .setValue(recipient)
  6. .pressEnter();
  7. } return this;
  8. }
  9.  
  10. ретурн на новую строку лучше же перенести ) я так понимаю очепятка
  11.  
  12. ***
  13.  
  14. public class LoginPage {
  15.  
  16. @Step
  17. public void ensureLoggedAs(String email, String password) {
  18. $("#Email").setValue(email).pressEnter();
  19. $("#Passwd").setValue(password).pressEnter();
  20. $(".cmsg").waitUntil(hidden, 15_000);
  21. }
  22.  
  23. }
  24.  
  25. поднимая снова тему о "эншурности"
  26.  
  27. я бы тут убрал еншуре вместе с вейтом...
  28.  
  29. а еншуре версию метода встроил бы таки в Application
  30.  
  31. и там бы и добавил еще и проверку не залогинены ли мы уже, ведь если да, то незачем и логин делать еще раз...
  32.  
  33. у тебя кстати этой проверку тут и нет:
  34.  
  35. public void ensureLoggedAs(String email, String password) {
  36. new LoginPage().ensureLoggedAs(email, password);
  37. }
  38.  
  39.  
  40. а это уже не сильно хорошо... потому что он на то и еншуре - что должен все быть "приводить к цели как можно более эффективно..."
  41.  
  42. ***
  43.  
  44. плюс почему не:
  45.  
  46. public void ensureLoggedAs(String email, String password) {
  47. this.atLoginPage().ensureLoggedAs(email, password);
  48. }
  49. ?
  50.  
  51. (ну this писать/не писать - то уже такое, дело вкуса)
  52.  
  53.  
  54. ***
  55.  
  56. @Step
  57. public Emails emails() {
  58. return Emails.all();
  59. }
  60.  
  61. @Step
  62. public Emails unreadedEmails() {
  63. return Emails.unreaded();
  64. }
  65.  
  66. @Step
  67. public Emails readedEmails() {
  68. return Emails.readed();
  69. }
  70.  
  71. все ок, но просто как идея еще одного варианта апи:
  72.  
  73. просто
  74.  
  75. @Step
  76. public Emails emails() {
  77. return new Emails();
  78. }
  79.  
  80. но потом можно:
  81.  
  82. emails().unreaded()
  83. emails().readed()
  84.  
  85. ну эт такое... я еще сам не уверен что так было бы лучше.... нужно пробовать...
Advertisement
Add Comment
Please, Sign In to add comment