Taskme update

This commit is contained in:
Senad Uka
2020-06-30 05:08:23 +02:00
parent 1cd125382f
commit 71ad502cc1
210 changed files with 6316 additions and 766 deletions

View File

@@ -103,4 +103,16 @@ feature "User creates notes" do
it_behaves_like "a notable collection UI"
end
context "for medical releases" do
subject! { create(:medical_release, project: project, notes: []) }
it_behaves_like "a notable collection UI"
end
context "for misc releases" do
subject! { create(:misc_release, project: project, notes: []) }
it_behaves_like "a notable collection UI"
end
end

View File

@@ -86,4 +86,16 @@ feature "User creates tags" do
it_behaves_like "a taggable collection UI"
end
context "for medical releases" do
subject! { create(:medical_release, project: project, tags: []) }
it_behaves_like "a taggable collection UI"
end
context "for misc releases" do
subject! { create(:misc_release, project: project, tags: []) }
it_behaves_like "a taggable collection UI"
end
end

View File

@@ -5,6 +5,7 @@ require 'rails_helper'
RSpec.feature 'User manages contract templates', type: :feature do
let(:current_user) { create(:user, :manager) }
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
let(:project2) { create(:project, members: current_user, account: current_user.primary_account, name: 'New project') }
before do
sign_in(current_user)
@@ -27,6 +28,18 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(page).to have_content('The release template has been created')
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'
expect(page).to have_content('The release template has been created')
expect(ContractTemplate.last.guardian_clause.body.to_s).to match /Guardian clause text/
end
scenario 'preview new talent release template without guardian clause' do
visit new_project_contract_template_path(project)
select 'Talent Release', from: 'Release type'
@@ -191,6 +204,21 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(page).not_to have_content('Test template')
end
scenario 'archived contract templates from other projects are not shown when importing contract templates' do
create(:contract_template, :archived, project: project2, name: 'Archived template')
create(:contract_template, project: project2, name: 'Active template')
create(:contract_template, project: project)
visit project_contract_templates_path(project)
expect(page).to have_content('Test template')
click_on import_template_button
expect(page).not_to have_content('Test template')
expect(page).not_to have_content('Archived template')
expect(page).to have_content('Active template')
end
context 'When the user is associate' do
let(:current_user) { create(:user, :associate) }
@@ -198,7 +226,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
visit project_contract_templates_path(project)
expect(page).not_to have_content('Create New Release Template')
expect(page).not_to have_content('Import Release Template')
expect(page).not_to have_content(import_template_button)
expect(page).not_to have_content('Delete')
end
end
@@ -218,6 +246,14 @@ RSpec.feature 'User manages contract templates', type: :feature do
private
def import_template_button
t 'contract_templates.index.actions.import'
end
def import_selected_templates_button
t 'release_template_imports.new.actions.import'
end
def preview_heading
t 'blank_contracts.new.preview_heading'
end

View File

@@ -5,6 +5,13 @@ feature "User managing acquired_media releases" do
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
context "when signed out" do
scenario "United States is default country" do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
expect(country_field_value).to eq "US"
end
scenario "creating a release", js: true do
contract_template = create(:contract_template, project: project)
@@ -13,13 +20,24 @@ feature "User managing acquired_media releases" do
by "filling out the form" do
fill_in acquired_media_name_field, with: "Jane Doe"
acquired_media_category_fields
fill_in acquried_media_description_field, with: "Description"
fill_in acquried_media_owner_first_name, with: "Jane"
fill_in acquried_media_owner_last_name, with: "Doe"
fill_in acquired_media_person_title, with: "Ms."
fill_in acquired_media_person_phone, with: "555-5555-5555"
fill_in acquired_media_person_email, with: "person@example.com"
fill_in acquired_media_person_fax, with: "FAX"
fill_in acquired_media_person_address_street_1, with: "Street 1"
fill_in acquired_media_person_address_city, with: "City"
fill_in acquired_media_person_address_state, with: "State"
fill_in acquired_media_release_person_address_zip, with: "ZIP"
draw_signature file_fixture("signature.png"), "acquired_media_release_signature_base64"
end
click_button "I have read and agree to the above"
expect(AcquiredMediaRelease.last.categories).to include("Artwork")
expect(AcquiredMediaRelease.last.categories).to include("Video Footage")
expect(AcquiredMediaRelease.last.categories).to include("Still Photograph")
expect(page).to have_content("Your release was successfully submitted. Thank you.")
end
@@ -205,12 +223,60 @@ feature "User managing acquired_media releases" do
private
def country_field_value
find_field("acquired_media_release[person_address_country]").value
end
def acquired_media_name_field
"acquired_media_release[name]"
end
def acquried_media_description_field
"acquired_media_release[description]"
end
def acquried_media_owner_first_name
"acquired_media_release[person_first_name]"
end
def acquried_media_owner_last_name
"acquired_media_release[person_last_name]"
end
def acquired_media_person_title
"acquired_media_release[person_title]"
end
def acquired_media_person_phone
"acquired_media_release[person_phone]"
end
def acquired_media_person_email
"acquired_media_release[person_email]"
end
def acquired_media_person_fax
"acquired_media_release[person_fax]"
end
def acquired_media_person_address_street_1
"acquired_media_release[person_address_street1]"
end
def acquired_media_person_address_city
"acquired_media_release[person_address_city]"
end
def acquired_media_person_address_state
"acquired_media_release[person_address_state]"
end
def acquired_media_release_person_address_zip
"acquired_media_release[person_address_zip]"
end
def acquired_media_category_fields
find(:css, "#acquired_media_release_categories_artwork").set(true)
find(:css, "#acquired_media_release_categories_video_footage").set(true)
find(:css, "#acquired_media_release_categories_still_photograph").set(true)
end

View File

