File indexing completed on 2024-04-21 16:29:27

0001 #!/usr/bin/env ruby
0002 # frozen_string_literal: true
0003 
0004 # SPDX-License-Identifier: MIT
0005 # SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
0006 
0007 require 'appium_lib'
0008 require 'minitest/autorun'
0009 
0010 $stdout.sync = true
0011 $stderr.sync = true
0012 
0013 class TestKInfoCenter < Minitest::Test
0014   attr_reader :driver
0015 
0016   def setup
0017     app = 'org.kde.kinfocenter.desktop'
0018     app = 'kinfocenter --platform xcb' if ENV['TEST_WITH_XWAYLAND']
0019     @appium_driver = Appium::Driver.new(
0020       {
0021         'caps' => { app: app },
0022         'appium_lib' => {
0023           server_url: 'http://127.0.0.1:4723',
0024           wait_timeout: 10,
0025           wait_interval: 0.5
0026         }
0027       }, true
0028     )
0029     @driver = @appium_driver.start_driver
0030   end
0031 
0032   def teardown
0033     driver&.quit
0034   end
0035 
0036   def test_search
0037     search = driver.find_element(:name, 'Search')
0038     search.click
0039     search.send_keys('HahA')
0040     assert_equal(search.text, 'HahA')
0041   end
0042 end