Sha256: 62f2527bf7fd3eaa1592a55eb5edd367d3f8348b5332732b21705a5ee91d6459

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

require 'rails_helper'

describe 'the Media', js: true do
  init_site

  it 'list media' do
    admin_sign_in
    visit "#{cama_root_relative_path}/admin/media"
    within '#cama_media_gallery' do
      execute_script('$(\'#cama_search_form .dropdown-toggle.btn\').click()')
      find('.add_folder').click
    end

    within '#add_folder_form' do
      fill_in 'folder', with: 'test_folder_created_by_testing'
      find('button[type="submit"]').click
      wait_for_ajax
    end
    expect(page).to have_content('test_folder_created_by_testing')

    within '#cama_media_gallery' do
      # access into inner folder
      page.execute_script('$(\'#cama_media_gallery .folder_item[data-key="test_folder_created_by_testing"]\').click()')
      wait_for_ajax
      # attach_file('cama-upload-files', Rails.root.join('config', 'system.json').to_s)

      within '#cama_media_external' do
        fill_in 'remote_file', with: 'https://upload.wikimedia.org/wikipedia/commons/1/15/Jpegvergroessert.jpg'
        find('button[type="submit"]').click
        wait_for_ajax
      end
    end

    # expect(page).to have_content('slider-camaleon.jpg')

    # delete uploaded file
    page.execute_script('$(\'#cama_media_gallery .file_item[data-key="slider_camaleon.jpg"] .del_item\').click()')
    confirm_dialog
    wait_for_ajax

    # back to root
    page.execute_script('$(\'#cama_media_gallery .media_folder_breadcrumb a:first\').click()')
    wait_for_ajax

    # delete folder
    page.execute_script('$(\'#cama_media_gallery .folder_item[data-key="test_folder_created_by_testing"] .del_folder\').click()')
    confirm_dialog
    wait_for_ajax
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
camaleon_cms-2.6.4 spec/features/admin/media_spec.rb