@@ -19,13 +19,13 @@ feature 'User managing appearance releases' do
fill_in person_first_name_field, with: 'Jane'
fill_in person_last_name_field, with: 'Doe'
fill_in person_address_field, with: '123 Test Lane, New York, NY 10000'
fill_in_person_address_fields
fill_in person_phone_field, with: '555-555-5555'
fill_in person_email_field, with: 'jane.doe@test.com'
fill_in person_date_of_birth, with: '01/01/1999'
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
click_button 'I have read and agree to the above'
click_button submit_release_button
expect(page).to have_content(successful_submission_message)
end
@@ -45,23 +45,88 @@ feature 'User managing appearance releases' do
page.check person_is_minor_checkbox
expect(page).to have_content('GUARDIAN INFORMATION')
expect(page).to have_content('GUARDIAN PHOTO')
expect(page).to have_content 'Guardian Email'
fill_in guardian_first_name_field, with: 'Guardian'
fill_in guardian_last_name_field, with: 'Name'
fill_in guardian_phone_field, with: '001101'
fill_in person_first_name_field, with: 'Jane'
fill_in person_last_name_field, with: 'Doe'
fill_in person_address_field, with: '123 Test Lane, New York, NY 10000'
fill_in_person_address_fields
fill_in person_phone_field, with: '555-555-5555'
fill_in person_email_field, with: 'jane.doe@test.com'
fill_in person_date_of_birth, with: '01/01/1999'
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
click_button 'I have read and agree to the above'
fill_in guardian_email_field, with: 'invalid@email'
click_button submit_release_button
expect(page).to have_content('Guardian email is not an email')
fill_in guardian_email_field, with: 'valid@email.com'
fill_in_guardian_address_fields
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
click_button submit_release_button
expect(page).to have_content(successful_submission_message)
end
scenario 'creating a release for a minor with two guardians', js: true do
allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true))
project = create(:project, members: current_user, account: current_user.primary_account)
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_appearance_release_path(project.account, project, contract_template)
expect(page).to have_photo_button
expect(page).not_to have_content('SECOND GUARDIAN INFORMATION')
expect(page).not_to have_content('SECOND GUARDIAN PHOTO')
page.check person_is_minor_checkbox
expect(page).to have_content('GUARDIAN INFORMATION')
expect(page).to have_content('GUARDIAN PHOTO')
expect(page).to have_content 'Guardian Email'
expect(page).to have_content 'SECOND GUARDIAN INFORMATION'
expect(page).to have_content 'SECOND GUARDIAN PHOTO'
expect(page).to have_content 'Guardian 2 Email'
expect(page).to have_content 'Guardian 2 Phone'
expect(page).to have_content 'Guardian 2 Address'
fill_in guardian_first_name_field, with: 'Guardian'
fill_in guardian_last_name_field, with: 'Name'
fill_in guardian_phone_field, with: '001101'
fill_in person_first_name_field, with: 'Jane'
fill_in person_last_name_field, with: 'Doe'
fill_in_person_address_fields
fill_in person_phone_field, with: '555-555-5555'
fill_in person_email_field, with: 'jane.doe@test.com'
fill_in person_date_of_birth, with: '01/01/1999'
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
fill_in guardian_email_field, with: 'invalid@email'
click_button submit_release_button
expect(page).to have_content('Guardian email is not an email')
fill_in guardian_email_field, with: 'valid@email.com'
fill_in_guardian_address_fields
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
fill_in guardian_2_first_name_field, with: 'Second'
fill_in guardian_2_last_name_field, with: 'Guardian'
fill_in guardian_2_phone_field, with: '999'
click_button submit_release_button
expect(page).to have_content(successful_submission_message)
expect(AppearanceRelease.last.guardian_2_first_name).to eq 'Second'
end
end
context 'when signed in' do
@@ -129,49 +194,48 @@ feature 'User managing appearance releases' do
expect(page).to have_content 'New Jane'
end
scenario 'user can enter information for second guardian when editing non native release for minor', js: true do
appearance_release = create(:appearance_release, :non_native, :minor, project: project)
visit edit_appearance_release_path(appearance_release)
expect(page).to have_content guardian_2_first_name_field.titleize
expect(page).to have_content guardian_2_photo_heading
fill_in guardian_first_name_field, with: 'Guardian'
fill_in guardian_last_name_field, with: 'Name'
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
fill_in guardian_2_first_name_field, with: 'Second'
fill_in guardian_2_last_name_field, with: 'guardian'
attach_file guardian_2_photo_field, file_fixture('person_photo.png'), visible: :all
click_button submit_update_button
expect(page).to have_content successful_update_message
expect(AppearanceRelease.last.guardian_2_photo.attached?).to eq true
end
scenario 'progress bar shows when user imports a release', js: true do
skip "TODO"
visit project_appearance_releases_path(project)
expect(page).not_to have_css('#upload-progress-container')
large_pdf_file = build_large_pdf_file
attach_file import_appearance_release_field, Rails.root.join(large_pdf_file.path), visible: false
expect(page).to have_css('#upload-progress-container')
expect(page).to have_content submit_create_button, wait: 30
click_button submit_create_button
expect(page).to have_content matching_started
end
scenario 'MatchAppearanceReleasesJob is started when import is finished', js: true do
visit project_appearance_releases_path(project)
attach_file import_appearance_release_field, Rails.root.join(file_fixture('person_photo.png')), visible: false
expect(page).to have_content importing_label
allow(MatchAppearanceReleasesJob).to receive(:perform_later).with(project, anything)
click_button submit_create_button
expect(page).to have_css('.progress')
end
scenario 'importing a releases works when image is selected', js: true do
expect(page).to have_content matching_started
visit project_appearance_releases_path(project)
expect(page).to have_content submit_create_button
expect(page).to have_content no_appearance_releases
attach_file import_appearance_release_field, Rails.root.join(file_fixture('person_photo.png')), visible: false
expect(page).to have_content importing_label
click_button submit_create_button
expect(page).not_to have_content no_appearance_releases
expect(page).to have_content /Imported Headshot\s+\d{7}/
end
scenario 'importing a releases works when pdf is selected', js: true do
visit project_appearance_releases_path(project)
expect(page).to have_content submit_create_button
expect(page).to have_content no_appearance_releases
attach_file import_appearance_release_field, Rails.root.join(file_fixture('contract.pdf')), visible: false
expect(page).to have_content importing_label
click_button submit_create_button
expect(page).not_to have_content no_appearance_releases
expect(page).to have_content /Imported Contract\s+\d{7}/
end
scenario 'importing a releases fails when file other than image or pdf is selected', js: true do
visit project_appearance_releases_path(project)
expect(page).to have_content submit_create_button
expect(page).to have_content no_appearance_releases
attach_file import_appearance_release_field, Rails.root.join(file_fixture('audio.mp3')), visible: false
expect(page).to have_content importing_label
click_button submit_create_button
expect(page).to have_content failed_to_import_notice
expect(page).to have_content no_appearance_releases
end
@@ -249,6 +313,7 @@ feature 'User managing appearance releases' do
expect(pdf_body).to have_content('TAGS')
expect(pdf_body).to have_content('Woman')
expect(pdf_body).to have_content('Brunette')
expect(pdf_body).not_to have_content('Guardian Email')
end
scenario 'viewing contract PDF for a minor without guardian photo' do
@@ -262,8 +327,10 @@ feature 'User managing appearance releases' do
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize)
expect(pdf_body).to have_content(appearance_release.name)
expect(pdf_body).to have_content(appearance_release.guardian_name)
expect(pdf_body).to have_content(appearance_release.guardian_email)
expect(pdf_body).to have_content photos_heading.upcase
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s)
expect(pdf_body).to have_content('Guardian Email')
end
scenario 'viewing contract PDF for a minor with guardian photo' do
@@ -277,9 +344,11 @@ feature 'User managing appearance releases' do
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize)
expect(pdf_body).to have_content(appearance_release.name)
expect(pdf_body).to have_content(appearance_release.guardian_name)
expect(pdf_body).to have_content(appearance_release.guardian_email)
expect(pdf_body).to have_content photos_heading(2).upcase
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s)
expect(pdf_body).to have_content(appearance_release.guardian_photo.filename.to_s)
expect(pdf_body).to have_content('Guardian Email')
end
scenario 'deleting a release', js: true do
@@ -422,6 +491,10 @@ feature 'User managing appearance releases' do
tempfile
end
def matching_started
t 'appearance_releases.create.matching_started'
end
def filter_type_all
t 'appearance_releases.type_filter_actions.all_releases'
end
@@ -458,6 +531,18 @@ feature 'User managing appearance releases' do
'appearance_release_minor'
end
def guardian_2_first_name_field
'Guardian 2 first name'
end
def guardian_2_last_name_field
'Guardian 2 last name'
end
def guardian_2_phone_field
'Guardian 2 phone'
end
def guardian_first_name_field
'Guardian first name'
end
@@ -470,24 +555,74 @@ feature 'User managing appearance releases' do
'Guardian phone'
end
def guardian_email_field
'Guardian email'
end
def guardian_address_street1_field
t('helpers.label.appearance_release.guardian_address_street1')
end
def guardian_address_city_field
t('helpers.label.appearance_release.guardian_address_city')
end
def guardian_address_state_field
t('helpers.label.appearance_release.guardian_address_state')
end
def guardian_address_zip_field
t('helpers.label.appearance_release.guardian_address_zip')
end
def guardian_photo_field
'appearance_release[guardian_photo]'
end
def guardian_2_photo_field
'appearance_release[guardian_2_photo]'
end
def person_name_field
t('helpers.label.appearance_release.person_name')
end
def person_first_name_field
'Person first name'
t('helpers.label.appearance_release.person_first_name')
end
def person_last_name_field
'Person last name'
t('helpers.label.appearance_release.person_last_name')
end
def person_address_field
t('helpers.label.appearance_release.person_address')
def fill_in_person_address_fields
fill_in person_address_street1_field, with: "123 Test Lane"
fill_in person_address_city_field, with: "New York"
fill_in person_address_state_field, with: "NY"
fill_in person_address_zip_field, with: '1000'
end
def fill_in_guardian_address_fields
fill_in guardian_address_street1_field, with: "124 Test Lane"
fill_in guardian_address_city_field, with: "New York"
fill_in guardian_address_state_field, with: "NY"
fill_in guardian_address_zip_field, with: '1000'
end
def person_address_street1_field
t('helpers.label.appearance_release.person_address_street1')
end
def person_address_city_field
t('helpers.label.appearance_release.person_address_city')
end
def person_address_state_field
t('helpers.label.appearance_release.person_address_state')
end
def person_address_zip_field
t('helpers.label.appearance_release.person_address_zip')
end
def person_email_field
@@ -518,6 +653,10 @@ feature 'User managing appearance releases' do
'Import Release'
end
def submit_release_button
'I have read and agree to the above'
end
def submit_update_button
'Save Changes'
end
@@ -549,4 +688,12 @@ feature 'User managing appearance releases' do
def successful_destroy_message
'The release has been deleted'
end
def guardian_photo_heading
t 'appearance_releases.form.photos.guardian_photo.heading'
end
def guardian_2_photo_heading
t 'appearance_releases.form.photos.guardian_2_photo.heading'
end
end

