preferences_token_access_test.rb 2.0 KB

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