File indexing completed on 2024-04-14 15:48:45

0001 #!/usr/bin/env python3
0002 
0003 # SPDX-License-Identifier: MIT
0004 # SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org>
0005 
0006 import unittest
0007 from appium import webdriver
0008 from appium.options.common.base import AppiumOptions
0009 
0010 
0011 class SimpleCalculatorTests(unittest.TestCase):
0012 
0013     @classmethod
0014     def setUpClass(self):
0015         options = AppiumOptions()
0016         # unused actually but need one so the driver is happy
0017         options.set_capability("app", "org.kde.kcalc.desktop")
0018         self.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
0019 
0020     @classmethod
0021     def tearDownClass(self):
0022         # Make sure to terminate the driver again, lest it dangles.
0023         self.driver.quit()
0024 
0025     def test_initialize(self):
0026         self.driver.set_clipboard_text("asdf")
0027         text = self.driver.get_clipboard_text()
0028         self.assertEqual(text, "asdf")
0029 
0030         self.driver.set_clipboard_text("qwer")
0031         text = self.driver.get_clipboard_text()
0032         self.assertEqual(text, "qwer")
0033 
0034 
0035 if __name__ == '__main__':
0036     unittest.main()