View File

@@ -1,83 +1,154 @@
require "rails_helper"
# frozen_string_literal: true
feature "User managing broadcasts" do
require 'rails_helper'
feature 'User managing broadcasts' do
let(:current_user) { create(:user, :manager) }
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
context "managing broadcasts" do
context 'managing broadcasts' do
before do
sign_in current_user
allow(MuxLiveStream).to receive(:new).and_return(double(id: "id", key: "key", playback_id: "playback_id"))
allow(MuxLiveStream).to receive(:new).and_return(double(id: 'id', key: 'key', playback_id: 'playback_id'))
end
scenario "creating and deleting a broadcast", js: true do
scenario 'creating and deleting a broadcast', js: true do
visit new_project_broadcast_path(project)
by "filling out the form" do
fill_in broadcast_name_field, with: "My Broadcast"
by 'filling out the form' do
fill_in broadcast_name_field, with: 'My Broadcast'
end
click_button "Create Live Stream"
expect(page).to have_content("A live stream has been created")
click_on "Manage"
expect(page).to have_link("Copy Stream URL", exact: true)
expect(page).to have_link("Copy Stream Key", exact: true)
expect(page).to have_link("View", exact: true)
expect(page).to have_link("Delete", exact: true)
click_button 'Create Live Stream'
expect(page).to have_content('A live stream has been created')
click_on 'Manage'
expect(page).to have_link('Copy Stream URL', exact: true)
expect(page).to have_link('Copy Stream Key', exact: true)
expect(page).to have_link('View', exact: true)
expect(page).to have_link('Delete', exact: true)
it_also "Deletes the broadcast" do
it_also 'Deletes the broadcast' do
allow_any_instance_of(Broadcast).to receive(:destroy_mux_live_stream).and_return(true)
accept_alert do
click_link "Delete"
click_link 'Delete'
end
expect(page).to have_content("A live stream has been deleted")
expect(page).not_to have_content("My Broadcast")
expect(page).to have_content('A live stream has been deleted')
expect(page).not_to have_content('My Broadcast')
end
end
scenario "visit show page of broadcast", js: true do
scenario 'visit show page of broadcast', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content("Live stream is waiting to begin.")
expect(page).to have_content("Copy URL")
click_on "Files"
expect(page).to have_content("contract.pdf")
expect(page).to have_content('Live stream is waiting to begin.')
expect(page).to have_content('Copy URL')
click_on "Previous Sessions"
within '#files' do
expect(page).to have_content('contract.pdf')
end
click_on 'Previous Sessions'
expect(page).to have_content(recording.download_file_name)
end
scenario "visit multi-view broadcast page", js: true do
broadcasts = create_list(:broadcast, 4, :with_stream, project: project)
scenario 'user can go back and forth between live session and previous sessions', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content broadcast.name.titleize, count: 1
expect(page).to have_content recording.download_file_name, count: 0
click_on switch_view_dropdown
expect(page).to have_content broadcast.name.titleize, count: 2
expect(page).to have_content recording.download_file_name, count: 1
live_stream_nav_item = page.find('.dropdown-item', text: broadcast.name.titleize)
recording_nav_item = page.find('.dropdown-item', text: recording.download_file_name)
expect(live_stream_nav_item[:class].include?('active')).to eq true
expect(recording_nav_item[:class].include?('active')).to eq false
click_on recording.download_file_name
expect(page).to have_content broadcast.name.titleize, count: 1
expect(page).to have_content recording.download_file_name, count: 0
expect(live_stream_nav_item[:class].include?('active')).to eq false
expect(recording_nav_item[:class].include?('active')).to eq true
click_on switch_view_dropdown
click_on broadcast.name.titleize
expect(page).to have_content broadcast.name.titleize, count: 1
expect(page).to have_content recording.download_file_name, count: 0
# Page is reloaded, we need to get dropdown items again
live_stream_nav_item = page.find('.dropdown-item', text: broadcast.name.titleize, visible: :all)
recording_nav_item = page.find('.dropdown-item', text: recording.download_file_name, visible: :all)
expect(live_stream_nav_item[:class].include?('active')).to eq true
expect(recording_nav_item[:class].include?('active')).to eq false
end
scenario 'form will not submit if user clicks Add files without selected files', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content('Live stream is waiting to begin.')
expect(page).to have_content add_file_button
click_on add_file_button
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)
visit project_broadcasts_path(project)
click_checkboxes
new_window = window_opened_by { click_link "Multi-View" }
within_window new_window do
expect(page).to have_content("Switch View")
click_on "Switch View"
expect(page).to have_link(broadcasts.first.name)
expect(page).to have_link(broadcasts.second.name)
end
new_window = window_opened_by { click_link 'Multi-View' }
within_window new_window do
expect(page).to have_content switch_view_dropdown
click_on switch_view_dropdown
expect(page).to have_link('Broadcast 1')
expect(page).to have_link('Broadcast 2')
within '#files' do
click_on 'Broadcast 1'
expect(page).to have_content('contract.pdf')
click_on 'Broadcast 2'
expect(page).to have_content('contract.pdf')
end
end
end
end
private
def add_file_button
'Add File'
end
def broadcast_name_field
"broadcast[name]"
'broadcast[name]'
end
def click_checkboxes
all('input[type="checkbox"]')[0].click
all('input[type="checkbox"]')[1].click
all('input[type="checkbox"]')[2].click
end
def switch_view_dropdown
'Switch View'
end
end

