class UpgradeContext < PublicContext
  def initialize
    super
    create_login_page
    create_signup_page
    create_pricing_page
  end

  def close_fedora_upgrade_modal
    within('.modal-header') { find('button').click }
  end

  def expect_current_plan
    plan_selectors = {
      'Monthly-Basic' => ':nth-of-type(1)',
      'Monthly-Professional' => ':nth-of-type(2)',
      'Monthly-High-Volume' => ':nth-of-type(3)',
    }
    plan_selector = plan_selectors[@current_user['plan_type']]
    plan_card = find(".plan-list .plan-list-item#{plan_selector}")
    expect(plan_card).to have_content("Current Plan")
  end
end
