Upstream sync

This commit is contained in:
Senad Uka
2020-07-03 10:23:03 +02:00
parent d6a3542308
commit 2dea0f29b9
32 changed files with 860 additions and 72 deletions

View File

@@ -13,6 +13,7 @@ feature "User imports release templates", type: :feature do
end
scenario "importing two existing templates into a project" do
create(:contract_template, project: project)
visit project_contract_templates_path(project)
click_on "Import Release Template"
select_templates([project_one_template.id, project_two_template.id])
@@ -31,6 +32,7 @@ feature "User imports release templates", type: :feature do
end
scenario "searching for a template", js: true do
create(:contract_template, project: project)
visit project_contract_templates_path(project)
click_on "Import Release Template"
fill_in "query", with: "Second"

View File

@@ -11,6 +11,13 @@ 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
visit project_contract_templates_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content create_release_template
end
scenario 'creating a new release template' do
visit new_project_contract_template_path(project)
@@ -25,7 +32,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
select 'None', from: 'Restriction'
click_on 'Create Release Template'
expect(page).to have_content('The release template has been created')
expect(page).to have_content(create_contract_template_success_message)
end
scenario 'medical release template has a guardian clause field' do
@@ -36,10 +43,28 @@ RSpec.feature 'User manages contract templates', type: :feature do
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(page).to have_content(create_contract_template_success_message)
expect(ContractTemplate.last.guardian_clause.body.to_s).to match /Guardian clause text/
end
scenario 'misc release templates has guardian clause and questionnaire', js: true do
visit new_project_contract_template_path(project)
fill_in 'Name', with: 'My Misc Release'
select 'Misc Release', from: 'Release type'
expect(page).to have_selector('label', text: 'Guardian Clause')
MiscRelease::NUMBER_OF_CUSTOM_FIELDS.times do |n|
expect(page).to have_field(question_field(n+1))
end
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'
expect(page).to have_content(create_contract_template_success_message)
end
scenario 'preview new talent release template without guardian clause' do
visit new_project_contract_template_path(project)
select 'Talent Release', from: 'Release type'
@@ -143,13 +168,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'
expect(page).not_to have_content('The release template has been created')
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'
expect(page).not_to have_content('The release template has been created')
expect(page).not_to have_content(create_contract_template_success_message)
end
end
@@ -223,12 +248,20 @@ RSpec.feature 'User manages contract templates', type: :feature do
let(:current_user) { create(:user, :associate) }
it 'does not show management buttons for release templates' do
create(:contract_template, project: project)
visit project_contract_templates_path(project)
expect(page).not_to have_content('Create New Release Template')
expect(page).not_to have_content(import_template_button)
expect(page).not_to have_content('Delete')
end
it 'does not show create release button on splash page' do
visit project_contract_templates_path(project)
expect(page).to have_content schedule_demo
expect(page).not_to have_content create_release_template
end
end
context 'When the user is account manager' do
@@ -242,6 +275,13 @@ RSpec.feature 'User manages contract templates', type: :feature do
click_on 'Manage'
expect(page).to have_content('Archive')
end
it 'does not show 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
end
end
private
@@ -270,7 +310,23 @@ RSpec.feature 'User manages contract templates', type: :feature do
'contract_template_guardian_clause_trix_input_contract_template'
end
def create_contract_template_success_message
'The release template has been created'
end
def question_field(n)
"Question #{n} text"
end
def fill_hidden(id, with:)
find(:xpath, "//input[@id='#{id}']", visible: false).set with
end
def schedule_demo
t 'contract_templates.splash.actions.book_demo'
end
def create_release_template
t 'contract_templates.splash.actions.create_template'
end
end

View File

@@ -12,6 +12,13 @@ feature 'User managing broadcasts' do
allow(MuxLiveStream).to receive(:new).and_return(double(id: 'id', key: 'key', playback_id: 'playback_id'))
end
scenario "splash page is shown if there are no existing streams" do
visit project_broadcasts_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content create_stream
end
scenario 'creating and deleting a broadcast', js: true do
visit new_project_broadcast_path(project)
@@ -131,6 +138,29 @@ feature 'User managing broadcasts' do
end
end
end
context 'When the user is associate' do
let(:current_user) { create(:user, :associate) }
it 'does not show button to create new live stream' do
visit project_broadcasts_path(project)
expect(page).to have_content schedule_demo
expect(page).not_to have_content create_stream
end
end
context 'When the user is account manager' do
let(:current_user) { create(:user, :account_manager) }
it 'does show button to create new live stream' do
visit project_broadcasts_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content create_stream
end
end
end
private
@@ -151,4 +181,12 @@ feature 'User managing broadcasts' do
def switch_view_dropdown
'Switch View'
end
def schedule_demo
t 'broadcasts.splash.actions.book_demo'
end
def create_stream
t 'broadcasts.splash.actions.create_stream'
end
end

View File