View File

@@ -5,25 +5,72 @@ feature "User managing location releases" do
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
context "when signed out" do
scenario "creating a release", js: true do
scenario "United States is default country" do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
expect(country_field_value).to eq "US"
end
scenario "creating a release without photos", js: true do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
by "filling out the form" do
fill_in location_name_field, with: "Benny's Burritos"
fill_in location_address_street_1, with: "Location's street address"
fill_in location_address_city, with: "Location's city"
fill_in location_address_state, with: "Location's state"
fill_in location_address_zip, with: "Location's zip"
fill_in person_first_name_field, with: "Jane"
fill_in person_last_name_field, with: "Doe"
fill_in person_phone_field, with: "555-555-5555"
fill_in person_email_field, with: "jane.doe@test.com"
fill_in person_company_field, with: "BIG"
fill_in person_title_field, with: "Ms."
fill_in person_address_street1_field, with: "100 Broadway"
fill_in person_address_city, with: "Person's City"
fill_in person_address_state, with: "Person's State"
fill_in person_address_zip, with: "Person's Zip"
fill_in filming_hours_field, with: "04:00 - 22:00"
draw_signature file_fixture("signature.png"), "location_release_signature_base64"
end
click_button "I have read and agree to the above"
click_button submit_release_button
expect(page).to have_content("Your release was successfully submitted. Thank you.")
end
scenario "creating a release with photos", js: true do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
fill_in location_name_field, with: "Benny's Burritos"
fill_in location_address_street_1, with: "Location's street address"
fill_in location_address_city, with: "Location's city"
fill_in location_address_state, with: "Location's state"
fill_in location_address_zip, with: "Location's zip"
fill_in person_first_name_field, with: "Jane"
fill_in person_last_name_field, with: "Doe"
fill_in person_phone_field, with: "555-555-5555"
fill_in person_email_field, with: "jane.doe@test.com"
fill_in person_company_field, with: "BIG"
fill_in person_title_field, with: "Ms."
fill_in person_address_street1_field, with: "100 Broadway"
fill_in person_address_city, with: "Person's City"
fill_in person_address_state, with: "Person's State"
fill_in person_address_zip, with: "Person's Zip"
fill_in filming_hours_field, with: "04:00 - 22:00"
draw_signature file_fixture("signature.png"), "location_release_signature_base64"
drop_file Rails.root.join(file_fixture("location_photo.png")), type: :dropzone
click_button submit_release_button
expect(page).to have_content("Your release was successfully submitted. Thank you.")
expect(LocationRelease.last.photos.attached?).to eq true
end
end
context "when signed in" do
@@ -51,6 +98,7 @@ feature "User managing location releases" do
by "filling out the remaining information" do
fill_in_release_fields name: "Test Location Release"
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")
@@ -136,6 +184,7 @@ feature "User managing location releases" do
:native,
project: project,
name: "Benny's Burritos",
filming_hours: "06:00 - 20:00",
tag_list: "Restaurant",
notes: [
build(:note,
@@ -172,6 +221,8 @@ feature "User managing location releases" do
expect(pdf_body).to have_content("Restaurant")
expect(pdf_body).to have_content photos_heading.upcase
expect(pdf_body).to have_content("location_photo.png")
expect(pdf_body).to have_content("Filming Hours")
expect(pdf_body).to have_content("06:00 - 20:00")
end
context "when the user is associate" do
@@ -190,6 +241,10 @@ feature "User managing location releases" do
private
def country_field_value
find_field("location_release[person_address_country]").value
end
def photos_heading(photos_count = 1)
t 'contracts.photos.heading', count: photos_count
end
@@ -198,6 +253,22 @@ feature "User managing location releases" do
"location_release[name]"
end
def location_address_street_1
"location_release[address_street1]"
end
def location_address_city
"location_release[address_city]"
end
def location_address_state
"location_release[address_state]"
end
def location_address_zip
"location_release[address_zip]"
end
def contract_field
"location_release[contract]"
end
@@ -210,18 +281,42 @@ feature "User managing location releases" do
"location_release[person_last_name]"
end
def person_email_field
"location_release[person_email]"
end
def person_address_street1_field
"location_release[person_address_street1]"
end
def person_address_city
"location_release[person_address_city]"
end
def person_address_state
"location_release[person_address_state]"
end
def person_address_zip
"location_release[person_address_zip]"
end
def person_phone_field
"location_release[person_phone]"
end
def person_email_field
"location_release[person_email]"
end
def person_company_field
"location_release[person_company]"
end
def person_title_field
"location_release[person_title]"
end
def filming_hours_field
"location_release[filming_hours]"
end
def have_photo(filename, attr: "src")
have_selector("img[#{attr}*='#{filename}']")
end
@@ -246,6 +341,10 @@ feature "User managing location releases" do
t "helpers.submit.location_release.create"
end
def submit_release_button
t("shared.submit_release_long")
end
def create_release_notice
t "location_releases.create.notice"
end

View File

@@ -5,21 +5,84 @@ feature "User managing material releases" do
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
context "when signed out" do
scenario "creating a release", js: true do
scenario "United States is default country" do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
expect(country_field_value).to eq "US"
end
scenario "creating a release without photos", js: true do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
by "filling out the form" do
fill_in material_name_field, with: "Pepsi Logo"
fill_in person_first_name_field, with: "Jane"
fill_in person_last_name_field, with: "Doe"
draw_signature file_fixture("signature.png"), "material_release_signature_base64"
end
fill_all_fields
draw_signature file_fixture("signature.png"), "material_release_signature_base64"
click_button "I have read and agree to the above"
click_button submit_release_button
expect(page).to have_content("Your release was successfully submitted. Thank you.")
expect(page).to have_content success_submit_message
end
scenario "creating a release with photos", js: true do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
fill_all_fields
draw_signature file_fixture("signature.png"), "material_release_signature_base64"
drop_file Rails.root.join(file_fixture("material_photo.png")), type: :dropzone
click_button submit_release_button
expect(page).to have_content success_submit_message
expect(MaterialRelease.last.photos.attached?).to eq true
end
scenario "creating release is possible only after filling all fields", js: true do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
fill_in material_name_field, with: "Pepsi Logo"
expect_failed_client_side_validation
fill_in material_description_field, with: "Description text"
expect_failed_client_side_validation
fill_in person_first_name_field, with: "Jane"
expect_failed_client_side_validation
fill_in person_last_name_field, with: "Doe"
expect_failed_client_side_validation
fill_in person_phone_field, with: "2229929229"
expect_failed_client_side_validation
fill_in person_email_field, with: "mail@mail.com"
expect_failed_client_side_validation
fill_in person_company_field, with: "Company"
expect_failed_client_side_validation
fill_in person_title_field, with: "Mr."
expect_failed_client_side_validation
fill_in person_address_street1_field, with: "Street 1 address"
expect_failed_client_side_validation
fill_in person_city_field, with: "City"
expect_failed_client_side_validation
fill_in person_state_field, with: "State"
expect_failed_client_side_validation
fill_in person_zip_field, with: "ZIP"
draw_signature file_fixture("signature.png"), "material_release_signature_base64"
click_button submit_release_button
expect(page).to have_content success_submit_message
end
end
@@ -180,6 +243,10 @@ feature "User managing material releases" do
private
def country_field_value
find_field("material_release[person_address_country]").value
end
def photos_heading(photos_count = 1)
t 'contracts.photos.heading', count: photos_count
end
@@ -188,6 +255,10 @@ feature "User managing material releases" do
"material_release[name]"
end
def material_description_field
"material_release[description]"
end
def person_first_name_field
"material_release[person_first_name]"
end
@@ -196,6 +267,38 @@ feature "User managing material releases" do
"material_release[person_last_name]"
end
def person_phone_field
"material_release[person_phone]"
end
def person_email_field
"material_release[person_email]"
end
def person_company_field
"material_release[person_company]"
end
def person_title_field
"material_release[person_title]"
end
def person_address_street1_field
"material_release[person_address_street1]"
end
def person_city_field
"material_release[person_address_city]"
end
def person_state_field
"material_release[person_address_state]"
end
def person_zip_field
"material_release[person_address_zip]"
end
def have_photo(filename)
have_selector("img[src*='#{filename}']")
end
@@ -224,6 +327,10 @@ feature "User managing material releases" do
t "helpers.submit.material_release.create"
end
def submit_release_button
t 'shared.submit_release_long'
end
def create_release_notice
t "material_releases.create.notice"
end
@@ -250,4 +357,29 @@ feature "User managing material releases" do
select "Other", from: "Restriction"
fill_in "Describe other restrictions", with: "Test"
end
def fill_all_fields
fill_in material_name_field, with: "Pepsi Logo"
fill_in material_description_field, with: "Description text"
fill_in person_first_name_field, with: "Jane"
fill_in person_last_name_field, with: "Doe"
fill_in person_phone_field, with: "2229929229"
fill_in person_email_field, with: "mail@mail.com"
fill_in person_company_field, with: "Company"
fill_in person_title_field, with: "Mr."
fill_in person_address_street1_field, with: "Street 1 address"
fill_in person_city_field, with: "City"
fill_in person_state_field, with: "State"
fill_in person_zip_field, with: "ZIP"
end
def success_submit_message
'Your release was successfully submitted. Thank you.'
end
def expect_failed_client_side_validation
draw_signature file_fixture("signature.png"), "material_release_signature_base64"
click_button submit_release_button
expect(page).not_to have_content success_submit_message
end
end

View File

@@ -0,0 +1,399 @@
require "rails_helper"
feature "User managing medical releases" do
let(:current_user) { create(:user) }
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
context "when signed out" do
scenario 'creating a release for an adult', js: true do
allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true))
project = create(:project, members: current_user, account: current_user.primary_account)
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_medical_release_path(project.account, project, contract_template)
fill_in person_first_name_field, with: 'Jane'
fill_in person_last_name_field, with: 'Doe'
fill_in_person_address_fields
fill_in person_phone_field, with: '555-555-5555'
fill_in person_email_field, with: 'jane.doe@test.com'
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
draw_signature file_fixture("signature.png"), "medical_release_signature_base64"
expect do
click_button submit_release_button
end.to change(MedicalRelease, :count).by(1)
expect(page).to have_content(successful_submission_message)
end
scenario 'creating a release for a minor', js: true do
allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true))
project = create(:project, members: current_user, account: current_user.primary_account)
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_medical_release_path(project.account, project, contract_template)
expect(page).not_to have_content guardian_information_heading.upcase
expect(page).not_to have_content guardian_photo_heading.upcase
page.check person_is_minor_checkbox
expect(page).to have_content guardian_information_heading.upcase
expect(page).to have_content guardian_photo_heading.upcase
expect(page).to have_content guardian_email_field.titleize
fill_in guardian_first_name_field, with: 'Guardian'
fill_in guardian_last_name_field, with: 'Name'
fill_in guardian_phone_field, with: '001101'
fill_in person_first_name_field, with: 'Jane'
fill_in person_last_name_field, with: 'Doe'
fill_in_person_address_fields
fill_in person_phone_field, with: '555-555-5555'
fill_in person_email_field, with: 'jane.doe@test.com'
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
draw_signature file_fixture('signature.png'), 'medical_release_signature_base64'
fill_in guardian_email_field, with: 'invalid@email'
click_button submit_release_button
expect(page).to have_content email_validation_error_for('Guardian')
fill_in guardian_email_field, with: 'valid@email.com'
fill_in_guardian_address_fields
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
draw_signature file_fixture('signature.png'), 'medical_release_signature_base64'
click_button submit_release_button
expect(page).to have_content(successful_submission_message)
end
scenario 'creating a release for a minor with two guardians', js: true do
allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true))
project = create(:project, members: current_user, account: current_user.primary_account)
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_medical_release_path(project.account, project, contract_template)
expect(page).not_to have_content guardian_2_information_heading.upcase
expect(page).not_to have_content guardian_2_photo_heading.upcase
page.check person_is_minor_checkbox
expect(page).to have_content guardian_information_heading.upcase
expect(page).to have_content guardian_photo_heading.upcase
expect(page).to have_content guardian_email_field.titleize
expect(page).to have_content guardian_2_information_heading.upcase
expect(page).to have_content guardian_2_photo_heading.upcase
expect(page).to have_content guardian_2_email_field.titleize
expect(page).to have_content guardian_2_phone_field.titleize
expect(page).to have_content guardian_2_address_street1_field.titleize
fill_in guardian_first_name_field, with: 'Guardian'
fill_in guardian_last_name_field, with: 'Name'
fill_in guardian_phone_field, with: '001101'
fill_in person_first_name_field, with: 'Jane'
fill_in person_last_name_field, with: 'Doe'
fill_in_person_address_fields
fill_in person_phone_field, with: '555-555-5555'
fill_in person_email_field, with: 'jane.doe@test.com'
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
draw_signature file_fixture('signature.png'), 'medical_release_signature_base64'
fill_in guardian_email_field, with: 'invalid@email'
click_button submit_release_button
expect(page).to have_content email_validation_error_for('Guardian')
fill_in guardian_email_field, with: 'valid@email.com'
fill_in_guardian_address_fields
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
draw_signature file_fixture('signature.png'), 'medical_release_signature_base64'
fill_in guardian_2_first_name_field, with: 'Second'
fill_in guardian_2_last_name_field, with: 'Guardian'
fill_in guardian_2_phone_field, with: '999'
click_button submit_release_button
expect(page).to have_content(successful_submission_message)
expect(MedicalRelease.last.guardian_2_first_name).to eq 'Second'
end
end
context "when signed in as account manager" do
before do
sign_in current_user
end
scenario "Download All is visible" do
create(:medical_release_with_contract_template, :native, project: project)
create(:medical_release_with_contract_template, :non_native, project: project)
visit project_medical_releases_path(project)
expect(page).to have_content download_all_button
end
scenario "Download action in Manage menu is visible" do
create(:medical_release_with_contract_template, :native, project: project)
create(:medical_release_with_contract_template, :non_native, project: project)
visit project_medical_releases_path(project)
expect(page).to have_link("Download", exact: true, count: 2)
end
scenario "Downloading PDF of native medical release is possible" do
native_release = create(:medical_release_with_contract_template, :native, project: project)
visit project_medical_releases_path(project)
click_link *view_release_pdf_link_for(native_release)
expect(content_type).to eq('application/pdf')
end
end
context "when the user is manager(project manager)" do
let(:current_user) { create(:user, :manager) }
before do
sign_in current_user
end
scenario "Download All is not visible" do
create(:medical_release_with_contract_template, :native, project: project)
create(:medical_release_with_contract_template, :non_native, project: project)
visit project_medical_releases_path(project)
expect(page).not_to have_content download_all_button
end
scenario "Download action in Manage menu is not visible" do
create(:medical_release_with_contract_template, :native, project: project)
create(:medical_release_with_contract_template, :non_native, project: project)
visit project_medical_releases_path(project)
expect(page).to have_link("Download", exact: true, count: 0)
end
scenario "Downloading PDF of native medical release is not possible" do
native_release = create(:medical_release_with_contract_template, :native, project: project)
visit project_medical_releases_path(project)
link = medical_release_contracts_path(native_release, format: 'pdf')
expect { visit link }.to raise_exception Pundit::NotAuthorizedError
end
scenario "Downloading PDF of non native medical release is not possible" do
non_native_release = create(:medical_release_with_contract_template, :non_native, project: project)
visit project_medical_releases_path(project)
link = medical_release_contracts_path(non_native_release, format: 'pdf')
expect { visit link }.to raise_exception Pundit::NotAuthorizedError
end
end
context "when the user is associate" do
let(:current_user) { create(:user, :associate) }
before do
sign_in current_user
end
scenario "Download All is not visible" do
create(:medical_release_with_contract_template, :native, project: project)
create(:medical_release_with_contract_template, :non_native, project: project)
visit project_medical_releases_path(project)
expect(page).not_to have_content download_all_button
end
scenario "Download action in Manage menu is not visible" do
create(:medical_release_with_contract_template, :native, project: project)
create(:medical_release_with_contract_template, :non_native, project: project)
visit project_medical_releases_path(project)
expect(page).to have_link("Download", exact: true, count: 0)
end
scenario "Downloading PDF of native medical release is not possible" do
native_release = create(:medical_release_with_contract_template, :native, project: project)
visit project_medical_releases_path(project)
link = medical_release_contracts_path(native_release, format: 'pdf')
expect { visit link }.to raise_exception Pundit::NotAuthorizedError
end
scenario "Downloading PDF of non native medical release is not possible" do
non_native_release = create(:medical_release_with_contract_template, :non_native, project: project)
visit project_medical_releases_path(project)
link = medical_release_contracts_path(non_native_release, format: 'pdf')
expect { visit link }.to raise_exception Pundit::NotAuthorizedError
end
end
private
def download_all_button
'Download All'
end
def download_action
'Download'
end
def manage_button
t 'medical_releases.medical_release.actions.manage'
end
def view_release_pdf_link_for(release)
['Download', href: medical_release_contracts_path(release, format: 'pdf')]
end
def person_first_name_field
"medical_release[person_first_name]"
end
def person_last_name_field
"medical_release[person_last_name]"
end
def person_email_field
"medical_release[person_email]"
end
def person_phone_field
"medical_release[person_phone]"
end
def submit_release_button
t 'shared.submit_release_short'
end
def successful_submission_message
"Your release was successfully submitted. Thank you."
end
def fill_in_person_address_fields
fill_in person_address_street1_field, with: "123 Test Lane"
fill_in person_address_city_field, with: "New York"
fill_in person_address_state_field, with: "NY"
fill_in person_address_zip_field, with: '1000'
end
def fill_in_guardian_address_fields
fill_in guardian_address_street1_field, with: "124 Test Lane"
fill_in guardian_address_city_field, with: "New York"
fill_in guardian_address_state_field, with: "NY"
fill_in guardian_address_zip_field, with: '1000'
end
def person_address_street1_field
t('helpers.label.medical_release.person_address_street1')
end
def person_address_city_field
t('helpers.label.medical_release.person_address_city')
end
def person_address_state_field
t('helpers.label.medical_release.person_address_state')
end
def person_address_zip_field
t('helpers.label.medical_release.person_address_zip')
end
def guardian_first_name_field
t('helpers.label.medical_release.guardian_first_name')
end
def guardian_last_name_field
t('helpers.label.medical_release.guardian_last_name')
end
def guardian_phone_field
t('helpers.label.medical_release.guardian_phone')
end
def guardian_email_field
t('helpers.label.medical_release.guardian_email')
end
def guardian_address_street1_field
t('helpers.label.medical_release.guardian_address_street1')
end
def guardian_address_city_field
t('helpers.label.medical_release.guardian_address_city')
end
def guardian_address_state_field
t('helpers.label.medical_release.guardian_address_state')
end
def guardian_address_zip_field
t('helpers.label.medical_release.guardian_address_zip')
end
def guardian_photo_field
'medical_release[guardian_photo]'
end
def person_is_minor_checkbox
'medical_release_minor'
end
def guardian_2_first_name_field
t('helpers.label.medical_release.guardian_2_first_name')
end
def guardian_2_last_name_field
t('helpers.label.medical_release.guardian_2_last_name')
end
def guardian_2_phone_field
t('helpers.label.medical_release.guardian_2_phone')
end
def guardian_2_email_field
t('helpers.label.medical_release.guardian_2_email')
end
def guardian_2_address_street1_field
t('helpers.label.medical_release.guardian_2_address_street1')
end
def email_validation_error_for(prefix)
"#{prefix} email is not an email"
end
def guardian_photo_heading
t 'public.medical_releases.new.guardian_photo.heading'
end
def guardian_information_heading
t 'public.medical_releases.new.guardian_info.heading'
end
def guardian_2_photo_heading
t 'public.medical_releases.new.guardian_2_photo.heading'
end
def guardian_2_information_heading
t 'public.medical_releases.new.guardian_2_info.heading'
end
end

