Files
docuseal/spec/system/template_builder_spec.rb
T

33 lines
974 B
Ruby
Raw Normal View History

2025-05-13 21:27:40 +03:00
# frozen_string_literal: true
RSpec.describe 'Template Builder' do
let(:account) { create(:account) }
let(:author) { create(:user, account:) }
let(:template) { create(:template, account:, author:, attachment_count: 3, except_field_types: %w[phone payment]) }
before do
sign_in(author)
end
context 'when manage template documents' do
before do
visit edit_template_path(template)
end
it 'replaces the document' do
doc = find("div[id='documents_container'] div[data-document-uuid='#{template.schema[1]['attachment_uuid']}'")
doc.click
expect do
2025-05-14 13:11:12 +03:00
doc.find('.replace-document-button').click
2026-06-04 00:35:04 +03:00
doc.find('.replace-document-control input[type="file"]', visible: false)
2025-05-14 13:11:12 +03:00
.attach_file(Rails.root.join('spec/fixtures/sample-image.png'))
page.driver.wait_for_network_idle
2025-05-13 21:27:40 +03:00
end.to change { template.documents.count }.by(1)
2025-05-14 13:11:12 +03:00
expect(page).to have_content('sample-image')
2025-05-13 21:27:40 +03:00
end
end
end