@@ -4,6 +4,34 @@ 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 out' do
scenario 'creating a release for an adult', js: true do
project = create(:project, members: current_user, account: current_user.primary_account)
contract_template = create(:misc_release_contract_template,
question_1_text: "Question 1",
project: project)
visit new_account_project_contract_template_misc_release_path(project.account, project, contract_template)
expect(page).to have_content("QUESTIONNAIRE")
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 question_1_field, with: "Answer 1"
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
draw_signature file_fixture("signature.png"), "misc_release_signature_base64"
expect do
click_button submit_release_button
end.to change(MiscRelease, :count).by(1)
expect(page).to have_content(successful_submission_message)
end
end
context "when signed in as account manager" do
before do
sign_in current_user
@@ -25,6 +53,52 @@ feature "User managing misc releases" do
click_link *view_release_pdf_link_for(native_release)
expect(content_type).to eq('application/pdf')
end
scenario 'viewing the contract PDF' do
misc_release = create(:misc_release,
:native,
contract_template: build(:misc_release_contract_template, question_1_text: 'Q1'),
question_1_answer: 'A1',
project: project,
person_first_name: 'Jane',
person_last_name: 'Doe',
tag_list: 'Woman, Brunette',
notes: [
build(:note,
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)),
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))
])
sign_in(current_user)
visit project_misc_releases_path(project)
click_link *view_release_pdf_link_for(misc_release)
expect(content_type).to eq('application/pdf')
expect(content_disposition).to include('inline')
expect(pdf_filename).to include('doe-jane')
expect(pdf_body).to have_content('Jane Doe')
expect(pdf_body).to have_content('NOTES')
expect(pdf_body).to have_content('Note 1')
expect(pdf_body).to have_content('jane.doe@test.com')
expect(pdf_body).to have_content('2/21/20 12:00 PM')
expect(pdf_body).to have_content('Note 2')
expect(pdf_body).to have_content('john.doe@test.com')
expect(pdf_body).to have_content('2/20/20 11:00 AM')
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')
expect(pdf_body).to have_content('QUESTIONNAIRE')
expect(pdf_body).to have_content('Q1')
expect(pdf_body).to have_content('A1')
end
end
context "when the user is manager(project manager)" do
@@ -52,4 +126,55 @@ feature "User managing misc releases" do
def view_release_pdf_link_for(release)
['Download', href: misc_release_contracts_path(release, format: 'pdf')]
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 person_address_street1_field
t('helpers.label.misc_release.person_address_street1')
end
def person_address_city_field
t('helpers.label.misc_release.person_address_city')
end
def person_address_state_field
t('helpers.label.misc_release.person_address_state')
end
def person_address_zip_field
t('helpers.label.misc_release.person_address_zip')
end
def person_first_name_field
t('helpers.label.misc_release.person_first_name')
end
def person_last_name_field
t('helpers.label.misc_release.person_last_name')
end
def person_email_field
t('helpers.label.misc_release.person_email')
end
def person_phone_field
t('helpers.label.misc_release.person_phone')
end
def question_1_field
'misc_release[question_1_answer]'
end
def submit_release_button
t 'shared.submit_release_long'
end
def successful_submission_message
"Your release was successfully submitted. Thank you."
end
end

View File

@@ -8,7 +8,14 @@ feature "User managing task requests" do
sign_in current_user
end
scenario "splash page is shown if there are no task requests" do
visit project_task_requests_path(project)
expect(page).to have_content schedule_demo
end
scenario "task requests table is visible" do
create(:task_request, project: project, description: 'Short Desc')
visit project_task_requests_path(project)
expect(page).to have_content "Created On"
@@ -19,10 +26,6 @@ feature "User managing task requests" do
end
scenario "sees list of task requests" do
visit project_task_requests_path(project)
expect(page).to have_content no_task_requests_label
task_request = create(:task_request, project: project)
visit project_task_requests_path(project)
@@ -113,4 +116,8 @@ feature "User managing task requests" do
def long_description_text
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
end
def schedule_demo
t 'task_requests.splash.actions.book_demo'
end
end

View File

@@ -1,8 +1,8 @@
require "rails_helper"
feature "User managing videos" do
let(:current_user) { create(:user) }
let(:project) { create(:project, account: current_user.primary_account) }
let(:current_user) { create(:user, :manager) }
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
let!(:video) do
create(:video,
:with_graphics_only_edl_file,
@@ -17,6 +17,14 @@ feature "User managing videos" do
sign_in current_user
end
scenario "splash page is shown if there are no existing videos" do
Video.delete_all
visit project_videos_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content upload_new_video
end
scenario "creating a video", js: true do
visit project_videos_path(project)
click_link "Upload New Video"
@@ -96,6 +104,30 @@ feature "User managing videos" do
expect(page).to have_content("Second Video")
end
context 'When the user is associate' do
let(:current_user) { create(:user, :associate) }
it 'does show button to upload new video' do
Video.delete_all
visit project_videos_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content upload_new_video
end
end
context 'When the user is account manager' do
let(:current_user) { create(:user, :account_manager) }
it 'does show button to upload new video' do
Video.delete_all
visit project_videos_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content upload_new_video
end
end
private
def fill_in_video_fields(data)
@@ -115,4 +147,12 @@ feature "User managing videos" do
def update_video_notice
t "videos.update.notice"
end
def schedule_demo
t 'videos.splash.actions.book_demo'
end
def upload_new_video
t 'videos.splash.actions.upload_video'
end
end