File indexing completed on 2024-05-12 05:01:24

0001 #!/usr/bin/env python3
0002 
0003 # SPDX-License-Identifier: MIT
0004 # SPDX-FileCopyrightText: 2021-2022 Harald Sitter <sitter@kde.org>
0005 # SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
0006 
0007 import os
0008 import subprocess
0009 import sys
0010 import unittest
0011 
0012 from appium import webdriver
0013 from appium.options.common.base import AppiumOptions
0014 from appium.webdriver.common.appiumby import AppiumBy
0015 
0016 
0017 class OpenUserDetailsTest(unittest.TestCase):
0018 
0019     mockServerProcess: subprocess.Popen
0020 
0021     @classmethod
0022     def setUpClass(cls):
0023         cls.mockServerProcess = subprocess.Popen([sys.executable, os.path.join(os.path.dirname(__file__), "login-server.py")])
0024         options = AppiumOptions()
0025         options.set_capability("app", "neochat --ignore-ssl-errors --test")
0026         cls.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
0027 
0028     def setUp(self):
0029         pass
0030 
0031     def tearDown(self):
0032         if not self._outcome.result.wasSuccessful():
0033             self.driver.get_screenshot_as_file("failed_test_shot_{}.png".format(self.id()))
0034 
0035     @classmethod
0036     def tearDownClass(self):
0037         self.mockServerProcess.terminate()
0038         self.driver.quit()
0039 
0040     def test_open_sheet(self):
0041         self.driver.find_element(by=AppiumBy.NAME, value="@user:localhost:1234").click()
0042         self.driver.find_element(by=AppiumBy.NAME, value="Empty room (!room_id_1234:localhost:1234)").click()
0043         self.driver.find_element(by=AppiumBy.NAME, value="A Display Name").click()
0044         self.driver.find_element(by=AppiumBy.NAME, value="Account Details")
0045 
0046 
0047 if __name__ == '__main__':
0048     unittest.main()