public_links_spec.rb 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Manage > Public Links', type: :system do
  4. context 'when creating a new public link' do
  5. it 'successfully creates a new public link' do
  6. visit '/#manage/public_links'
  7. click_on 'New Public Link'
  8. in_modal do
  9. fill_in 'link', with: 'https://zammad.org'
  10. fill_in 'title', with: 'Zammad <3'
  11. click_on 'Submit'
  12. end
  13. expect(page).to have_text('Zammad <3')
  14. end
  15. end
  16. context 'when performing different actions on a public link' do
  17. let(:public_link) { create(:public_link) }
  18. before do
  19. public_link
  20. visit '/#manage/public_links'
  21. end
  22. context 'when updating an existing public link' do
  23. it 'successfully updates an existing public link' do
  24. expect(page).to have_text('Zammad Homepage')
  25. find('td', text: 'Zammad Homepage').click
  26. in_modal do
  27. fill_in 'title', with: 'Zammad <3'
  28. click_on 'Submit'
  29. end
  30. expect(page).to have_text('Zammad <3')
  31. end
  32. end
  33. context 'when cloning an existing public link' do
  34. it 'successfully clones an existing public link' do
  35. expect(page).to have_text('Zammad Homepage')
  36. row = find('tr', text: 'Zammad Homepage')
  37. row.find('.js-action').click
  38. row.find('.js-clone').click
  39. in_modal do
  40. fill_in 'title', with: 'Zammad <3'
  41. fill_in 'link', with: 'https://zammad.org'
  42. click_on 'Submit'
  43. end
  44. expect(page).to have_text('Zammad Homepage')
  45. expect(page).to have_text('Zammad <3')
  46. end
  47. end
  48. context 'when deleting an existing public link' do
  49. it 'successfully deletes an existing public link' do
  50. expect(page).to have_text('Zammad Homepage')
  51. row = find('tr', text: 'Zammad Homepage')
  52. row.find('.js-action').click
  53. row.find('.js-delete').click
  54. in_modal do
  55. click_on 'delete'
  56. end
  57. expect(page).to have_no_text('Zammad Homepage')
  58. end
  59. end
  60. end
  61. end