# frozen_string_literal: true

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Appium
  module Android
    module Espresso
      module Helper
        # Find the first element that contains value
        # @param class_name [String] the class name for the element
        # @param value [String] the value to search for
        # @return [Element]
        def complex_find_contains(class_name, value)
          find_element :xpath, string_visible_contains_xpath(class_name, value)
        end

        # Find all elements containing value
        # @param class_name [String] the class name for the element
        # @param value [String] the value to search for
        # @return [Array<Element>]
        def complex_finds_contains(class_name, value)
          find_elements :xpath, string_visible_contains_xpath(class_name, value)
        end

        # Find the first element exactly matching value
        # @param class_name [String] the class name for the element
        # @param value [String] the value to search for
        # @return [Element]
        def complex_find_exact(class_name, value)
          find_element :xpath, string_visible_exact_xpath(class_name, value)
        end

        # Find all elements exactly matching value
        # @param class_name [String] the class name for the element
        # @param value [String] the value to search for
        # @return [Element]
        def complex_finds_exact(class_name, value)
          find_elements :xpath, string_visible_exact_xpath(class_name, value)
        end
      end # module Helper
    end # module Espresso
  end # module Android
end # module Appium
