You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: user_views_releases_spec.rb
    path of file: ./repos/gitlabhq/spec/features/projects/releases
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

requir
    
      def sort_page(by:, direction:)
        within_testid 'releases-sort' do
          find_by_testid('base-dropdown-toggle').click

          find('li.gl-new-dropdown-item', text: by).click

          find('.sorting-direction-button').click if direction == :ascending
        end
      end