View File

@@ -0,0 +1,55 @@
require "rails_helper"
feature "User managing misc releases" do
let(:current_user) { create(:user) }
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
context "when signed in as account manager" do
before do
sign_in current_user
end
scenario "Download All is visible" do
create(:misc_release_with_contract_template, :native, project: project)
visit project_misc_releases_path(project)
expect(page).to have_content download_all_button
end
scenario "Downloading PDF of native misc release is possible" do
native_release = create(:misc_release_with_contract_template, :native, project: project)
visit project_misc_releases_path(project)
click_link *view_release_pdf_link_for(native_release)
expect(content_type).to eq('application/pdf')
end
end
context "when the user is manager(project manager)" do
let(:current_user) { create(:user, :manager) }
before do
sign_in current_user
end
scenario "Download action in Manage menu is not visible" do
create(:misc_release_with_contract_template, :native, project: project)
visit project_misc_releases_path(project)
expect(page).to have_link("Download", exact: true, count: 0)
end
end
private
def download_all_button
'Download All'
end
def view_release_pdf_link_for(release)
['Download', href: misc_release_contracts_path(release, format: 'pdf')]
end
end

View File

@@ -5,6 +5,13 @@ feature "User managing talent releases" do
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
context "when signed out" do
scenario "United States is default country" do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_talent_release_path(project.account, project, contract_template)
expect(country_field_value).to eq "US"
end
scenario "creating a release for an adult", js: true do
contract_template = create(:contract_template, project: project)
@@ -55,6 +62,47 @@ feature "User managing talent releases" do
expect(page).to have_content("Your release was successfully submitted. Thank you.")
end
scenario "creating a release for a minor with two guardians", js: true do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_talent_release_path(project.account, project, contract_template)
expect(page).not_to have_content guardian_information_heading.upcase
expect(page).not_to have_content guardian_2_information_heading.upcase
expect(page).not_to have_content guardian_photo_heading.upcase
expect(page).not_to have_content guardian_2_photo_heading.upcase
page.check person_is_minor_checkbox
expect(page).to have_content guardian_information_heading.upcase
expect(page).to have_content guardian_2_information_heading.upcase
expect(page).to have_content guardian_photo_heading.upcase
expect(page).to have_content guardian_2_photo_heading.upcase
fill_in person_first_name_field, with: "Jane"
fill_in person_last_name_field, with: "Doe"
fill_in person_address_field, with: "123 Test Lane, New York, NY 10000"
fill_in person_phone_field, with: "555-555-5555"
fill_in person_email_field, with: "jane.doe@test.com"
fill_in guardian_first_name_field, with: "Guardian"
fill_in guardian_last_name_field, with: "Name"
fill_in guardian_phone_field, with: "001101"
fill_in guardian_2_first_name_field, with: "Second"
fill_in guardian_2_last_name_field, with: "Guardian"
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
attach_file guardian_photo_field, file_fixture("hemsworth.jpeg"), visible: :all
attach_file guardian_2_photo_field, file_fixture("person_photo.png"), visible: :all
draw_signature file_fixture("signature.png"), "talent_release_signature_base64"
click_button submit_button
expect(page).to have_content success_submit_message
expect(TalentRelease.last.guardian_2_photo.attached?).to eq true
expect(TalentRelease.last.guardian_2_name).to eq "Second Guardian"
end
end
context "when signed in" do
@@ -118,6 +166,43 @@ feature "User managing talent releases" do
expect(page).to have_photo("person_photo.png")
end
scenario "creating a release for minor with two guardians", js: true do
visit new_project_talent_release_path(project)
expect(page).not_to have_content guardian_photo_heading
expect(page).not_to have_content guardian_2_photo_heading
page.check person_is_minor_checkbox
expect(page).to have_content guardian_photo_heading
expect(page).to have_content guardian_2_photo_heading
fill_in person_first_name_field, with: "John"
fill_in person_last_name_field, with: "Doe"
fill_in guardian_first_name_field, with: "Guardian"
fill_in guardian_last_name_field, with: "Name"
fill_in guardian_phone_field, with: "01010"
fill_in guardian_2_first_name_field, with: "Second"
fill_in guardian_2_last_name_field, with: "Guardian"
fill_in_exploitable_rights
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
attach_file guardian_photo_field, Rails.root.join(file_fixture("hemsworth.jpeg")), visible: false
attach_file guardian_2_photo_field, Rails.root.join(file_fixture("pratt.jpg")), visible: false
click_button create_release_button
expect(page).to have_content create_release_notice
expect(page).to have_photo("person_photo.png")
expect(TalentRelease.last.guardian_2_photo.attached?).to eq true
expect(TalentRelease.last.guardian_2_name).to eq "Second Guardian"
end
scenario "updating an existing release" do
talent_release = create(:talent_release, project: project)
@@ -274,6 +359,10 @@ feature "User managing talent releases" do
private
def country_field_value
find_field("talent_release[person_address_country]").value
end
def photos_heading(photos_count = 1)
t 'contracts.photos.heading', count: photos_count
end
@@ -290,6 +379,14 @@ feature "User managing talent releases" do
"Guardian last name"
end
def guardian_2_first_name_field
"talent_release[guardian_2_first_name]"
end
def guardian_2_last_name_field
"talent_release[guardian_2_last_name]"
end
def guardian_phone_field
"Guardian phone"
end
@@ -298,6 +395,10 @@ feature "User managing talent releases" do
"talent_release[guardian_photo]"
end
def guardian_2_photo_field
"talent_release[guardian_2_photo]"
end
def have_photo_button
have_selector(".take-photo-button")
end
@@ -376,4 +477,32 @@ feature "User managing talent releases" do
select "Other", from: "Restriction"
fill_in "Describe other restrictions", with: "Test"
end
def guardian_information_heading
t 'public.talent_releases.new.guardian_info.heading'
end
def guardian_2_information_heading
t 'public.talent_releases.new.guardian_2_info.heading'
end
def guardian_photo_heading
t 'public.talent_releases.new.guardian_photo.heading'
end
def guardian_2_photo_heading
t 'public.talent_releases.new.guardian_2_photo.heading'
end
def submit_button
t 'shared.submit_release_long'
end
def success_submit_message
"Your release was successfully submitted. Thank you."
end
def contract_field
"talent_release[contract]"
end
end

