When(/^I enter a series of Video IDs/) do
  on(OA::ClaimYouTubeVideosPage).video_id_claim_textarea_element.element.set "UnW3xkHxIEQ,6XSEi1jTR58"
end

And(/^I fail to select a CMSA/) do
  on(OA::ClaimYouTubeVideosPage).send_video_ids_button_element.click
end

Then(/^I see a validation message instructing me to select a CMSA/) do
  on OA::ClaimYouTubeVideosPage do |page|
    fail unless expect(page.validation_message_element.text).to match(
      "No CMS Account was selected to batch claim on behalf of."
    )
    puts "Validation Message: #{page.validation_message_element.text}"
  end
end

When(/^I select an available Orchard CMSA/) do
  on OA::ClaimYouTubeVideosPage do |page|
    page.cms_account_selector = "The Orchard Music"
    puts "Selected CMSA: #{page.cms_account_selector}"
    page.send_video_ids_button_element.click
  end
end

Then(/^I see a validation message saying the IDs were entered for claiming/) do
  on OA::ClaimYouTubeVideosPage do |page|
    fail unless expect(page.validation_message_element.text).to match(
      "These were successfully inserted and will be picked up by BACON for analysis and claiming"
    )
    puts "Validation Message: #{page.validation_message_element.text}"
  end
end
