Upstream sync
This commit is contained in:
@@ -11,11 +11,12 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
sign_in(current_user)
|
||||
end
|
||||
|
||||
scenario 'splash page is shown if tehre are no contract templates' do
|
||||
scenario 'splash page is shown if there are no contract templates' do
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_content schedule_demo
|
||||
expect(page).to have_content create_release_template
|
||||
expect(page).to have_content import_release_template
|
||||
end
|
||||
|
||||
scenario 'creating a new release template' do
|
||||
@@ -30,7 +31,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
fill_in 'Describe other territory', with: 'North America only'
|
||||
select 'In perpetuity', from: 'Term'
|
||||
select 'None', from: 'Restriction'
|
||||
click_on 'Create Release Template'
|
||||
click_on create_release_template_button
|
||||
|
||||
expect(page).to have_content(create_contract_template_success_message)
|
||||
end
|
||||
@@ -48,18 +49,30 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
fill_in_trix signature_legal_text_field, with: 'LL'
|
||||
|
||||
expect do
|
||||
click_on 'Create Release Template'
|
||||
click_on create_release_template_button
|
||||
end.to change(ContractTemplate, :count).by(1)
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'location release template has a amendment clause field' do
|
||||
visit new_project_contract_template_path(project)
|
||||
|
||||
fill_in 'Name', with: 'My Release Template'
|
||||
select 'Location Release', from: 'Release type'
|
||||
fill_hidden amendment_clause_field, with: 'Amendment clause text'
|
||||
click_on create_release_template_button
|
||||
|
||||
expect(page).to have_content(create_contract_template_success_message)
|
||||
expect(ContractTemplate.last.amendment_clause.body.to_s).to match /Amendment clause text/
|
||||
end
|
||||
|
||||
scenario 'medical release template has a guardian clause field' do
|
||||
visit new_project_contract_template_path(project)
|
||||
|
||||
fill_in 'Name', with: 'My Release Template'
|
||||
select 'Medical Release', from: 'Release type'
|
||||
fill_hidden guardian_clause_field, with: 'Guardian clause text'
|
||||
click_on 'Create Release Template'
|
||||
click_on create_release_template_button
|
||||
|
||||
expect(page).to have_content(create_contract_template_success_message)
|
||||
expect(ContractTemplate.last.guardian_clause.body.to_s).to match /Guardian clause text/
|
||||
@@ -78,7 +91,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
|
||||
fill_in_trix 'contract_template_guardian_clause', with: 'Guardian clause text'
|
||||
fill_in question_field(1), with: 'How much experience do you have in the industry?'
|
||||
click_on 'Create Release Template'
|
||||
click_on create_release_template_button
|
||||
|
||||
expect(page).to have_content(create_contract_template_success_message)
|
||||
end
|
||||
@@ -185,13 +198,13 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
|
||||
scenario 'Should not allow negative fees' do
|
||||
fill_in 'Fee', with: '-200'
|
||||
click_on 'Create Release Template'
|
||||
click_on create_release_template_button
|
||||
expect(page).not_to have_content(create_contract_template_success_message)
|
||||
end
|
||||
|
||||
scenario 'Should not allow fees with more than 9 digits' do
|
||||
fill_in 'Fee', with: '9999999999'
|
||||
click_on 'Create Release Template'
|
||||
click_on create_release_template_button
|
||||
expect(page).not_to have_content(create_contract_template_success_message)
|
||||
end
|
||||
end
|
||||
@@ -366,6 +379,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
|
||||
expect(page).to have_content schedule_demo
|
||||
expect(page).not_to have_content create_release_template
|
||||
expect(page).not_to have_content import_release_template
|
||||
end
|
||||
|
||||
it 'does not show edit button' do
|
||||
@@ -397,11 +411,12 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
expect(page).to have_content('Delete')
|
||||
end
|
||||
|
||||
it 'does not show create release button on splash page' do
|
||||
it 'shows create release button on splash page' do
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_content schedule_demo
|
||||
expect(page).to have_content create_release_template
|
||||
expect(page).to have_content import_release_template
|
||||
end
|
||||
|
||||
it 'shows edit button when contract template is not signed' do
|
||||
@@ -465,6 +480,10 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
'contract_template_guardian_clause_trix_input_contract_template'
|
||||
end
|
||||
|
||||
def amendment_clause_field
|
||||
'contract_template_amendment_clause_trix_input_contract_template'
|
||||
end
|
||||
|
||||
def signature_legal_text_field
|
||||
'contract_template_signature_legal_text'
|
||||
end
|
||||
@@ -489,6 +508,10 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
t 'contract_templates.splash.actions.create_template'
|
||||
end
|
||||
|
||||
def import_release_template
|
||||
t 'contract_templates.splash.actions.import_template'
|
||||
end
|
||||
|
||||
def signature_legal_text_trix_field
|
||||
'Signature legal text'
|
||||
end
|
||||
@@ -516,4 +539,8 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
def duplicate_release_name(template_name = '')
|
||||
t 'contract_templates.duplicate.name_prefix', template_name: template_name
|
||||
end
|
||||
|
||||
def create_release_template_button
|
||||
'Create Release Template'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,7 +93,7 @@ feature 'User managing broadcasts' do
|
||||
BroadcastsChannel.broadcast_stream_updates(broadcast)
|
||||
|
||||
expect(page).to have_content stream_begun_message
|
||||
expect(page).to have_selector('div#broadcast_video', count: 1)
|
||||
expect(page).to have_selector('div#broadcast_video', count: 2)
|
||||
|
||||
broadcast.streamer_status = :idle
|
||||
broadcast.status = :idle
|
||||
@@ -164,6 +164,21 @@ feature 'User managing broadcasts' do
|
||||
click_on add_file_button
|
||||
end
|
||||
|
||||
scenario 'manager user can click delete button next to the file and delete file', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 3
|
||||
|
||||
accept_alert do
|
||||
first('a', text: delete_file_button).click
|
||||
end
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 2
|
||||
expect(Broadcast.find(broadcast.id).files.count).to eq 2
|
||||
end
|
||||
|
||||
scenario 'visit multi-view broadcast page', js: true do
|
||||
broadcast_one = create(:broadcast, :with_stream, :with_files, name: 'Broadcast 1', project: project)
|
||||
broadcast_two = create(:broadcast, :with_stream, :with_files, name: 'Broadcast 2', project: project)
|
||||
@@ -198,6 +213,14 @@ feature 'User managing broadcasts' do
|
||||
expect(page).to have_content schedule_demo
|
||||
expect(page).not_to have_content create_stream
|
||||
end
|
||||
|
||||
scenario 'associate user does not see delete button next to the file', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 0
|
||||
end
|
||||
end
|
||||
|
||||
context 'When the user is account manager' do
|
||||
@@ -209,6 +232,21 @@ feature 'User managing broadcasts' do
|
||||
expect(page).to have_content schedule_demo
|
||||
expect(page).to have_content create_stream
|
||||
end
|
||||
|
||||
scenario 'account manager user can click delete button next to the file and delete file', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 3
|
||||
|
||||
accept_alert do
|
||||
first('a', text: delete_file_button).click
|
||||
end
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 2
|
||||
expect(Broadcast.find(broadcast.id).files.count).to eq 2
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -262,5 +300,9 @@ feature 'User managing broadcasts' do
|
||||
'Live stream is waiting to begin'
|
||||
end
|
||||
|
||||
def delete_file_button
|
||||
t 'broadcasts.file.actions.delete_file'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -78,6 +78,47 @@ feature "User managing location releases" do
|
||||
|
||||
expect(page).to have_content dummy_signature_legal_text
|
||||
end
|
||||
|
||||
scenario "signing amendment for a not-signed amendment release", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_falsey
|
||||
|
||||
visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).to have_content amendments_heading
|
||||
|
||||
fill_in amendment_signer_name_field, with: 'Big Signer'
|
||||
draw_signature file_fixture("signature.png"), amendment_signature_field
|
||||
|
||||
click_button sign_amendment_button
|
||||
|
||||
expect(page).to have_content signed_successfully_message
|
||||
expect(LocationRelease.find(release.id).amendment_signed?).to be_truthy
|
||||
end
|
||||
|
||||
scenario "opening signing amendment page for a signed amendment release shows already signed message", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, :amendment_signed, contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_truthy
|
||||
|
||||
visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).not_to have_content amendments_heading
|
||||
expect(page).not_to have_content signed_successfully_message
|
||||
expect(page).to have_content already_signed_message
|
||||
end
|
||||
|
||||
scenario "amendment signing form has copy URL button" do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, contract_template: contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).to have_content copy_url_button
|
||||
end
|
||||
end
|
||||
|
||||
context "when signed in" do
|
||||
@@ -108,9 +149,9 @@ feature "User managing location releases" do
|
||||
fill_in filming_hours_field, with: "04:00 - 22:00"
|
||||
click_button create_release_button
|
||||
expect(page).to have_content(create_release_notice)
|
||||
expect(page).to have_photo("location_photo.png")
|
||||
expect(page).to have_photo("location_photo.png", visible: :all)
|
||||
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
expect(page).to have_link("Download")
|
||||
end
|
||||
end
|
||||
@@ -119,7 +160,7 @@ feature "User managing location releases" do
|
||||
location_release = create(:location_release_with_photo, :non_native, project: project)
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
click_link *update_location_release_link(location_release)
|
||||
|
||||
within ".dropzone" do
|
||||
@@ -139,7 +180,7 @@ feature "User managing location releases" do
|
||||
location_release = create(:location_release, project: project)
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
|
||||
accept_alert do
|
||||
click_link *destroy_location_release_link(location_release)
|
||||
@@ -172,7 +213,7 @@ feature "User managing location releases" do
|
||||
|
||||
expect(page).to have_content("Needs Photo")
|
||||
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
click_on "Photos"
|
||||
|
||||
expect(page).to have_content("Add Photos")
|
||||
@@ -182,11 +223,85 @@ feature "User managing location releases" do
|
||||
click_on "Save Changes"
|
||||
|
||||
expect(page).to have_content("The release has been updated")
|
||||
expect(page).to have_photo("location_photo.png")
|
||||
expect(page).to have_photo("location_photo.png", visible: :all)
|
||||
end
|
||||
|
||||
scenario "signing amendment for a not-signed amendment release", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, name: "Test Loc", contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_falsey
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Test Loc"
|
||||
|
||||
click_on manage_button
|
||||
|
||||
expect(page).to have_link sign_amendment_link
|
||||
|
||||
new_window = window_opened_by { click_link sign_amendment_link }
|
||||
within_window new_window do
|
||||
expect(page).to have_content amendments_heading
|
||||
|
||||
fill_in amendment_signer_name_field, with: 'Big Signer'
|
||||
draw_signature file_fixture("signature.png"), amendment_signature_field
|
||||
|
||||
click_button sign_amendment_button
|
||||
|
||||
expect(page).to have_content signed_successfully_message
|
||||
expect(LocationRelease.find(release.id).amendment_signed?).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
scenario "signed amendment release does not have sign amendment option in manage dropdown", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, :amendment_signed, name: "Test Loc", contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_truthy
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Test Loc"
|
||||
|
||||
click_on manage_button
|
||||
|
||||
expect(page).not_to have_link sign_amendment_link
|
||||
end
|
||||
|
||||
scenario "signed amendment release have checked box in location releases index table", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
not_signed_release = create(:location_release, name: "Not Yet Loc", contract_template: contract_template, project: project)
|
||||
expect(not_signed_release.amendment_signed?).to be_falsey
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Not Yet Loc"
|
||||
expect(page).to have_css('i.fa.fa-square-o', count: 1)
|
||||
expect(page).to have_css('i.fa.fa-check-square', count: 0)
|
||||
|
||||
signed_release = create(:location_release, :amendment_signed, name: "Signed A Loc", contract_template: contract_template, project: project)
|
||||
expect(signed_release.amendment_signed?).to be_truthy
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Signed A Loc"
|
||||
|
||||
expect(page).to have_css('i.fa.fa-square-o', count: 1)
|
||||
expect(page).to have_css('i.fa.fa-check-square-o', count: 1)
|
||||
end
|
||||
|
||||
scenario "amendment signing form has copy URL button when user is signed in", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, contract_template: contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).to have_content copy_url_button
|
||||
end
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF" do
|
||||
scenario "viewing the contract PDF when amendment is not yet signed" do
|
||||
location_release = create(:location_release_with_contract_template_and_photo,
|
||||
:native,
|
||||
project: project,
|
||||
@@ -198,16 +313,13 @@ feature "User managing location releases" do
|
||||
content: "Note 1",
|
||||
user: build(:user, email: "jane.doe@test.com"),
|
||||
email: "jane.doe@test.com",
|
||||
created_at: DateTime.new(2020, 2, 21, 12, 0, 0),
|
||||
),
|
||||
created_at: DateTime.new(2020, 2, 21, 12, 0, 0),),
|
||||
build(:note,
|
||||
content: "Note 2",
|
||||
user: build(:user, email: "john.doe@test.com"),
|
||||
email: "john.doe@test.com",
|
||||
created_at: DateTime.new(2020, 2, 20, 11, 0, 0),
|
||||
),
|
||||
]
|
||||
)
|
||||
created_at: DateTime.new(2020, 2, 20, 11, 0, 0),),
|
||||
])
|
||||
|
||||
sign_in(current_user)
|
||||
visit project_location_releases_path(project)
|
||||
@@ -216,6 +328,8 @@ feature "User managing location releases" do
|
||||
expect(content_type).to eq("application/pdf")
|
||||
expect(content_disposition).to include("inline")
|
||||
expect(pdf_filename).to include("benny-s-burritos")
|
||||
|
||||
expect(pdf_body).not_to have_content amendment_page_heading
|
||||
expect(pdf_body).to have_content("Benny's Burritos")
|
||||
expect(pdf_body).to have_content("NOTES")
|
||||
expect(pdf_body).to have_content("Note 1")
|
||||
@@ -232,6 +346,34 @@ feature "User managing location releases" do
|
||||
expect(pdf_body).to have_content("06:00 - 20:00")
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF when amendment is signed" do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
location_release = create(:location_release,
|
||||
:amendment_signed,
|
||||
:native,
|
||||
contract_template: contract_template,
|
||||
project: project,
|
||||
name: "Test Loc")
|
||||
|
||||
sign_in(current_user)
|
||||
visit project_location_releases_path(project)
|
||||
click_link *view_release_pdf_link_for(location_release)
|
||||
|
||||
expect(content_type).to eq("application/pdf")
|
||||
expect(content_disposition).to include("inline")
|
||||
expect(pdf_filename).to include("test-loc")
|
||||
|
||||
expect(pdf_body).to have_content("Test Loc")
|
||||
|
||||
expect(pdf_body).to have_content amendment_page_heading
|
||||
expect(pdf_body).to have_content amendment_clause_label
|
||||
expect(pdf_body).to have_content amendment_signer_name_label
|
||||
expect(pdf_body).to have_content amendment_signature_label
|
||||
|
||||
expect(pdf_body).to have_content contract_template.amendment_clause.to_plain_text
|
||||
expect(pdf_body).to have_content location_release.amendment_signer_name
|
||||
end
|
||||
|
||||
context "when the user is account manager" do
|
||||
let(:current_user) { create(:user, :account_manager) }
|
||||
|
||||
@@ -327,7 +469,7 @@ feature "User managing location releases" do
|
||||
create(:location_release_with_contract_template, :native, project: project)
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
|
||||
expect(page).not_to have_link(review_action, exact: true)
|
||||
end
|
||||
@@ -345,7 +487,7 @@ feature "User managing location releases" do
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
expect(page).not_to have_link("Download", exact: true)
|
||||
end
|
||||
|
||||
@@ -353,7 +495,7 @@ feature "User managing location releases" do
|
||||
create(:location_release_with_contract_template, :native, project: project)
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
|
||||
expect(page).not_to have_link(review_action, exact: true)
|
||||
end
|
||||
@@ -437,8 +579,8 @@ feature "User managing location releases" do
|
||||
"location_release[filming_hours]"
|
||||
end
|
||||
|
||||
def have_photo(filename, attr: "src")
|
||||
have_selector("img[#{attr}*='#{filename}']")
|
||||
def have_photo(filename, attr: "src", visible: true)
|
||||
have_selector("img[#{attr}*='#{filename}']", visible: visible)
|
||||
end
|
||||
|
||||
def import_location_release_link(project)
|
||||
@@ -535,4 +677,56 @@ feature "User managing location releases" do
|
||||
def date_issued
|
||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
||||
end
|
||||
|
||||
def amendments_heading
|
||||
t 'public.amendments.new.amendment.heading'
|
||||
end
|
||||
|
||||
def amendment_signer_name_field
|
||||
'location_release[amendment_signer_name]'
|
||||
end
|
||||
|
||||
def amendment_signature_field
|
||||
'location_release_amendment_signature_base64'
|
||||
end
|
||||
|
||||
def sign_amendment_button
|
||||
t 'shared.submit_release_long'
|
||||
end
|
||||
|
||||
def already_signed_message
|
||||
t 'public.amendments.create.amendment_already_signed_message'
|
||||
end
|
||||
|
||||
def signed_successfully_message
|
||||
t 'public.amendments.create.amendment_signed_message'
|
||||
end
|
||||
|
||||
def manage_button
|
||||
t 'location_releases.location_release.actions.manage'
|
||||
end
|
||||
|
||||
def sign_amendment_link
|
||||
t 'location_releases.location_release.actions.sign_amendment'
|
||||
end
|
||||
|
||||
def copy_url_button
|
||||
t 'public.amendments.new.copy_url'
|
||||
end
|
||||
|
||||
def amendment_page_heading
|
||||
t 'contracts.amendment_page.heading'
|
||||
end
|
||||
|
||||
def amendment_signer_name_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_signer_name'
|
||||
end
|
||||
|
||||
def amendment_clause_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_clause'
|
||||
end
|
||||
|
||||
def amendment_signature_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_signature'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user