View File

@@ -521,8 +521,8 @@ feature "User performs video analysis" do
new_path = polymorphic_path([:new, video, release, :video_release_confirmation])
first("form[action='#{new_path}']").click_button
expect(page).to have_content "Timecode in"
expect(page).to have_content "Source file name"
expect(page).to have_content "Timecode In"
expect(page).to have_content "Source File Name"
click_on "Show/Hide EDL Events"
within "#edl_events" do
@@ -572,8 +572,8 @@ feature "User performs video analysis" do
new_path = polymorphic_path([:new, video, release, :video_release_confirmation])
first("form[action='#{new_path}']").click_button
expect(page).to have_content "Timecode in"
expect(page).to have_content "Source file name"
expect(page).to have_content "Timecode In"
expect(page).to have_content "Source File Name"
click_on "Show/Hide EDL Events"
within "#edl_events" do
@@ -748,8 +748,8 @@ feature "User performs video analysis" do
open_graphics_element_modal(video)
expect(page).to have_content "Timecode in"
expect(page).to have_content "Source file name"
expect(page).to have_content "Timecode In"
expect(page).to have_content "Source File Name"
click_on "Show/Hide EDL Events"
within "#edl_events" do
@@ -796,8 +796,8 @@ feature "User performs video analysis" do
open_graphics_element_modal(video)
expect(page).to have_content "Timecode in"
expect(page).to have_content "Source file name"
expect(page).to have_content "Timecode In"
expect(page).to have_content "Source File Name"
click_on "Show/Hide EDL Events"
within "#edl_events" do
@@ -1188,8 +1188,8 @@ feature "User performs video analysis" do
open_audio_confirmation_modal
expect(page).to have_field("Origin", with: "Original Music")
expect(page).to have_content "Timecode in"
expect(page).to have_content "Source file name"
expect(page).to have_content "Timecode In"
expect(page).to have_content "Source File Name"
expect(page).to have_field("Source EDL", with: "Audio")
click_on "Show/Hide EDL Events"
@@ -1219,10 +1219,10 @@ feature "User performs video analysis" do
expect(page).to have_field("Source EDL", with: "All Tracks")
expect(page).to have_field("Channel", with: "A1")
expect(page).to have_field("Origin", with: "Library Music")
expect(page).to have_field("Timecode in", with: "01:00:00:00")
expect(page).to have_field("Timecode In", with: "01:00:00:00")
expect(page).to have_field("Timecode out", with: "01:00:02:00")
expect(page).to have_field("Duration", with: "00:00:02")
expect(page).to have_field("Source file name", with: "source_file_name.wav")
expect(page).to have_field("Source File Name", with: "source_file_name.wav")
expect(page).to have_field("Clip name", with: "clip_name")
expect(page).to have_field("Description", with: "description")
@@ -1323,8 +1323,8 @@ feature "User performs video analysis" do
open_unreleased_modal(video)
expect(page).to have_content "Timecode in"
expect(page).to have_content "Source file name"
expect(page).to have_content "Timecode In"
expect(page).to have_content "Source File Name"
click_on "Show/Hide EDL Events"
within "#edl_events" do
@@ -1371,8 +1371,8 @@ feature "User performs video analysis" do
open_unreleased_modal(video)
expect(page).to have_content "Timecode in"
expect(page).to have_content "Source file name"
expect(page).to have_content "Timecode In"
expect(page).to have_content "Source File Name"
click_on "Show/Hide EDL Events"
within "#edl_events" do
@@ -1445,7 +1445,7 @@ feature "User performs video analysis" do
first("#suggested_matches form[action='#{new_path}']").click_button
expect(page).to have_content "Timecode in"
expect(page).to have_content "Timecode In"
within "form[action='#{create_path}']" do
click_button "Confirm Release"
@@ -1462,7 +1462,7 @@ feature "User performs video analysis" do
$("#audio_matches .releasable-match button")[0].click()
JS
expect(page).to have_content "Timecode in"
expect(page).to have_content "Timecode In"
end
def select_option(select_id, text)
@@ -1486,7 +1486,7 @@ feature "User performs video analysis" do
JS
expect(page).to have_field("Origin", with: "Library Music")
expect(page).to have_content "Timecode in"
expect(page).to have_content "Timecode In"
within "form[action='#{create_path}']" do
expect(page).to have_selector("#matched_file_name", text: "library_file_name")
@@ -1518,7 +1518,7 @@ feature "User performs video analysis" do
first("form[action='#{new_path}']", text: text).click_button
expect(page).to have_content "Timecode in"
expect(page).to have_content "Timecode In"
within "form[action='#{create_path}']" do
click_button "Confirm Release"
@@ -1536,7 +1536,7 @@ feature "User performs video analysis" do
first("#music_releases form[action='#{new_path}']", text: text).click_button
expect(page).to have_field("Origin", with: "Original Music")
expect(page).to have_content "Timecode in"
expect(page).to have_content "Timecode In"
within "form[action='#{create_path}']" do
select "Vocal", from: "Music type"