preferences_token_access_test.rb 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class PreferencesTokenAccessTest < TestCase
  4. def test_token_access
  5. @browser = browser_instance
  6. login(
  7. username: 'agent1@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. click(css: 'a[href="#current_user"]')
  13. click(css: 'a[href="#profile"]')
  14. click(css: 'a[href="#profile/token_access"]')
  15. click(css: '.content.active .js-create')
  16. watch_for(
  17. css: '.modal .modal-title',
  18. value: 'Add a Personal Access Token'
  19. )
  20. set(
  21. css: '.content.active .modal .js-input',
  22. value: 'Some App#1',
  23. )
  24. set(
  25. css: '.content.active .modal .js-datepicker',
  26. value: '05/15/2022',
  27. )
  28. sendkey(value: :tab)
  29. click(css: '.content.active .modal input[value="ticket.agent"] ~ .label-text')
  30. click(css: '.content.active .modal .js-submit')
  31. watch_for(
  32. css: '.modal .modal-title',
  33. value: 'Your New Personal Access Token'
  34. )
  35. click(css: '.modal .js-submit')
  36. watch_for(
  37. css: '.content.active .js-tokenList',
  38. value: 'Some App#1'
  39. )
  40. watch_for(
  41. css: '.content.active .js-tokenList',
  42. value: '05/15/2022'
  43. )
  44. click(css: '.content.active .js-create')
  45. watch_for(
  46. css: '.modal .modal-title',
  47. value: 'Add a Personal Access Token'
  48. )
  49. set(
  50. css: '.content.active .modal .js-input',
  51. value: 'Some App#2',
  52. )
  53. click(css: '.content.active .modal input[value="ticket.agent"] ~ .label-text')
  54. click(css: '.content.active .modal .js-submit')
  55. watch_for(
  56. css: '.modal .modal-title',
  57. value: 'Your New Personal Access Token'
  58. )
  59. click(css: '.modal .js-submit')
  60. watch_for(
  61. css: '.content.active .js-tokenList',
  62. value: 'Some App#2'
  63. )
  64. click(css: '.content.active .js-tokenList a')
  65. watch_for(
  66. css: '.content.active .modal .modal-header',
  67. value: 'confirm',
  68. )
  69. click(
  70. css: '.content.active .modal .js-submit',
  71. )
  72. watch_for_disappear(
  73. css: '.content.active .js-tokenList',
  74. value: 'Some App#2'
  75. )
  76. end
  77. end